[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 03:55:14 MDT 2022


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>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220405/d109d312/attachment.html>


More information about the ncl-talk mailing list