[ncl-talk] empty plots in panel-plot

Noelia otero noeli1680 at gmail.com
Tue Apr 11 10:21:23 MDT 2017


Hi,

Many thanks both for the suggestions, that really helps.

Best,

Noelia

2017-04-11 17:53 GMT+02:00 Dennis Shea <shea at ucar.edu>:

> mnmxlvl = nice_mnmxintvl(min(data),max(data),16,False)
>
> Is a nice function, in particular for normally distributed data.
>
> An alternative for non-normally distributed data  is to use:
>
> https://www.ncl.ucar.edu/Document/Functions/Contributed/
> stat_dispersion.shtml
>
>   opt = True
>  ;opt at PrintStat = True
>   statd = *stat_dispersion*(data, opt )
>
>   res at cnLevelSelectionMode      = "ManualLevels"
>
>                                                     ; arbitrary
>   res at cnMinLevelValF            = statd(5)          ; lower sextile
>   res at cnMaxLevelValF            = statd(11)         ; upper sextile
>   res at cnLevelSpacingF           = ...whatever...
>
>
> https://www.ncl.ucar.edu/Applications/ESMF.shtml
> Example 35
>
> By looking at the output from stat_dispersion, one could manually set
> contour levels that maximize the
> information. The data are clusterd at the 'low' end but have significantly
> larger values which are not artificial.
>
>     res at cnLevelSelectionMode  = "ExplicitLevels"
>     res at cnLevels              = (/0.001, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.125, 0.150\
>                                  ,0.200, 0.250,  0.50, 1, 5, 10, 15, 20,  25, 50 /)
>
>
>
>
> On Tue, Apr 11, 2017 at 7:48 AM, Mary Haley <haley at ucar.edu> wrote:
>
>> I usually end up increasing the levels too, simply by taking the
>> "spacing" value and dividing it by a number, like 2 or 3 (for 2x or 3x as
>> many contours).
>>
>>   res at cnLevelSelectionMode      = "ManualLevels"
>>   res at cnMinLevelValF            = mnmxlvl(0)
>>   res at cnMaxLevelValF            = mnmxlvl(1)
>>   res at cnLevelSpacingF           = mnmxlvl(2) / 2.    ; make the contour
>> interval smaller for more contours
>>
>> On Tue, Apr 11, 2017 at 1:43 AM, Noelia otero <noeli1680 at gmail.com>
>> wrote:
>>
>>> Hi Mary,
>>>
>>> Thanks a lot. I was trying to set min and max values, but I wasn't
>>> taking a good value for levelSpacing ..,I follow your suggestion, although
>>> I had to increase considerably the number of levels. Now it seems to work.
>>>
>>> Many thanks again,
>>>
>>> Best
>>>
>>> Noelia
>>>
>>> 2017-04-11 7:47 GMT+02:00 Mary Haley <haley at ucar.edu>:
>>>
>>>> Dear Noelia,
>>>>
>>>> When you are paneling a series of color contour plots and then paneling
>>>> them later, you first want to be sure you use a fixed set of contour levels
>>>> across all the plots, so you can then use a single labelbar in the final
>>>> panel plot.
>>>>
>>>> The function nice_mnmxintvl
>>>> ​ is what you can use to fix your contour levels
>>>>
>>>>>>>> mnmxlvl = nice_mnmxintvl(min(data),max(data),16,False)
>>>>
>>>>   res at cnLevelSelectionMode      = "ManualLevels"
>>>>   res at cnMinLevelValF            = mnmxlvl(0)
>>>>   res at cnMaxLevelValF            = mnmxlvl(1)
>>>>   res at cnLevelSpacingF           = mnmxlvl(2)
>>>>
>>>> You will need to get the min and max of your data across all plots, and pass that to​
>>>>
>>>> The "min(data)" and "max(data)" are from another example. You will need
>>>> to plug in the min/max of your own data across all plots.
>>>>
>>>> You now want to turn off the individual labelbar you're getting for
>>>> each plot:
>>>>
>>>>   res at lbLabelBarOn    = False
>>>>
>>>> and then turn on the panel labelbar when you call gsn_panel:
>>>>
>>>> pres = True
>>>> pres at gsnPanelLabelBar = True
>>>> ...
>>>> gsn_panel(...)
>>>>
>>>> You may want to see our "panel" examples page:
>>>>
>>>> http://www.ncl.ucar.edu/Applications/panel.shtml
>>>>
>>>> I think panel_35.ncl uses the nice_mnmxintvl function.
>>>>
>>>> --Mary
>>>>
>>>> On Mon, Apr 10, 2017 at 11:37 AM, Noelia otero <noeli1680 at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> I am plotting in a panel plots seasonal means from different models,
>>>>> and I got some "empty" plots for some specific models and seasons. My guess
>>>>> is that it is due to the large spread of values (or some outliers). Maybe,
>>>>> it's a simple question..but I don't know how to set the resources to get a
>>>>> good label bar. I attach the final plot that I got with my code (see a part
>>>>> of the code below):
>>>>>
>>>>> ; i= model ,s =season
>>>>>
>>>>>      model = addfile(fils(i), "r")
>>>>>      c=str_split(fils(i), "/")
>>>>>      nmod=str_split(c(6), "#")
>>>>>      mmod=nmod(0)
>>>>>      print(nmod)
>>>>>      sfile=systemfunc("ls " + dir2 + mmod +"*"+ season(s)+".nc")
>>>>>      smodel=addfile(sfile, "r")
>>>>>
>>>>>       svar  = smodel ->$var$
>>>>>       svar!1="lat"
>>>>>       svar!2="lon"
>>>>>
>>>>> ;------Getting statistics for each grid point-------
>>>>>
>>>>>     stats_seas_var = new((/nlat,mlon/), typeof(svar),-9e+33)
>>>>>
>>>>> ;-------get 95th possition 25 of statistics---------
>>>>>
>>>>>
>>>>>     opt=False
>>>>>     do nl=0,nlat-1
>>>>>       do ml=0,mlon-1
>>>>>
>>>>>          seas_st_var = stat_dispersion( svar(:,nl,ml), opt)
>>>>>          stats_seas_var(nl,ml) = seas_st_var(0)
>>>>>
>>>>>          ;stat_dispersion: (0) mean, (1) std, (2), min, (14),max
>>>>>       end do
>>>>>    end do
>>>>>
>>>>>
>>>>>    stats_seas_var at long_name = "mean"
>>>>>    stats_seas_var!0="lat"
>>>>>    stats_seas_var!1="lon"
>>>>>    stats_seas_var&lat = lat
>>>>>    stats_seas_var&lon = lon
>>>>>
>>>>>     res = True
>>>>>     res at gsnMaximize = True
>>>>>     res at cnFillOn = True
>>>>>     res at cnLinesOn = False
>>>>>     res at gsnAddCyclic = False
>>>>>     res at gsnDraw = False
>>>>>     res at gsnFrame = False
>>>>>     res at mpMinLonF = min(lon)
>>>>>     res at mpMinLatF = min(lat)
>>>>>     res at mpMaxLonF = max(lon)
>>>>>     res at mpMaxLatF = max(lat)
>>>>>     res at lbLabelAutoStride=True
>>>>>     res at cnLevelSelectionMode = "ManualLevels"
>>>>>     res at cnMinLevelValF       = 0.
>>>>>     res at cnMaxLevelValF       = 10.
>>>>>     res at cnLevelSpacingF      =   5.
>>>>>     res at lbLabelBarOn = False
>>>>>     res at gsnCenterString =nmod(0)
>>>>>     res at gsnRightString =season(s)
>>>>>     plotseas = gsn_csm_contour_map(wks,stats_seas_var,res)
>>>>>
>>>>> I really appreciate any suggestion to improve it,
>>>>>
>>>>> Many thanks in advance,
>>>>>
>>>>> Noelia
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> 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/20170411/18cebc41/attachment.html 


More information about the ncl-talk mailing list