From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>

Date: Tue, 26 May 2009 11:48:42 -0400

Received on Tue May 26 2009 - 09:48:42 MDT

Date: Tue, 26 May 2009 11:48:42 -0400

Hi Mary. As always, Thank you, I didn't mean to cause confusion; in my last

script I first tried plotting with the vpXF/vpYF resources for individual

plots and then I tried plotting a panel plot to see the difference. When I

first asked NCL-talk this question 4 days ago, I was only doing a panel plot

and I was was getting the same result. Somebody suggested I look at example

9 and example 20. Example 9 uses this along with the vpXF/vpYF resources and

example 20 does not, so...I tried using both resources.

I'll try your suggestion of using the vpXF/vpYF resources for individual

plots method along with gsn_labelbar_ndc

BUT.... I just want to confirm. In this case, is my only option to "not use"

gsn_panel?

It just seems awkward that I have to go through another tedious route even

though all of my plots, save one, are the same.

Please, here, I tried making it clearer by doing the panel plot part of the

script in command-line.

1. First, I first create the panel plot using the TRMM data. The result is

attached as "test_TRMM_panel.jpg"

I do the panel commands from ncl 40> onward.

noble:TRMM3B42 enoble$ #NCL Panel

noble:TRMM3B42 enoble$ ncl

Copyright (C) 1995-2009 - All Rights Reserved

University Corporation for Atmospheric Research

NCAR Command Language Version 5.1.0

The use of this software is governed by a License Agreement.

See http://www.ncl.ucar.edu/ for more details.

ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

ncl 5> a = addfile("TRMM_SOP3_0.50x0.50_res.nc","r")

ncl 6> rNEW = a->precipitation

ncl 7> printVarSummary(rNEW)

Variable: rNEW

Type: float

Total Size: 138240000 bytes

34560000 values

Number of Dimensions: 3

Dimensions and sizes: [Time | 240] x [lat | 200] x [lon | 720]

Coordinates:

Time: [1..240]

lat: [-49.875..49.625]

lon: [-179.875..179.625]

Number Of Attributes: 1

_FillValue : -999

ncl 8> ;DATA to Plot

ncl 9> total_rain = dim_sum_Wrap(rNEW(lat|:, lon|:, Time|:) )

ncl 10> total_TRMM_R1=total_rain({5:11},{-30:-20})

ncl 11> total_TRMM_R2=total_rain({7:18},{-20:-10})

ncl 12> total_TRMM_R3=total_rain({7:18},{-10:10})

ncl 13> total_TRMM_R4=total_rain({7:18},{10:30})

ncl 14> wks = gsn_open_wks("ps","Test_TRMM_panel")

ncl 15> ;;;;;;;;;;;;;;;;;;;From NCL WRF example;;;;;;;;;;

ncl 16> colors = (/"white","black" \ ; {for/back}ground

ncl 16> ,"white","azure" \

ncl 16> ,"green","palegreen","yellowgreen", "greenyellow" \

ncl 16> ,"yellow","goldenrod","orange","orangered" \

ncl 16>

,"red","deeppinK","violet","darkviolet","blueviolet","blue"/)

ncl 17> gsn_define_colormap(wks, colors)

ncl 18> res = True ; plot mods desired

ncl 19> ;res_at_gsnMaximize = True ; uncomment to

maximize size

ncl 20> res_at_gsnSpreadColors = True ; use full range of

colormap

ncl 21> res_at_cnFillOn = True ;False ; color plot

desired

ncl 22> res_at_cnLinesOn = False ; turn off contour

lines

ncl 23> res_at_cnLineLabelsOn = False ; turn off contour

labels

ncl 24>

ncl 25> res_at_cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn

levels

ncl 26> res_at_cnLevels =

(/0,50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800/)

ncl 27> res_at_cnFillMode = "AreaFill" ;"RasterFill"

ncl 28> res_at_lbOrientation = "Vertical" ; default is horizontal

ncl 29> ; Plot the big plot

ncl 30> x = gsn_csm_contour_map_ce(wks,total_rain,res)

ncl 31> ;;;;;;;Plot Panel plot;;;;;;;;

ncl 32> res_at_gsnAddCyclic = False

ncl 33> ;;;;;;;;;The are parts from NCL examples

ncl 34>

ncl 35>

;****************************************************************************

ncl 36> ; create panel of different components

ncl 37>

;****************************************************************************

ncl 38> plts = new (4 , "graphic") ; 1d array to hold

plots

ncl 39>

ncl 40> res_at_gsnDraw = False ; (a) do not draw

ncl 41> res_at_gsnFrame = False ; (b) do not advance

'frame'

ncl 42> res_at_lbLabelBarOn = False ; (c) turn off

individual lb's

ncl 43>

ncl 44> ;************************************************

ncl 45> ; create panel: panel plots have their own set of resources

ncl 46> ;************************************************

ncl 47> resP = True ; modify the panel

plot

ncl 48> ; resP_at_gsnDebugWriteFileName = True

