[ncl-talk] Why do I get "warning:gsnLeftString is not a valid resource in Plots00-P850_28_00Z_contour at this time"

Zilore Mumba zmumba at gmail.com
Tue Apr 5 13:04:28 MDT 2022


Thanks Adam once more.
I had a look at . NoHeaderFooter =True or NoTitles=True have no effect. I
had a look at $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl. There is
no reference to LeftString, CenterString nor RightString in any of
the subs. Now I understand why they are not recognized as resources.

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Apr 5, 2022 at 8:20 PM Zilore Mumba <zmumba at gmail.com> wrote:

> I will try that. Thanks.
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-2110672127339147988_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Tue, Apr 5, 2022 at 8:07 PM Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Zilore,
>> I believe many if not all of the wrf plotting functions do not use the
>> gsn_csm_* suite of plotting functions, and thus one cannot set subtitles
>> with the gsn*String resources. (Looking at the code for wrf_contour
>> (available in $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl), you can
>> see that gsn_contour is being called.) According to the wrf_contour
>> documentation
>> <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_contour.shtml>,
>> you can set NoHeaderFooter = True to turn off the subtitles, did you try
>> that?  If that does not work, I would suggest you look at the
>> WRFUserARW.ncl code (specifically look at the _SetMainTitle function) to
>> see if you can turn off the labels manually.
>>
>> Hope that helps!
>> Adam
>>
>> On Tue, Apr 5, 2022 at 3:55 AM Zilore Mumba via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> In my wrf plot script below, I am trying to suppress the left, center
>>> and right string as well as the label at the bottom right. None of the wrf
>>> script examples I have seen has these fields suppressed.  My gsn and cn
>>> resources (marked in blue in the code below) do not seem to have any
>>> effect, hence the warning message.
>>> When I print these resources (in purple below) they are captured ok.
>>> Is it that with this kind of plot one cannot suppress these fields?
>>>
>>>
>>> ;   Example script to produce plots for a WRF real-data run,
>>> ;   with the ARW coordinate dynamics option.
>>> ;   Interpolating to specified pressure levels
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>>>
>>> begin
>>> ;
>>> ; The WRF ARW input file.
>>>      DATADir = "/home/zmumba/DA/OUTPUT/2022022800/noda/"
>>>      FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d01* ")
>>>      numFILES = dimsizes(FILES)
>>>
>>>      files_all = addfiles(FILES+".nc","r")
>>>
>>> ; We generate plots, but what kind do we prefer?
>>> ;  type = "x11"
>>> ;  type = "pdf"
>>> ; type = "ps"
>>> ; type = "ncgm"
>>>   type = "png"
>>> ;  wks = gsn_open_wks(type,"plt_PressureLevel1")
>>>
>>> ; Set some Basic Plot options
>>>   res = True
>>>   res at MainTitle                   = "WRF MODEL OUTPUT"
>>>   res at Footer = False
>>>
>>>   res at cnInfoLabelOn = False ; Suppress text "CONTOUR FROM # TO # by #"
>>>   res at gsnCenterString = "" ;"gsnCenterString ~C~ ~Z80~ (Default: None)"
>>>   res at gsnLeftString   = "" ;"gsnRightString ~C~ ~Z80~ (Default:
>>> Long_Name)"
>>>   res at gsnRightString  = "" ;"gsnRightString ~C~ ~Z80~ (Default: Units)"
>>>
>>>   pltres = True
>>>   mpres = True
>>>   mpres at mpFillOn                    = False        ; turn off gray fill
>>>   mpres at mpOutlineBoundarySets       = "National"   ; turn on country
>>> boundaries
>>>   mpres at mpGeophysicalLineColor      = "Navy"       ; color of cont.
>>> outlines
>>>   mpres at mpGeophysicalLineThicknessF = 1.5          ; thickness of
>>> outlines
>>>   mpres at mpNationalLineColor         = "Black"
>>>   mpres at mpNationalLineThicknessF    = 2.5          ; turn on country
>>> boundaries
>>>
>>>   mpres at mpDataBaseVersion           = "MediumRes"  ; choose higher
>>> resolution
>>>   mpres at mpDataSetName               = "Earth..4"   ; choose most recent
>>> boundaries
>>>
>>>   mpres at mpMaxLatF                   = -4           ; choose subregion
>>>   mpres at mpMinLatF                   = -21
>>>   mpres at mpMaxLonF                   =  37
>>>   mpres at mpMinLonF                   =  21
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> ; What times and how many time steps are in the data set?
>>>   times = files_all[:]->Times
>>>   ntimes = dimsizes(times)         ; number of times in the file
>>>
>>> ; The specific pressure levels that we want the data interpolated to.
>>>   pressure_levels = (/ 850., 700., 500., 300./)   ; pressure levels to
>>> plot
>>>   nlevels         = dimsizes(pressure_levels)     ; number of pressure
>>> levels
>>>
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> ;  VTlab = (/ "T+00", T+00", "T+06", "T+12", "T+18", "T+24", "T+30",
>>> "T+36", "T+42", "T+48"/)   ; Validity for file name
>>>
>>> ; get time information and strip out the day and hour
>>>   times_in_file = files_all[:]->Times
>>>   dims = dimsizes (times)
>>>    ntimes = dimsizes (times(:,0))
>>>
>>>   times_to_use = new(dims(0),string)
>>>
>>>   do i=0,dims(0)-1
>>>     times_to_use(i) = chartostring(times_in_file(i,8:12))
>>>   end do
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>   do it = 0,ntimes(0)-1,2             ; TIME LOOP
>>>
>>>     print("Working on time: " +  times_to_use(it) )
>>>     res at TimeLabel =  times_to_use(it)   ; Set Valid time to use on plots
>>>
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> ; First get the variables we will need
>>>
>>>     tc = wrf_user_getvar(files_all,"tc",it)        ; T in C
>>>     u  = wrf_user_getvar(files_all,"ua",it)        ; u averaged to mass
>>> points
>>>     v  = wrf_user_getvar(files_all,"va",it)        ; v averaged to mass
>>> points
>>>     p  = wrf_user_getvar(files_all, "pressure",it) ; pressure is our
>>> vertical coordinate
>>>     z  = wrf_user_getvar(files_all, "z",it)        ; grid point height
>>>     rh = wrf_user_getvar(files_all,"rh",it)        ; relative humidity
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>     do level = 0,nlevels-1                 ; LOOP OVER LEVELS
>>>       pressure = pressure_levels(level)
>>>
>>>       tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False)
>>>       z_plane  = wrf_user_intrp3d( z,p,"h",pressure,0.,False)
>>>       rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False)
>>>       u_plane  = wrf_user_intrp3d( u,p,"h",pressure,0.,False)
>>>       v_plane  = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
>>>
>>>       spd     = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec
>>>       spd at description = "Wind Speed"
>>>       spd at units = "m/s"
>>>       u_plane = u_plane*1.94386     ; kts
>>>       v_plane = v_plane*1.94386     ; kts
>>>       u_plane at units = "kts"
>>>       v_plane at units = "kts"
>>>
>>>       wks = gsn_open_wks(type,"Plots00-" + "P" + pressure_levels(level)
>>> + "_" + times_to_use(it) + "Z")
>>>
>>>       ; Plotting options for T
>>>         opts = res
>>>         print(opts))
>>>
>>>         opts at cnLineColor = "Red"
>>>         opts at ContourParameters = (/ 5.0 /)
>>>         opts at cnInfoLabelOrthogonalPosF = 0.07  ; offset second label
>>> information
>>>         opts at gsnContourLineThicknessesScale = 2.0
>>>         contour_tc = wrf_contour(files_all[it],wks,tc_plane,opts)
>>>         delete(opts)
>>>
>>>        ; MAKE PLOT
>>>         if ( pressure .eq. 850 ) then   ; plot temp, rh, height, wind
>>> barbs
>>>           opts_z at ContourParameters = (/ 20.0 /)
>>>           contour_height = wrf_contour(files_all[it],wks,z_plane,opts_z)
>>>           plot =
>>> wrf_map_overlays(files_all[it],wks,(/contour_rh,contour_tc,contour_height, \
>>>                                     vector/),pltres,mpres)
>>>         end if
>>>
>>>     end do      ; END OF LEVEL LOOP
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>   end do        ; END OF TIME LOOP
>>> end
>>>
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
>>> www.avast.com
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>> <#m_-2110672127339147988_m_-2063917176174049324_m_-1170957471822237576_m_6353160373876870093_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220405/c139f9f2/attachment.html>


More information about the ncl-talk mailing list