[ncl-talk] Error while handling multiple WRF output files

swati shewale shewaleswati16 at gmail.com
Tue Oct 10 22:09:06 MDT 2017


Thanks a lot Mary. I will surely go through it.

On Tue, Oct 10, 2017 at 10:01 PM, Mary Haley <haley at ucar.edu> wrote:

> The issue is that your left plots have a title on the Y axis, while your
> middle and right plots do not. gsn_panel assumes all plots are the same
> size, and uses the first plot in the list to determine the scale factor for
> all the rest. Since the left plots are different in size, the scale factor
> applied to these plots ends up being different than the scale factor
> applied to the right plots.
>
> The key here is to set the special gsnPanelScalePlotIndex to the index of
> one of the middle plots, so it uses one of these for the scaling factor.
> Your middle plots are indexes 1, 3, or 5, so:
>
> pres at gsnPanelScalePlotIndex = 1   ; base resizing on plot1 (middle plot)
>
> I've added dummy data to your gsn_function_try.ncl script, and cleaned it
> up for you. I had to leave a little bit of a margin on the left side of the
> panels, so the Y axis strings didn't get cut off.
>
> If you don't want all that space between the X axis of each plot, you can
> set the gsnPanelTop / gsnPanelBottom resources as desired to squish them
> together. I also set the gsnPanelYWhiteSpacePercent to 0 to force them
> closer.
>
> See attached.
>
> -Mary
>
>
> On Tue, Oct 10, 2017 at 4:49 AM, swati shewale <shewaleswati16 at gmail.com>
> wrote:
>
>> Dear Mary,
>> I followed your dummy script and plotted my dataset. It worked, now
>> facing the issue of size of the plot (third vertical column). Please find
>> the attachment and tell me suggestions for the same. Thanks a lot for your
>> dummy script.
>>
>> On Tue, Oct 10, 2017 at 12:45 PM, swati shewale <shewaleswati16 at gmail.com
>> > wrote:
>>
>>> I think I can change the position of title itself....it resolves the
>>> issue....I will try to write the script that way
>>>
>>> On Tue, Oct 10, 2017 at 11:53 AM, swati shewale <
>>> shewaleswati16 at gmail.com> wrote:
>>>
>>>> vertical scale for WUCM and NOUCM is common (single)
>>>>
>>>> On Tue, Oct 10, 2017 at 11:51 AM, swati shewale <
>>>> shewaleswati16 at gmail.com> wrote:
>>>>
>>>>> I am sorry raw idea about plot is correct....but mistaken about giving
>>>>> title....please neglect title
>>>>> it should be as
>>>>>
>>>>>
>>>>>    title --->                      13aug          14aug
>>>>> 15aug
>>>>>
>>>>>  WUCM                         plot0             plot1
>>>>> plot2                 vertical scale for WUCM and NOUCM    vertical scale
>>>>> for WUCM-NOUCM
>>>>>  NOUCM                        plot3             plot4
>>>>> plot5
>>>>>  (WUCM - NOUCM)         plot6             plot7              plot8
>>>>>
>>>>>
>>>>> WUCM, NOUCM and (WUCM - NOUCM) is left axis string....title and string
>>>>> I can provide....about scale doubtful as well as arranging plots from top
>>>>> to bottom
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Oct 10, 2017 at 11:44 AM, swati shewale <
>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> I understood gsn_panel(wks,(/plot0,plot1,pl
>>>>>> ot2,plot3,plot4,plot5/),(/2,3/),pres) will give 3 plot in one row
>>>>>> and another 3 plot in second row as follows
>>>>>>
>>>>>> plot0    plot1    plot2
>>>>>> plot3    plot4    plot5
>>>>>>
>>>>>> but below resources
>>>>>>
>>>>>> pres at gsnPanelLeft       = 0.
>>>>>> pres at gsnPanelRight      = 2./3
>>>>>>
>>>>>>  tells arrange plot as
>>>>>>
>>>>>> plot0 plot1
>>>>>> plot2 plot3
>>>>>> plot4 plot4
>>>>>>
>>>>>> so using which resource should I replace it
>>>>>> Also tell me about scale, that I want in extreme right
>>>>>>
>>>>>> let me give you raw idea
>>>>>>
>>>>>> WUCM = 3 plot (1st row =plot0, plot1, plot2)
>>>>>> NOWUCM = 3 plot (1st row =plot3, plot4, plot5)
>>>>>> WUCM-NOUCM = 3 plot (1st row =plot6, plot7, plot8)
>>>>>>
>>>>>>
>>>>>> title --->      WUCM         NOUCM       (WUCM-NOUCM)
>>>>>>
>>>>>>                    plot0             plot1              plot2
>>>>>>                   vertical scale for WUCM and NOUCM    vertical scale for
>>>>>> WUCM-NOUCM
>>>>>>                    plot3             plot4              plot5
>>>>>>                    plot6             plot7              plot8
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 10, 2017 at 11:29 AM, swati shewale <
>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>
>>>>>>> but as We have mentioned that put first  6 plot in left side (
>>>>>>> pres at gsnPanelLeft       = 0.
>>>>>>>   pres at gsnPanelRight      = 2./3)....so even if we write
>>>>>>> gsn_panel(wks,(/plot0,plot1,plot2,plot3,plot4,plot5/),(/2,3/),pres)
>>>>>>>  as per my knowledge, it will arrange as follows
>>>>>>>
>>>>>>> plot0  plot1
>>>>>>> plot2  plot3
>>>>>>> plot4  plot5
>>>>>>>
>>>>>>> On Mon, Oct 9, 2017 at 11:41 PM, Mary Haley <haley at ucar.edu> wrote:
>>>>>>>
>>>>>>>> There's no resource that changes the ordering of the plots.
>>>>>>>>
>>>>>>>> To change the ordering of the plots, you simply need to rearrange
>>>>>>>> them in the call to gsn_panel.
>>>>>>>>
>>>>>>>> In order words, which ever plot you want in the upper left corner
>>>>>>>> is the one that should be first listed in the call to gsn_panel:
>>>>>>>>
>>>>>>>> gsn_panel(wks,(/plot0,plot1,plot2,plot3,plot4,plot5/),(/2,3/),pres)
>>>>>>>>
>>>>>>>> Right now, it's ordered:
>>>>>>>>
>>>>>>>>    plot0    plot1    plot2
>>>>>>>>    plot3    plot4    plot5
>>>>>>>>
>>>>>>>> If you want:
>>>>>>>>
>>>>>>>>    plot3    plot4    plot5
>>>>>>>>    plot0    plot1    plot2
>>>>>>>>
>>>>>>>>
>>>>>>>> then use:
>>>>>>>>
>>>>>>>> gsn_panel(wks,(/plot3,plot4,plot5,plot0,plot1,plot2/),(/2,3/),pres)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --Mary
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Oct 9, 2017 at 7:10 AM, swati shewale <
>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> above attached plot is just to show the scale (rightmost) and left
>>>>>>>>> side titles that I want. I know the resource for left side is tiYAxisString
>>>>>>>>> / tiXAxisString. but unable to make plotting from top to bottom
>>>>>>>>>
>>>>>>>>> On Mon, Oct 9, 2017 at 6:25 PM, swati shewale <
>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Dear Mary,
>>>>>>>>>>
>>>>>>>>>> The resources that you set in your demo script like left and
>>>>>>>>>> right space for panel (first panel of six plot vertically and another panel
>>>>>>>>>> of three plot vertically) as below
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ;---Define space for leftmost column of plots, and their labelbar
>>>>>>>>>> width
>>>>>>>>>>   pres at gsnPanelLeft       = 0.
>>>>>>>>>>   pres at gsnPanelRight      = 2./3
>>>>>>>>>>   pres at pmLabelBarWidthF   = 0.6
>>>>>>>>>>   gsn_panel(wks,(/plot1,plot2,plot3,plot4,plot5,plot6/),(/3,2/
>>>>>>>>>> ),pres)
>>>>>>>>>>
>>>>>>>>>> ;---Define space for righmost column of plots, and their labelbar
>>>>>>>>>> width
>>>>>>>>>>   delta = 0.028
>>>>>>>>>>   pres at gsnPanelLeft       = pres at gsnPanelRight - delta   ; Left
>>>>>>>>>> plots don't stretch all the way to
>>>>>>>>>>
>>>>>>>>>>                     ; 2/3, so move right plots a little to left.
>>>>>>>>>>   pres at gsnPanelRight      = 1.0 - delta
>>>>>>>>>>   pres at pmLabelBarWidthF   = pres at pmLabelBarWidthF * 0.5  ; half
>>>>>>>>>> the width of other labelbar
>>>>>>>>>>   gsn_panel(wks,(/plot7,plot8,plot9/),(/3,1/),pres)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> If I wish to do plots from top to bottom instead of left to
>>>>>>>>>> right, along with both scales vertical (which should have position to the
>>>>>>>>>> extreme right).
>>>>>>>>>> I just did change in your script as follow
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ;---Set some panel resources common to both sets of plots
>>>>>>>>>>   pres                    = True
>>>>>>>>>>  pres at txFontHeightF = .010
>>>>>>>>>>   pres at txString                   = "
>>>>>>>>>> WUCM
>>>>>>>>>> NOUCM                                     WUCM - NOUCM"
>>>>>>>>>>   pres at gsnPanelLabelBar   = True
>>>>>>>>>>   pres at gsnMaximize        = True
>>>>>>>>>>   pres at pmLabelBarHeightF  = 0.08
>>>>>>>>>>   pres at lbLabelFontHeightF = 0.01
>>>>>>>>>>   pres at gsnFrame           = False    ; Needed for paneling two
>>>>>>>>>> sets of plots on same frame.
>>>>>>>>>>   pres at gsnPanelYWhiteSpacePercent = 4
>>>>>>>>>>   pres at gsnPanelXWhiteSpacePercent = 4
>>>>>>>>>>   pres at gsnPanelBoxes = True      ; debugging tool
>>>>>>>>>>
>>>>>>>>>> ;---Define space for leftmost column of plots, and their labelbar
>>>>>>>>>> width
>>>>>>>>>>   pres at gsnPanelTop       = 0.
>>>>>>>>>>   pres at gsnPanelBottom      = 2./3
>>>>>>>>>>   pres at pmLabelBarWidthF   = 0.6
>>>>>>>>>>   gsn_panel(wks,(/plot0,plot1,plot2,plot3,plot4,plot5/),(/2,3/
>>>>>>>>>> ),pres)
>>>>>>>>>>
>>>>>>>>>> ;---Define space for righmost column of plots, and their labelbar
>>>>>>>>>> width
>>>>>>>>>>   delta = 0.005
>>>>>>>>>>   pres at gsnPanelTop      = pres at gsnPanelBottom - delta   ; Left
>>>>>>>>>> plots don't stretch all the way to
>>>>>>>>>>
>>>>>>>>>>                      ; 2/3, so move right plots a little to left.
>>>>>>>>>>   pres at gsnPanelBottom      = 1.0 - delta
>>>>>>>>>>   pres at pmLabelBarWidthF   = pres at pmLabelBarWidthF * 0.5  ; half
>>>>>>>>>> the width of other labelbar
>>>>>>>>>>   gsn_panel(wks,(/plot6,plot7,plot8/),(/3,1/),pres)
>>>>>>>>>>
>>>>>>>>>>   txres               = True
>>>>>>>>>>   txres at txFontHeightF = 0.02
>>>>>>>>>>   gsn_text_ndc(wks,"Temperature at 2m (degC) over Patna
>>>>>>>>>> city",0.5,0.92,txres)
>>>>>>>>>>
>>>>>>>>>> gives me error as
>>>>>>>>>>
>>>>>>>>>> (0)    Warning: gsn_panel: attribute gsnPanelTop must be > 0.0
>>>>>>>>>> and <= 1.0
>>>>>>>>>> (0)    Defaulting to 1.
>>>>>>>>>> (0)    Warning: gsn_panel: font height (0.01) of main string is
>>>>>>>>>> too large to fit in space provided. Either decrease font size or set
>>>>>>>>>> gsnPanelTop.
>>>>>>>>>> (0)    Warning: gsn_panel: font height (0.02) of main string is
>>>>>>>>>> too large to fit in space provided. Either decrease font size or set
>>>>>>>>>> gsnPanelTop.
>>>>>>>>>> (0)    Error: gsn_panel: attribute gsnPanelTop (0.661667) must be
>>>>>>>>>> greater
>>>>>>>>>> (0)    than gsnPanelBottom (0.995).
>>>>>>>>>>
>>>>>>>>>> Also Please tell me, how should I fix scale vertically that to
>>>>>>>>>> extreme right.  Actually I want plot from top to bottom because I want to
>>>>>>>>>> provide resources at left side (for example purpose attached a plot).
>>>>>>>>>>
>>>>>>>>>> I have model runs two types ....named WUCM and NOUCM
>>>>>>>>>> I want it like......first row  contain 3 plot (WUCM)
>>>>>>>>>>                        second row contain 3 plot (NOWUCM)
>>>>>>>>>> above two rows have same scale
>>>>>>>>>>                        third row contain 3 plot of above
>>>>>>>>>> difference (WUCM - NOWUCM)
>>>>>>>>>> this one have different scale (as it is difference between WUCM -
>>>>>>>>>> WUCM)
>>>>>>>>>>
>>>>>>>>>> I hope, I tried better to convey things I want.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Oct 9, 2017 at 11:30 AM, swati shewale <
>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Thanks a lot Mary for giving detail info along with demo script.
>>>>>>>>>>> I have mentioned special lat2d/lon2d attributes in gsn script
>>>>>>>>>>> (named convention in my a script is lat/lon). Anyway I will go through the
>>>>>>>>>>> script and link. Thanks again.
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Oct 7, 2017 at 12:46 AM, Mary Haley <haley at ucar.edu>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks for providing clean scripts and explanations.
>>>>>>>>>>>>
>>>>>>>>>>>> 1. This warning is because when you use gsn_csm_contour_map to
>>>>>>>>>>>> plot curvilinear data, you must associate the lat/lon arrays with the data
>>>>>>>>>>>> being plotted. Otherwise, it does't know where on the map the data is
>>>>>>>>>>>> supposed to go.
>>>>>>>>>>>>
>>>>>>>>>>>> If you looked at the wrf_gsn_1.ncl and wrf_gsn_2.ncl scripts,
>>>>>>>>>>>> you'll see they are both using special lat2d/lon2d attributes to accomplish
>>>>>>>>>>>> this:
>>>>>>>>>>>>
>>>>>>>>>>>>   hgt       = wrf_user_getvar(a,"HGT",it)    ; Terrain elevation
>>>>>>>>>>>>   hgt at lat2d = wrf_user_getvar(a,"XLAT",it)   ;
>>>>>>>>>>>> latitude/longitude
>>>>>>>>>>>>   hgt at lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for
>>>>>>>>>>>> plotting
>>>>>>>>>>>>
>>>>>>>>>>>> However, you would have to do this for every variable you plot.
>>>>>>>>>>>>
>>>>>>>>>>>> Instead, you can set these two resources before any calls to
>>>>>>>>>>>> gsn_csm_contour_map:
>>>>>>>>>>>>
>>>>>>>>>>>> res at sfXArray = lon
>>>>>>>>>>>> res at sfYArray = lat
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ​2. ​
>>>>>>>>>>>> I think the issue with cnConstFEnableFill
>>>>>>>>>>>> ​ is that you are setting that resource *after* plots #0-5 have
>>>>>>>>>>>> been created.  You need to make sure this line:
>>>>>>>>>>>>
>>>>>>>>>>>>     res at cnConstFEnableFill= True ; allow constant values
>>>>>>>>>>>> (1=sig) to fill
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ​is *before* all of your gsn_csm_contour_map calls.
>>>>>>>>>>>>
>>>>>>>>>>>> ​3. In order to panel two sets of plots on the same page, you
>>>>>>>>>>>> first need to set:
>>>>>>>>>>>>
>>>>>>>>>>>> pnlres at gsnFrame = False
>>>>>>>>>>>>
>>>>>>>>>>>> so that the frame doesn't get advanced after each one. You will
>>>>>>>>>>>> then need to advance the frame yourself when done:
>>>>>>>>>>>>
>>>>>>>>>>>> frame(wks)
>>>>>>>>>>>>
>>>>>>>>>>>> The other issue with paneling two sets of plots, is that you
>>>>>>>>>>>> need to make sure they don't get drawn on top of each other. There are many
>>>>>>>>>>>> examples on our "Panels
>>>>>>>>>>>> <http://www.ncl.ucar.edu/Applications/panel.shtml>" example
>>>>>>>>>>>> page that show how to do various configurations of plots and labelbars.
>>>>>>>>>>>> Here are some that might help:
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.ncl.ucar.edu/Applications/panel.shtml#ex12
>>>>>>>>>>>> http://www.ncl.ucar.edu/Applications/panel.shtml#ex22
>>>>>>>>>>>>
>>>>>>>>>>>> The important thing is that you need to set gsnPanelRight /
>>>>>>>>>>>> gsnPanelLeft to control which part of the frame each set of plots is drawn
>>>>>>>>>>>> in.  Since the first set is 3 x 2 plots and the second set is 3 x 1 plots,
>>>>>>>>>>>> this means the 3 x 2 plots should take up 2/3 of the width, and the 3 x 1
>>>>>>>>>>>> plots will take up 1/3 of the width.
>>>>>>>>>>>>
>>>>>>>>>>>> See attached script which uses dummy data.
>>>>>>>>>>>>
>>>>>>>>>>>> --Mary
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Fri, Oct 6, 2017 at 2:04 AM, swati shewale <
>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello Mary,
>>>>>>>>>>>>>
>>>>>>>>>>>>> As per your suggestion I went through the links provided by
>>>>>>>>>>>>> you. I will explain one by one the issues I came across while doing plot
>>>>>>>>>>>>> using inbuilt wrf function as well as gsn function separately. I have
>>>>>>>>>>>>> attached scripts along with plot. the kind of titles (as well as left and
>>>>>>>>>>>>> side string), I want is reflected in gsn plot which am unable to do in wrf
>>>>>>>>>>>>> plot. I have given suitable names to scripts as well as plot for your
>>>>>>>>>>>>> convenience. Hope you wont get confuse.
>>>>>>>>>>>>>
>>>>>>>>>>>>> In first script (1_plot_using_wrf_function)
>>>>>>>>>>>>> 1. after mentioning re at cnConstFEnableFill  = True, getting
>>>>>>>>>>>>> warning as
>>>>>>>>>>>>> warning:ContourPlotInitialize: scalar field is constant; no
>>>>>>>>>>>>> contour lines will appear; use cnConstFEnableFill to enable fill
>>>>>>>>>>>>>
>>>>>>>>>>>>> actually using wrf in built function gives nice plot but
>>>>>>>>>>>>> unable to make self explanatory (giving strings and titles) plot so thought
>>>>>>>>>>>>> of ploting using gsn function
>>>>>>>>>>>>>
>>>>>>>>>>>>> In second script (2_plot_using_gsn_function), issues are
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. even after mentioning lat/lon getting warning as follow
>>>>>>>>>>>>> (0)    check_for_y_lat_coord: Warning: Data either does not
>>>>>>>>>>>>> contain a valid latitude coordinate array or doesn't contain one at all.
>>>>>>>>>>>>> (0)    A valid latitude coordinate array should have a 'units'
>>>>>>>>>>>>> attribute equal to one of the following values:
>>>>>>>>>>>>> (0)        'degrees_north' 'degrees-north' 'degree_north'
>>>>>>>>>>>>> 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN'
>>>>>>>>>>>>> 'deg north'
>>>>>>>>>>>>> (0)    check_for_lon_coord: Warning: Data either does not
>>>>>>>>>>>>> contain a valid longitude coordinate array or doesn't contain one at all.
>>>>>>>>>>>>> (0)    A valid longitude coordinate array should have a
>>>>>>>>>>>>> 'units' attribute equal to one of the following values:
>>>>>>>>>>>>> (0)        'degrees_east' 'degrees-east' 'degree_east'
>>>>>>>>>>>>> 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE'
>>>>>>>>>>>>> 'deg east'
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2. after mentioning re at cnConstFEnableFill  = True, getting
>>>>>>>>>>>>> warning as
>>>>>>>>>>>>> warning:ContourPlotInitialize: scalar field is constant; no
>>>>>>>>>>>>> contour lines will appear; use cnConstFEnableFill to enable fill
>>>>>>>>>>>>>
>>>>>>>>>>>>> 3. I want all 9 plots on single panel with scales vertical,
>>>>>>>>>>>>> instead I am getting it on two different pages
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think, I have to manage or add more resources in pres1/pres2
>>>>>>>>>>>>> such as (*vpXF
>>>>>>>>>>>>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/vp.shtml#vpXF>*
>>>>>>>>>>>>> and *vpYF
>>>>>>>>>>>>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/vp.shtml#vpYF>*)
>>>>>>>>>>>>> (*vpHeightF
>>>>>>>>>>>>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/vp.shtml#vpHeightF>*
>>>>>>>>>>>>> and *vpWidthF
>>>>>>>>>>>>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/vp.shtml#vpWidthF>*)
>>>>>>>>>>>>> , so that I may get 9 plots on single panel. If you know any link which
>>>>>>>>>>>>> resembles like the plot i want,Please let me know. side by I will again go
>>>>>>>>>>>>> through links given by you.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Sep 23, 2017 at 9:30 AM, swati shewale <
>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thank you so much Mary....surely I will go through the link
>>>>>>>>>>>>>> provided by you....If come across any problem, will let you know
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Sep 23, 2017 at 12:36 AM, Mary Haley <haley at ucar.edu>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Please see this page:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.ncl.ucar.edu/Applications/wrfgsn.shtml
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> and look at the first example (wrf_gsn_1.ncl and
>>>>>>>>>>>>>>> wrf_nogsn_1.ncl) and the second example (wrf_gsn_2.ncl).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> These show how to use gsn to plot data and it compares the
>>>>>>>>>>>>>>> plot with using WRF functions.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> In the wrf_gsn_1.ncl plot, you can see that the
>>>>>>>>>>>>>>> gsnLeft/RightString resources are being set automatically, because the data
>>>>>>>>>>>>>>> has a description and units attribute.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Try this script as a start on your own data, and also look
>>>>>>>>>>>>>>> at wrf_gsn_2.ncl to see how to further customize your plot.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> If you are unable to get the plot to look as nice as you
>>>>>>>>>>>>>>> want, email ncl-talk at ucar.edu again with your new script
>>>>>>>>>>>>>>> and what you want it to look like, and we can help further.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Good luck,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --Mary
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Fri, Sep 22, 2017 at 3:21 AM, swati shewale <
>>>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thank you Mary... its wrf file, I just renamed it for my
>>>>>>>>>>>>>>>> convenience. Actually I am able to plot it using wrf function but unable to
>>>>>>>>>>>>>>>> put left/right/centre strings, as those are related to gsn functions. so to
>>>>>>>>>>>>>>>> overcome the difficulty of left/right/centre, I thought to make a plot
>>>>>>>>>>>>>>>> using gsn functions injstead of wrf functions. but inbuilt wrf functions
>>>>>>>>>>>>>>>> gives nicer plots than gsn one.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Fri, Sep 22, 2017 at 3:48 AM, Mary Haley <haley at ucar.edu
>>>>>>>>>>>>>>>> > wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> It's hard for somebody to simply look at a script to see
>>>>>>>>>>>>>>>>> if it's correct or not.  I do see some errors, but even if I correct the
>>>>>>>>>>>>>>>>> errors, I can't be sure it's 100% correct without having access to your
>>>>>>>>>>>>>>>>> data.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The problems are:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Your data file is called "patna_data.nc". You are using
>>>>>>>>>>>>>>>>> wrf_xxxx functions to plot this data. Since WRF-ARW output files are
>>>>>>>>>>>>>>>>> normally called something like "wrfout_d02_2005-08-29_00:00:00",
>>>>>>>>>>>>>>>>> I can't be sure that you are actually plotting WRF-ARW data. You can only
>>>>>>>>>>>>>>>>> use wrf_xxx plotting functions on WRF-ARW data.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> You have:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  t   = a->T2(0:7,:,:)
>>>>>>>>>>>>>>>>>  ter = dim_avg_n( ter1, 0 )
>>>>>>>>>>>>>>>>>  ter = ter - 273
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I don't know what your objective, so I don't know if the
>>>>>>>>>>>>>>>>> above is correct.  However, you are calling "dim_avg_n" on "ter1" which
>>>>>>>>>>>>>>>>> doesn't exist.  Did you mean:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  ter = dim_avg_n( t, 0 )
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The above will take an average of the first 8 times teps
>>>>>>>>>>>>>>>>> of your data, assuming that the leftmost dimension of T2 represents time.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Further, you should use the _Wrap version of this
>>>>>>>>>>>>>>>>> function, so metadata is maintained:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  ter = dim_avg_n_Wrap( t, 0 )
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> You have:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ter = ter - 273
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Since you are changing the units, you should update the
>>>>>>>>>>>>>>>>> "units" attribute to something like this:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ter at units = "degC"
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The rest of the script looks okay, but again, the
>>>>>>>>>>>>>>>>> wrf_contour and wrf_map_overlays procedures will only work if you are
>>>>>>>>>>>>>>>>> actually plotting WRF-ARW data.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> --Mary
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Thu, Sep 7, 2017 at 10:02 PM, swati shewale <
>>>>>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Thank you. I will try with your script. yesterday I tried
>>>>>>>>>>>>>>>>>> it with below script. Please have a look and let me know, whether it is
>>>>>>>>>>>>>>>>>> correct or not.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Fri, Sep 8, 2017 at 12:54 AM, Mary Haley <
>>>>>>>>>>>>>>>>>> haley at ucar.edu> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> If I understand you correctly, then you need to reshape
>>>>>>>>>>>>>>>>>>> your X array so that it is NTIM x 8 x NLAT x NLON, and then you can average
>>>>>>>>>>>>>>>>>>> across the second dimension from the left.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I've attached a modified version of your script, which
>>>>>>>>>>>>>>>>>>> is UNTESTED. You may need to modify it to do the right thing with regard to
>>>>>>>>>>>>>>>>>>> copying over the required metadata.  I did this a little with copy_VarAtts,
>>>>>>>>>>>>>>>>>>> and copy_coords.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> --Mary
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Thu, Sep 7, 2017 at 3:42 AM, swati shewale <
>>>>>>>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hiii,
>>>>>>>>>>>>>>>>>>>> using ncrcat I have single file containing 24 time step
>>>>>>>>>>>>>>>>>>>> (3hrly, 3 days). Now I want to plot temperature variable (average for each
>>>>>>>>>>>>>>>>>>>> day, spatial, panel plot). I am unable to take out time step for 1st day
>>>>>>>>>>>>>>>>>>>> (0:7) and then do average of it...then second day (8:15) ...likewise for
>>>>>>>>>>>>>>>>>>>> third day (16:23). I wrote a script, in that it takes average over all time
>>>>>>>>>>>>>>>>>>>> steps. what changes should I make so that I can get average over specific
>>>>>>>>>>>>>>>>>>>> time step? attached herewith script.
>>>>>>>>>>>>>>>>>>>> summary of variable temperature is as follow.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Variable: X
>>>>>>>>>>>>>>>>>>>> Type: float
>>>>>>>>>>>>>>>>>>>> Total Size: 5658552 bytes
>>>>>>>>>>>>>>>>>>>>             1414638 values
>>>>>>>>>>>>>>>>>>>> Number of Dimensions: 3
>>>>>>>>>>>>>>>>>>>> Dimensions and sizes:    [Time | 23] x [south_north |
>>>>>>>>>>>>>>>>>>>> 201] x [west_east | 306]
>>>>>>>>>>>>>>>>>>>> Coordinates:
>>>>>>>>>>>>>>>>>>>> Number Of Attributes: 6
>>>>>>>>>>>>>>>>>>>>   FieldType :    104
>>>>>>>>>>>>>>>>>>>>   MemoryOrder :    XY
>>>>>>>>>>>>>>>>>>>>   description :    TEMP at 2 M
>>>>>>>>>>>>>>>>>>>>   units :    K
>>>>>>>>>>>>>>>>>>>>   stagger :
>>>>>>>>>>>>>>>>>>>>   coordinates :    XLONG XLAT XTIME
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On Thu, Sep 7, 2017 at 3:04 PM, swati shewale <
>>>>>>>>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Thank you. I will try with it.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On Wed, Sep 6, 2017 at 8:39 PM, Mary Haley <
>>>>>>>>>>>>>>>>>>>>> haley at ucar.edu> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> The error message is telling you that there's
>>>>>>>>>>>>>>>>>>>>>> something wrong with argument 0 passed to wrf_contour.  Argument 0 refers
>>>>>>>>>>>>>>>>>>>>>> to the first argument in the list, which is "a(itime)" in this case.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> The issue is that when you use addfiles to open a
>>>>>>>>>>>>>>>>>>>>>> series of files, you need to use square brackets, [], to access a single
>>>>>>>>>>>>>>>>>>>>>> file, and not curved brackets, (). This is because addfiles returns a
>>>>>>>>>>>>>>>>>>>>>> "List" object, and lists in NCL need to be access with square brackets.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> You have:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>         contour = wrf_contour(a(itime),wks,t,t_res)
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> and this should be:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>         contour = wrf_contour(a[itime],wks,t,t_res)
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> --Mary
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> On Mon, Sep 4, 2017 at 4:40 AM, swati shewale <
>>>>>>>>>>>>>>>>>>>>>> shewaleswati16 at gmail.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Hiiii
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> I want to do panel plotting using WRF output. I have
>>>>>>>>>>>>>>>>>>>>>>> total 8 files, each contains single time step (one day, 3 hrly datafiles so
>>>>>>>>>>>>>>>>>>>>>>> total 8 files). out of eight times I want to plot 6 time step (panel plot)
>>>>>>>>>>>>>>>>>>>>>>> for variable slp and temperature.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> It shows below error.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> fatal:Argument type mismatch on argument (0) of
>>>>>>>>>>>>>>>>>>>>>>> (wrf_contour) can not coerce
>>>>>>>>>>>>>>>>>>>>>>> fatal:["Execute.c":8567]:Execute: Error occurred at
>>>>>>>>>>>>>>>>>>>>>>> or near line 44 in file temp.ncl
>>>>>>>>>>>>>>>>>>>>>>> (0)    Error: gsn_panel: all of the plots passed to
>>>>>>>>>>>>>>>>>>>>>>> gsn_panel appear to be invalid
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>  Attached herewith script.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Thank you in advance. Any help will be appreciated
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>>>>>>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>>>>>>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>>>>>>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171011/fd613c08/attachment.html>


More information about the ncl-talk mailing list