ncl 49> ; resP_at_gsnMaximize = True ; maximize panel area

ncl 50> resP_at_gsnPanelRowSpec = True ; specify 1 top, 2

lower level

ncl 51> resP_at_gsnPanelLabelBar = True ; add common colorbar

ncl 52> resP_at_pmLabelBarWidthF = 0.85 ; make label wider

ncl 53> resP_at_lbLabelFontHeightF = 0.015 ; default 0.02 [demo

make smaller]

ncl 54>

res_at_mpMinLatF = 5. ; range to zoom in on

res_at_mpMaxLatF = 11.

res_at_mpMinLonF = -30.

res_at_mpMaxLonF = -20.

res_at_gsnLeftString = "Region 1: Atlantic ITCZ"

plts(0) = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)

res_at_mpMinLatF = 7. ; range to zoom in on

res_at_mpMaxLatF = 18.

res_at_mpMinLonF = -20.

res_at_mpMaxLonF = -10.

res_at_gsnLeftString = "Region 2: Western Sahel"

plts(1) = gsn_csm_contour_map_ce(wks,total_TRMM_R2,res)

res_at_mpMinLatF = 7. ; range to zoom in on

res_at_mpMaxLatF = 18.

res_at_mpMinLonF = -10.

res_at_mpMaxLonF = 10.

res_at_gsnLeftString = "Region 3: Central Sahel"

plts(2) = gsn_csm_contour_map_ce(wks,total_TRMM_R3,res)

res_at_mpMinLatF = 7. ; range to zoom in on

res_at_mpMaxLatF = 18.

res_at_mpMinLonF = 10.

res_at_mpMaxLonF = 30.

res_at_gsnLeftString = "Region 4: Eastern Sahel"

plts(3) = gsn_csm_contour_map_ce(wks,total_Tncl 55> res_at_mpMinLatF

= 5. ; range to zoom in on

ncl 56> res_at_mpMaxLatF = 11.

ncl 57> res_at_mpMinLonF = -30.

ncl 58> res_at_mpMaxLonF = -20.

ncl 59> res_at_gsnLeftString = "Region 1: Atlantic ITCZ"

ncl 60> plts(0) = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)

ncl 61> res_at_mpMinLatF = 7. ; range to zoom in on

ncl 62> res_at_mpMaxLatF = 18.

ncl 63> res_at_mpMinLonF = -20.

ncl 64> res_at_mpMaxLonF = -10.

ncl 65> res_at_gsnLeftString = "Region 2: Western Sahel"

ncl 66> plts(1) = gsn_csm_contour_map_ce(wks,total_TRMM_R2,res)

ncl 67> res_at_mpMinLatF = 7. ; range to zoom in on

ncl 68> res_at_mpMaxLatF = 18.

ncl 69> res_at_mpMinLonF = -10.

ncl 70> res_at_mpMaxLonF = 10.

ncl 71> res_at_gsnLeftString = "Region 3: Central Sahel"

ncl 72> plts(2) = gsn_csm_contour_map_ce(wks,total_TRMM_R3,res)

ncl 73> res_at_mpMinLatF = 7. ; range to zoom in on

ncl 74> res_at_mpMaxLatF = 18.

ncl 75> res_at_mpMinLonF = 10.

ncl 76> res_at_mpMaxLonF = 30.

ncl 77> res_at_gsnLeftString = "Region 4: Eastern Sahel"

ncl 78> plts(3) = gsn_csm_contour_map_ce(wks,total_TRMM_R4,res)

ncl 79> resP_at_txString = "Total Precipitation, TRMM (September 2006)"

ncl 80> gsn_panel(wks,plts,(/2,2/),resP) ; now draw as one

plot

*************************************************************************************

As you can see I still get the ackward panel plot. Plot 2 runs into plot 4.

On Tue, May 26, 2009 at 9:29 AM, Mary Haley <haley_at_ucar.edu> wrote:

*>
*

*> Erik,
*

*>
*

*> There are a few things wrong with your script.
*

*>
*

*> First, you have the following code before the gsn_panel call:
*

*>
*

*> ;
*

*> ; Maximize plots in frame.
*

*> ;
*

*> psres = True
*

*> maximize_output(wks,psres) ; calls draw and frame for you
*

*>
*

*> I'm not sure why you're doing this, but it's causing your plots
*

*> to be resized before gsn_panel is called. Try commenting
*

*> this code out.
*

*>
*

*> Second, setting the vpXF/vpYF resources for individual plots is not
*

*> going to change what happens when you call gsn_panel. These resources
*

*> are for changing the behavior when/if you draw the individual plots on
*

*> their own frames.
*

*>
*

*> When you call gsn_panel, it expects that all the plots you are passing
*

*> it are *exactly* the same size. The X,Y positions of the individual
*

*> plots have no bearing because they are recalculated for the panel.
*

*>
*

*> Finally, just because you've set vpWidthF and vpHeightF for the
*

*> individual plots to the same size, this doesn't necessarily mean the
*

*> plots will be the same size.
*

*>
*

*> For one, when you draw map plots, the width and height may be adjusted
*

*> in order to keep the aspect ratio correct for the type of map you're
*

*> drawing. I think this is the problem in your case, since you
*

*> are setting the map limits to different values for each map.
*

*>
*

*> From the way you are setting your map limits, I'm guessing your plots
*

*> are of rather different sizes. gsn_panel is not going to work
*

*> here.
*

*>
*

*> To panel plots of different sizes, please see example 20 at:
*

*>
*

*> http://www.ncl.ucar.edu/Applications/panel.shtml
*

*>
*

*> This example does *not* use gsn_panel. Instead, it uses the vpXXX
*

*> resources to control the size and location of the individual plots.
*

*>
*

*> This method will require that you create your own labelbar. You can
*

*> use gsn_labelbar_ndc to do this.
*

*>
*

*> Go to:
*

*>
*

*> http://www.ncl.ucar.edu/Applications/func_list.shtml
*

*>
*

*> and scroll down to "gsn_labelbar_ndc" to see several
*

*> examples that demonstrate this procedure.
*

*>
*

*> --Mary
*

*>
*

*>
*

*>
*

*> On Tue, 26 May 2009, Erik Noble wrote:
*

*>
*

*> Hi Thank you for pointing this example out. This still did not help. I
*

*>> included the res_at_vpXF & res_at_vpYF; they separated the images but the top
*

*>> right image is still too large compared to the rest. (It actually as the
*

*>> exact same dimensions in the x-axis as the 1st image. also, the axes of
*

*>> the
*

*>> bottom two images are twice the size of the top left image but NCL plots
*

*>> them exactly the same).
*

*>> Is there any other way make them all the same size in the figure?
*

*>> -erik
*

*>>
*

*>>
*

*>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
*

*>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
*

*>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
*

*>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
*

*>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
*

*>> setfileoption("bin","ReadByteOrder","BigEndian")
*

*>> nlat = 400;default latitudes in file 0.25 by 0.25 degree
*

*>> nlon = 1440 ;default longitutdes in file 0.25 by 0.25 degree
*

*>> fils = systemfunc("ls *precipitation.bin")
*

*>> nfils = dimsizes(fils)
*

*>> prate = new((/nfils,nlat,nlon/),"float") ; New array for rain rate
*

*>>
*

*>> p = new((/nfils,nlat,nlon/),"float") ; New array for rain
*

*>> do gg = 0,dimsizes(fils)-1 ; Do loop to extract variable form
*

*>> binary files
*

*>> prate(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float")
*

*>> p(gg,:,:) = prate(gg,:,:) * 3 ; rain per three hours (mm)
*

*>> end do
*

*>>
*

*>> rain = where(p.lt.0.01 , 0.0, p) ; keep precipitation values above
*

*>> zero
*

*>> printMinMax(rain, True)
*

*>>
*

*>> rain!0="Time"
*

*>>
*

*>> ;;;;;;;;;;;;;;;;;;;;Coordinates........What is neccessary to plot a map
*

*>> plot?????
*

*>> rain!1="Lat"
*

*>> Lat = ispan(0,nlat-1,1)*0.25 - 49.875 ; From TRMM README file
*

*>> Lat_at_units = "degrees_north"
*

*>> rain_at_Lat =Lat
*

*>>
*

*>> rain!2="Lon"
*

*>> Lon = ispan(0,nlon-1,1)*0.25 - 179.875 ; From TRMM README file
*

*>> Lon_at_units = "degrees_east"
*

*>> rain_at_Lon =Lon
*

*>>
*

*>> lat2d = rain(0,:,:)
*

*>> lon2d = rain(0,:,:)
*

*>> lat2d_at_units = "degrees_north"
*

*>> lon2d_at_units = "degrees_east"
*

*>>
*

*>> printVarSummary(rain)
*

*>>
*

*>> ;;;;For regridding function;;;;
*

*>> ylat = Lat
*

*>> xlon = Lon
*

*>> ylat!0 = "Lat"
*

*>> xlon!0 = "Lon"
*

*>> lat2d = new((/400,1440/),float)
*

*>> lon2d = new((/400,1440/),float)
*

*>> lat2d!0 = "Lat"
*

*>> lat2d!1 = "Lon"
*

*>> lon2d!0 = "Lat"
*

*>> lon2d!1 = "Lon"
*

*>> lat2d_at_units = "degrees_north"
*

*>> lon2d_at_units = "degrees_east"
*

*>> ; Just copy the 2d grid coordinates to match the rain array and keep
*

*>> number
*

*>> of elements consistent.
*

*>> do i=0,399
*

*>> lon2d(i,:) = xlon(:)
*

*>> end do
*

*>> do i=0,1439
*

*>> lat2d(:,i) = ylat(:)
*

*>> end do
*

*>> ;;; Now, we want to regrid the TRMM data to a 0.5 by 0.5 grid. This means
*

*>> that it we have to divide by half.
*

*>> NLAT = 200
*

*>> NLAT = 200; 400/2
*

*>> MLON = 720
*

*>> MLON = 720; 1440/2
*

*>> lat = ispan(0,NLAT-1,1)*0.50 - 49.875
*

*>> lon = ispan(0,MLON-1,1)*0.50 - 179.875
*

*>> lat!0 = "lat"
*

*>> lat_at_units = "degrees_north"
*

*>> lat&lat = lat
*

*>> lon!0 = "lon"
*

*>> lon_at_units = "degrees_east"
*

*>> lon&lon = lon
*

*>> rNEW = new ((/dimsizes(fils),NLAT,MLON/),typeof(rain),getFillValue(rain))
*

*>> ;New rain array
*

*>> rNEW!0 = "Time"
*

*>> rNEW&Time = ispan(1,dimsizes(fils),1)
*

*>> rNEW!1 = "lat"
*

*>> rNEW&lat = lat
*

*>> rNEW!2 = "lon"
*

*>> rNEW&lon = lon
*

*>> ;;;;;;;;;;;;;;TRIPLE2GRID;;;;;;;;;;;;;;;
*

*>> do ii = 0,dimsizes(fils)-1
*

*>> rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d), ndtooned(
*

*>> rain(ii,:,:)),lon,lat,False)
*

*>> end do
*

*>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*

*>> rm= systemfunc("rm TRMM_SOP3_0.50x0.50_res.nc") ;remove the file we are
*

*>> about to create
*

*>> a = addfile("TRMM_SOP3_0.50x0.50_res.nc","c")
*

*>> a_at_title = "1 month of daily accumulated precipitation"
*

*>> filedimdef(a,"time",-1,True) ; make time an UNLIMITED dimension, always
*

*>> recommended
*

*>> a->precipitation=rNEW
*

*>>
*

*>>
*

*>> printVarSummary(rNEW)
*

*>> printMinMax(rNEW,True)
*

*>> total_rain = dim_sum_Wrap(rNEW(lat|:, lon|:, Time|:) )
*

*>> printMinMax(total_rain,True)
*

*>>
*

*>> ; The next set of commands set up plot properties
*

*>> wks = gsn_open_wks("ps","Test_TRMM")
*

*>> colors = (/"white","black" \ ; {for/back}ground
*

*>> ,"white","azure" \
*

*>> ,"green","palegreen","yellowgreen", "greenyellow" \
*

*>> ,"yellow","goldenrod","orange","orangered" \
*

*>> ,"red","deeppinK","violet","darkviolet","blueviolet","blue"/)
*

*>>
*

*>> gsn_define_colormap(wks, colors)
*

*>> res = True ; plot mods desired
*

*>> ;res_at_gsnDebugWriteFileName = True
*

*>> ;res_at_gsnMaximize = True ; uncomment to maximize
*

*>> size
*

*>> res_at_gsnSpreadColors = True ; use full range of colormap
*

*>> res_at_cnFillOn = True ;False ; color plot desired
*

*>> res_at_cnLinesOn = False ; turn off contour lines
*

*>> res_at_cnLineLabelsOn = False ; turn off contour labels
*

*>>
*

*>> res_at_cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn
*

*>> levels
*

*>> res_at_cnLevels =
*

*>> (/0,50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800/)
*

*>> res_at_cnFillMode = "AreaFill" ;"RasterFill"
*

*>> res_at_lbOrientation = "Vertical" ; default is horizontal
*

*>> ;res_at_gsnZonalMean = True
*

*>> ; Plot the plots
*

*>> ;x = gsn_csm_contour_map_ce(wks,total_rain,res)
*

*>> ;total_TRMM_R1=total_rain({5.0:11.5},{-30.875:-20.875})
*

*>> total_TRMM=total_rain({-20:25},{-35:35})
*

*>> total_TRMM_R1=total_rain({5:11},{-30:-20})
*

*>> total_TRMM_R2=total_rain({7:18},{-20:-10})
*

*>> total_TRMM_R3=total_rain({7:18},{-10:10})
*

*>> total_TRMM_R4=total_rain({7:18},{10:30})
*

*>> printVarSummary(total_TRMM_R1)
*

*>> printVarSummary(total_TRMM_R2)
*

*>> printVarSummary(total_TRMM_R3)
*

*>> printVarSummary(total_TRMM_R4)
*

*>> res_at_gsnAddCyclic = False
*

*>> res_at_gsnFrame = False ; don't advance frame
*

*>> res_at_gsnDraw = False ; don't draw plots
*

*>> ; res_at_lbLabelBarOn = False
*

*>> ;Plot Region 1, from
*

*>> rn_R1(it,:,:)=rainw(8,55:67,10:30)-rainw(0,55:67,10:30)
*

*>> res_at_mpMinLatF = -20. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 25.
*

*>> res_at_mpMinLonF = -35.
*

*>> res_at_mpMaxLonF = 35.
*

*>> res_at_gsnLeftString = "West African Region"
*

*>> ;x1a = gsn_csm_contour_map_ce(wks,total_TRMM,res)
*

*>> ;;;;;;;;;;May 20, 2009, Aftr hint form Dr. Shea and NCL-talk, Hopefuly it
*

*>> works!;;;;;
*

*>> res_at_mpMinLatF = 5. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 11.
*

*>> res_at_mpMinLonF = -30.
*

*>> res_at_mpMaxLonF = -20.
*

*>> res_at_gsnLeftString = "Region 1: Atlantic ITCZ"
*

*>> res_at_gsnRightString = "mm"
*

*>> res_at_vpXF = 0.05 ; position and sizes
*

*>> res_at_vpYF = 0.94 ; for XY plot
*

*>> res_at_vpWidthF = 0.40
*

*>> res_at_vpHeightF = 0.40
*

*>> x1 = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = -20.
*

*>> res_at_mpMaxLonF = -10.
*

*>> res_at_gsnLeftString = "Region 2: Western Sahel"
*

*>> res_at_vpXF = 0.53
*

*>> x2 = gsn_csm_contour_map_ce(wks,total_TRMM_R2,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = -10.
*

*>> res_at_mpMaxLonF = 10.
*

*>> res_at_gsnLeftString = "Region 3: Central Sahel"
*

*>> res_at_vpXF = 0.05 ; position and sizes
*

*>> res_at_vpYF = 0.54 ; for XY plot
*

*>> res_at_vpWidthF = 0.40
*

*>> res_at_vpHeightF = 0.40
*

*>>
*

*>> x3 = gsn_csm_contour_map_ce(wks,total_TRMM_R3,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = 10.
*

*>> res_at_mpMaxLonF = 30.
*

*>> res_at_gsnLeftString = "Region 4: Eastern Sahel"
*

*>> res_at_vpXF = 0.53 ; position and sizes
*

*>> x4 = gsn_csm_contour_map_ce(wks,total_TRMM_R4,res)
*

*>> ;
*

*>> ; Maximize plots in frame.
*

*>> ;
*

*>> psres = True
*

*>> maximize_output(wks,psres) ; calls draw and frame for you
*

*>>
*

*>>
*

*>> ;****************************************************************************
*

*>> ; create panel of different components
*

*>>
*

*>> ;****************************************************************************
*

*>> plts = new (4 , "graphic") ; 1d array to hold plots
*

*>>
*

*>> res_at_gsnDraw = False ; (a) do not draw
*

*>> res_at_gsnFrame = False ; (b) do not advance
*

*>> 'frame'
*

*>> res_at_lbLabelBarOn = False ; (c) turn off individual
*

*>> lb's
*

*>>
*

*>> ;************************************************
*

*>> ; create panel: panel plots have their own set of resources
*

*>> ;************************************************
*

*>> resP = True ; modify the panel plot
*

*>> ; resP_at_gsnDebugWriteFileName = True
*

*>> ; resP_at_gsnMaximize = True ; maximize panel area
*

*>> resP_at_gsnPanelRowSpec = True ; specify 1 top, 2 lower
*

*>> level
*

*>> resP_at_gsnPanelLabelBar = True ; add common colorbar
*

*>> resP_at_pmLabelBarWidthF = 0.85 ; make label wider
*

*>> resP_at_lbLabelFontHeightF = 0.015 ; default 0.02 [demo make
*

*>> smaller]
*

*>>
*

*>> res_at_mpMinLatF = 5. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 11.
*

*>> res_at_mpMinLonF = -30.
*

*>> res_at_mpMaxLonF = -20.
*

*>> res_at_gsnLeftString = "Region 1: Atlantic ITCZ"
*

*>> plts(0) = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = -20.
*

*>> res_at_mpMaxLonF = -10.
*

*>> res_at_gsnLeftString = "Region 2: Western Sahel"
*

*>> plts(1) = gsn_csm_contour_map_ce(wks,total_TRMM_R2,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = -10.
*

*>> res_at_mpMaxLonF = 10.
*

*>> res_at_gsnLeftString = "Region 3: Central Sahel"
*

*>> plts(2) = gsn_csm_contour_map_ce(wks,total_TRMM_R3,res)
*

*>> res_at_mpMinLatF = 7. ; range to zoom in on
*

*>> res_at_mpMaxLatF = 18.
*

*>> res_at_mpMinLonF = 10.
*

*>> res_at_mpMaxLonF = 30.
*

*>> res_at_gsnLeftString = "Region 4: Eastern Sahel"
*

*>> plts(3) = gsn_csm_contour_map_ce(wks,total_TRMM_R4,res)
*

*>> resP_at_txString = "Total Precipitation, TRMM (September 2006)"
*

*>> gsn_panel(wks,plts,(/2,2/),resP) ; now draw as one plot
*

*>>
*

*>>
*

*>> On Fri, May 22, 2009 at 11:10 AM, Dennis Shea <shea_at_ucar.edu> wrote:
*

*>>
*

*>> As noted in the documentation
*

*>>>
*

*>>> gsn_panel: "Draws multiple plots of identical size on a single frame."
*

*>>> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_panel.shtml
*

*>>>
*

*>>> Your 4 plots are not "identical size".
*

*>>>
*

*>>> The panel Application page
*

*>>> http://www.ncl.ucar.edu/Applications/panel.shtml
*

*>>>
*

*>>> has two examples (9 and 20) for drawing 'panels' of different sizes.
*

*>>>
*

*>>>
*

*>>>
*

*>>>
*

*>>> Erik Noble wrote:
*

*>>>
*

*>>>> Thank you. That tip worked with zooming/plotting subregions.
*

*>>>>
*

*>>>> I'm getting strange plot I panel-plot the subregions with
*

*>>>> gsn_csm_contour_map_ce command. Specifically the second image overruns
*

*>>>> the 4th image (please see attached). The commands for plotting each
*

*>>>> image in the panel plot are treated the same at the end of the script.
*

*>>>> Is this because I am using gsn_csm_contour_map_ce?
*

*>>>> Should I use a different command?
*

*>>>>
*

*>>>> I tried using the *gsnDebugWriteFileName command***, as NCL web site
*

*>>>> requests,*** to find the bug while this 2nd image on the panel plot. The
*

*>>>> files named "True" were created. I don't see it.** any
*

*>>>> suggestions*.**********
*

*>>>>
*

*>>>> Sincerely,
*

*>>>> -Erik
*

*>>>>
*

*>>>> Script (a little long....but panel commands are at end)
*

*>>>>
*

*>>>>
*

*>>>>
*

*>>>>
*

*>>>>
*

*>>>> On Wed, May 20, 2009 at 3:26 AM, Dennis Shea <shea_at_ucar.edu
*

*>>>> <mailto:shea_at_ucar.edu>> wrote:
*

*>>>>
*

*>>>> See Example 3 at
*

*>>>> http://www.ncl.ucar.edu/Applications/cylineq.shtml
*

*>>>>
*

*>>>> Erik Noble wrote:
*

*>>>> > Dear NCL,
*

*>>>> > Could I have some help with using the gsn_csm_contour_map_ce
*

*>>>> command? I
*

*>>>> > plotted precipitation data from TRMM using the
*

*>>>> gsn_csm_contour_map_ce.
*

*>>>> > It worked for plotting a global plot.(1st image). I tried to plot
*

*>>>>
*

*>>> a
*

*>>>
*

*>>>> > sub-region of the data using the gsnAddCyclic = False
*

*>>>> > AND
*

*>>>> > mpCorner commands. A plot was plottted but the image is so small
*

*>>>> > compared to the rest of the map. (2nd image). How can I just plot
*

*>>>>
*

*>>> the
*

*>>>
*

*>>>> > subregion by itself?
*

*>>>> > Thank you.
*

*>>>> > Sincerely,
*

*>>>> > erik
*

*>>>> >
*

*>>>> > Terminal history:
*

*>>>> >
*

*>>>> > noble:TRMM3B42 enoble$ ncl extract_TRMM_regrid_plot-SOP3.ncl
*

*>>>> > Copyright (C) 1995-2009 - All Rights Reserved
*

*>>>> > University Corporation for Atmospheric Research
*

*>>>> > NCAR Command Language Version 5.1.0
*

*>>>> > The use of this software is governed by a License Agreement.
*

*>>>> > See http://www.ncl.ucar.edu/ for more details.
*

*>>>> > (0)
*

*>>>> > (0) min=0 max=245.562
*

*>>>> >
*

*>>>> >
*

*>>>> > Variable: rain
*

*>>>> > Type: float
*

*>>>> > Total Size: 552960000 bytes
*

*>>>> > 138240000 values
*

*>>>> > Number of Dimensions: 3
*

*>>>> > Dimensions and sizes: [Time | 240] x [Lat | 400] x [Lon | 1440]
*

*>>>> > Coordinates:
*

*>>>> > Number Of Attributes: 3
*

*>>>> > Lon : <ARRAY of 1440 elements>
*

*>>>> > Lat : <ARRAY of 400 elements>
*

*>>>> > _FillValue : -999
*

*>>>> >
*

*>>>> >
*

*>>>> > Variable: rNEW
*

*>>>> > Type: float
*

*>>>> > Total Size: 138240000 bytes
*

*>>>> > 34560000 values
*

*>>>> > Number of Dimensions: 3
*

*>>>> > Dimensions and sizes: [Time | 240] x [lat | 200] x [lon | 720]
*

*>>>> > Coordinates:
*

*>>>> > Time: [1..240]
*

*>>>> > lat: [-49.875..49.625]
*

*>>>> > lon: [-179.875..179.625]
*

*>>>> > Number Of Attributes: 1
*

*>>>> > _FillValue : -999
*

*>>>> > (0)
*

*>>>> > (0) min=0 max=224.236
*

*>>>> > (0)
*

*>>>> > (0) min=0 max=1090.89
*

*>>>> > noble:TRMM3B42 enoble$
*

*>>>> >
*

*>>>> >
*

*>>>> >
*

*>>>> > SCRIPT: Plotting parts are near the end....
*

*>>>> >
*

*>>>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
*

*>>>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
*

*>>>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
*

*>>>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
*

*>>>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
*

*>>>> > setfileoption("bin","ReadByteOrder","BigEndian")
*

*>>>> > nlat = 400;default latitudes in file 0.25 by 0.25 degree
*

*>>>> > nlon = 1440 ;default longitutdes in file 0.25 by 0.25 degree
*

*>>>> > fils = systemfunc("ls *precipitation.bin")
*

*>>>> > nfils = dimsizes(fils)
*

*>>>> > prate = new((/nfils,nlat,nlon/),"float") ; New array for
*

*>>>> rain rate
*

*>>>> >
*

*>>>> > p = new((/nfils,nlat,nlon/),"float") ; New array for
*

*>>>>
*

*>>> rain
*

*>>>
*

*>>>> > do gg = 0,dimsizes(fils)-1 ; Do loop to extract
*

*>>>> variable form
*

*>>>> > binary files
*

*>>>> > prate(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float")
*

*>>>> > p(gg,:,:) = prate(gg,:,:) * 3 ; rain per three hours (mm)
*

*>>>> > end do
*

*>>>> >
*

*>>>> > rain = where(p.lt.0.01 , 0.0, p) ; keep precipitation
*

*>>>> values above
*

*>>>> > zero
*

*>>>> > printMinMax(rain, True)
*

*>>>> >
*

*>>>> > rain!0="Time"
*

*>>>> >
*

*>>>> > ;;;;;;;;;;;;;;;;;;;;Coordinates........What is neccessary to plot
*

*>>>> a map
*

*>>>> > plot?????
*

*>>>> > rain!1="Lat"
*

*>>>> > Lat = ispan(0,nlat-1,1)*0.25 - 49.875 ; From TRMM
*

*>>>> README file
*

*>>>> > Lat_at_units = "degrees_north"
*

*>>>> > rain_at_Lat =Lat
*

*>>>> >
*

*>>>> > rain!2="Lon"
*

*>>>> > Lon = ispan(0,nlon-1,1)*0.25 - 179.875 ; >From TRMM README
*

*>>>> file
*

*>>>> > Lon_at_units = "degrees_east"
*

*>>>> > rain_at_Lon =Lon
*

*>>>> >
*

*>>>> > lat2d = rain(0,:,:)
*

*>>>> > lon2d = rain(0,:,:)
*

*>>>> > lat2d_at_units = "degrees_north"
*

*>>>> > lon2d_at_units = "degrees_east"
*

*>>>> >
*

*>>>> > printVarSummary(rain)
*

*>>>> >
*

*>>>> > ;;;;For regridding function;;;;
*

*>>>> > ylat = Lat
*

*>>>> > xlon = Lon
*

*>>>> > ylat!0 = "Lat"
*

*>>>> > xlon!0 = "Lon"
*

*>>>> > lat2d = new((/400,1440/),float)
*

*>>>> > lon2d = new((/400,1440/),float)
*

*>>>> > lat2d!0 = "Lat"
*

*>>>> > lat2d!1 = "Lon"
*

*>>>> > lon2d!0 = "Lat"
*

*>>>> > lon2d!1 = "Lon"
*

*>>>> > lat2d_at_units = "degrees_north"
*

*>>>> > lon2d_at_units = "degrees_east"
*

*>>>> > ; Just copy the 2d grid coordinates to match the rain array and
*

*>>>>
*

*>>> keep
*

*>>>
*

*>>>> > number of elements consistent.
*

*>>>> > do i=0,399
*

*>>>> > lon2d(i,:) = xlon(:)
*

*>>>> > end do
*

*>>>> > do i=0,1439
*

*>>>> > lat2d(:,i) = ylat(:)
*

*>>>> > end do
*

*>>>> > ;;; Now, we want to regrid the TRMM data to a 0.5 by 0.5 grid.
*

*>>>>
*

*>>> This
*

*>>>
*

*>>>> > means that it we have to divide by half.
*

*>>>> > NLAT = 200
*

*>>>> > NLAT = 200; 400/2
*

*>>>> > MLON = 720
*

*>>>> > MLON = 720; 1440/2
*

*>>>> > lat = ispan(0,NLAT-1,1)*0.50 - 49.875
*

*>>>> > lon = ispan(0,MLON-1,1)*0.50 - 179.875
*

*>>>> > lat!0 = "lat"
*

*>>>> > lat_at_units = "degrees_north"
*

*>>>> > lat&lat = lat
*

*>>>> > lon!0 = "lon"
*

*>>>> > lon_at_units = "degrees_east"
*

*>>>> > lon&lon = lon
*

*>>>> > rNEW = new
*

*>>>> > ((/dimsizes(fils),NLAT,MLON/),typeof(rain),getFillValue(rain))
*

*>>>>
*

*>>> ;New
*

*>>>
*

*>>>> > rain array
*

*>>>> > rNEW!0 = "Time"
*

*>>>> > rNEW&Time = ispan(1,dimsizes(fils),1)
*

*>>>> > rNEW!1 = "lat"
*

*>>>> > rNEW&lat = lat
*

*>>>> > rNEW!2 = "lon"
*

*>>>> > rNEW&lon = lon
*

*>>>> > ;;;;;;;;;;;;;;TRIPLE2GRID;;;;;;;;;;;;;;;
*

*>>>> > do ii = 0,dimsizes(fils)-1
*

*>>>> > rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d),
*

*>>>> > ndtooned( rain(ii,:,:)),lon,lat,False)
*

*>>>> > end do
*

*>>>> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*

*>>>> > printVarSummary(rNEW)
*

*>>>> > printMinMax(rNEW,True)
*

*>>>> > total_rain = dim_sum_Wrap(rNEW(lat|:, lon|:, Time|:) )
*

*>>>> > printMinMax(total_rain,True)
*

*>>>> >
*

*>>>> > ; The next set of commands set up plot properties
*

*>>>> > wks = gsn_open_wks("ps","Test_TRMM")
*

*>>>> > colors = (/"white","black" \ ; {for/back}ground
*

*>>>> > ,"white","azure" \
*

*>>>> > ,"green","palegreen","yellowgreen", "greenyellow" \
*

*>>>> > ,"yellow","goldenrod","orange","orangered" \
*

*>>>> >
*

*>>>> > ,"red","deeppinK","violet","darkviolet","blueviolet","blue"/)
*

*>>>> >
*

*>>>> > gsn_define_colormap(wks, colors)
*

*>>>> > res = True ; plot mods desired
*

*>>>> > ; res_at_gsnMaximize = True ; uncomment to
*

*>>>> maximize size
*

*>>>> > res_at_gsnSpreadColors = True ; use full range of
*

*>>>> colormap
*

*>>>> > res_at_cnFillOn = True ;False ; color plot
*

*>>>> desired
*

*>>>> > res_at_cnLinesOn = False ; turn off contour
*

*>>>>
*

*>>> lines
*

*>>>
*

*>>>> > res_at_cnLineLabelsOn = False ; turn off contour
*

*>>>> labels
*

*>>>> >
*

*>>>> > res_at_cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal]
*

*>>>> cn levels
*

*>>>> > res_at_cnLevels =
*

*>>>> >
*

*>>>>
*

*>>> (/0,50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800/)
*

*>>>
*

*>>>> > res_at_cnFillMode = "AreaFill" ;"RasterFill"
*

*>>>> > res_at_lbOrientation = "Vertical" ; default is
*

*>>>>
*

*>>> horizontal
*

*>>>
*

*>>>> >
*

*>>>> > ; Plot the plots
*

*>>>> > x = gsn_csm_contour_map_ce(wks,total_rain,res)
*

*>>>> > total_TRMM_R1=total_rain({5.0:11.5},{-30.875:-20.875})
*

*>>>> >
*

*>>>> > res_at_gsnAddCyclic = False
*

*>>>> > ;Plot Region 1, from
*

*>>>> rn_R1(it,:,:)=rainw(8,55:67,10:30)-rainw(0,55:67,10:30)
*

*>>>> > res_at_mpLeftCornerLatF = lat2d(55,10)
*

*>>>> > res_at_mpLeftCornerLonF = lon2d(55,10)
*

*>>>> > res_at_mpRightCornerLatF = lat2d(67,30)
*

*>>>> > res_at_mpRightCornerLonF = lon2d(67,30)
*

*>>>> > res_at_gsnLeftString = "Region 1: Atlantic ITCZ"
*

*>>>> > x2 = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)
*

*>>>> >
*

*>>>> >
*

*>>>> >
*

*>>>> >
*

*>>>> >
*

*>>>>
*

*>>>> ------------------------------------------------------------------------
*

*>>>
*

*>>>> >
*

*>>>> >
*

*>>>> >
*

*>>>>
*

*>>>> ------------------------------------------------------------------------
*

*>>>
*

*>>>> >
*

*>>>> > _______________________________________________
*

*>>>> > ncl-talk mailing list
*

*>>>> > List instructions, subscriber options, unsubscribe:
*

*>>>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
*

*>>>> _______________________________________________
*

*>>>> ncl-talk mailing list
*

*>>>> List instructions, subscriber options, unsubscribe:
*

*>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
*

*>>>>
*

*>>>>
*

*>>>>
*

*>>>> ------------------------------------------------------------------------
*

*>>>>
*

*>>>> _______________________________________________
*

*>>> ncl-talk mailing list
*

*>>> List instructions, subscriber options, unsubscribe:
*

*>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
*

*>>>
*

*>>>
*

*>>
*

*>
*

*>
*

*>
*

*
This archive was generated by hypermail 2.2.0
: Tue May 26 2009 - 10:17:16 MDT
*