Re: Errors: wrf_map_overlay: and fatal:ContourPlotPreDraw

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 28 2010 - 08:12:31 MST

On Jan 26, 2010, at 3:46 PM, Gerald Creager wrote:

> I'm looking at documentation now to see what I need to do, but it
> appears it's to simply change the name to wrf_map_overlays...
> except doing that yielded an error.
>

Hi Gerry,

[I see you have another question posted, so maybe answering this one
is a moot point...]

I didn't see in your code where you called wrf_map_overlays, or did
you rename it back to wrf_map_overlay?

The two functions are actually quite different. wrf_map_overlay wants
the map object to be passed, while wrf_map_overlays wants the file
pointer passed. wrf_map_overlays creates the map for you, based on
parameters set in the file.

What was the full error message?

Also, I've seen problems with just passing "True" to the wrf_xxxx
functions. To be safe, create a variable, like "mres = True", and
pass this to wrf_map_overlays.

--Mary

> On the second error, I tried up-sizing the wsMaximumSize to
> 40000000 but that didn't help much. Am I missing an update or
> similar command?
>
> Note that the WRF filesize is on the order of 1.5GB.
>
> The NCL script in question is attached.
>
> Thanks, Gerry
> --
> Gerry Creager -- gerry.creager@tamu.edu
> Texas Mesonet -- AATLT, Texas A&M University
> Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.862.3983
> Office: 1700 Research Parkway Ste 160, TAMU, College Station, TX 77843
> ;### 20091001 gc
> ;### TAMU_SFC_sst.ncl
> ;### plot SSTs, wind, pressure...
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>
> begin
>
> ; Requires dataTime = 00z, 06z, 12z or 18z
> ; Requires initDate for plt name
> ; pltRoot = "Refract_"+ initDate + "T" + dataTime
> pltRoot = "Refract-test"
>
> it=0
> ; pltName = pltRoot + "."+ sprinti("%0.2i", it) ; create name
>
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
> ; DATADir = "/jobs/wrfuser/wrf/runs/SCOOP12km/wrfprd/" + dataTime
> +"/" + initDate + "/"
> ;print (DATADir)
>
> ; FILES = systemfunc("ls " + DATADir + "wrfout_d01_*00")
> ; numFILES = dimsizes(FILES)
> ; a = addfiles(FILES+".nc","r")
>
> DATADir = "/data/gerry/wind2/output/"
> FILES = systemfunc("ls " + DATADir + "wrfout_d03_*00")
> numFILES = dimsizes(FILES)
> a = addfiles(FILES+".nc","r")
>
> ;
> ; Moved the next lines up here to try to get it to not overwrite
> the ps and pdf stuff.
> ; We generate plots, but what kind do we prefer?
> ; type = "x11"
> type = "pdf"
> ; type = "ps"
> ; type = "ncgm"
> ; type = "png"
> wks = gsn_open_wks(type,pltRoot)
>
> setvalues NhlGetWorkspaceObjectId()
> "wsMaximumSize" : 40000000
> end setvalues
> ; What times and how many time steps are in this data set?
> ; times = wrf_user_list_times(a) ; get times in the file
> Times = a[:]->Times
> times = wrf_times_c(Times,3)
> ntimes = dimsizes(times) ; number of times in the file
> ; Set some Basic Plot options
> ARWres = True
> ARWres@MainTitle = "WRF 12km Atlantic Basin: Surface level
> refractivity index"
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> do ifil = 0, numFILES-2,3 ; BIG FILES LOOP
> print("Working on FILE: " +FILES(ifil) )
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ; do it = 0,ntimes-1,1 ; TIME LOOP
> it = 0
> ; Bodily insert the MMM WRF_SURFACE1 script here
>
> ; Example script to produce plots for a WRF real-data run,
> ; with the ARW coordinate dynamics option.
>
> print("Working on time: " + times(ifil) )
> ARWres@TimeLabel = times(ifil) ; Set Valid time to use on plots
>
> mpres = True ; Create map background
> mpres@mpFillOn = False
> mpres@mpFillColors = (/-1, -1, 8, -1/)
> mpres@mpFillDrawOrder = "postdraw"
> ;###
> gsnPaperOrientation = "landscape"
> lbOrientation = "vertical"
> mpres@gsnMaximize = True
> ;###
> map = wrf_map(wks,a[ifil],mpres)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; First get the variables we will need
>
> slp = wrf_user_getvar(a[ifil],"slp",0) ; slp
> wrf_smooth_2d( slp, 3 ) ; smooth slp
> if ( it .eq. 0 ) then
> ; tc = wrf_user_getvar(a[ifil],"tc",0) ; 3D tc
> ; sst = wrf_user_getvar(a[ifil],"SST",0) ; SST
> ; sst=sst-273.16 ; SST2 in C
> ; td = wrf_user_getvar(a[ifil],"td",0) ; 3D td
> u = wrf_user_getvar(a[ifil],"ua",0) ; 3D U at mass points
> v = wrf_user_getvar(a[ifil],"va",0) ; 3D V at mass points
> ; tc2 = tc(0,:,:) ; Use lowest T at time zero
> ; sst2 = sst(0,:,:)
> ; td2 = td(0,:,:) ; Use lowest Td at time zero
> u10 = u(0,:,:) ; Use lowest level at time 0
> v10 = v(0,:,:)
> tc2 = wrf_user_getvar(a[ifil],"T2",0) ; T2 in Kelvin
> else
> ; sst = wrf_user_getvar(a[ifil],"SST",0) ; SST
> ; sst2 = wrf_user_getvar(a[ifil],"SST",0) ;sst2 in K
> ; tc2=a->T2
> tc2 = wrf_user_getvar(a[ifil],"T2",0) ; T2 in Kelvin
> ; sst=sst-273.16 ; SST2 in C
> ;/print(sst)
> ; tc2 = tc2-273.16 ; T2 in C
> ; td2 = wrf_user_getvar(a[ifil],"td2",0) ; Td2 in C
> u10 = wrf_user_getvar(a[ifil],"U10",0) ; u at 10 m, mass point
> v10 = wrf_user_getvar(a[ifil],"V10",0) ; v at 10 m, mass point
> end if
>
> ; tf2 = 1.8*tc2+32. ; Turn temperature into
> Fahrenheit
> ; tf2@description = "Surface Temperature"
> ; tf2@units = "F"
> ; sst@description = "Sea Surface Temperature"
> ; sst@units = "C"
>
> ; td_f = 1.8*td2+32. ; Turn temperature into
> Fahrenheit
> ; td_f@description = "Surface Dew Point Temp"
> ; td_f@units = "F"
> u10 = u10*1.94386 ; Turn wind into knots
> v10 = v10*1.94386
> u10@units = "kts"
> v10@units = "kts"
> tc2@units = "K"
>
> e = 10^((10.79574 * (1-273.16/tc2) - (5.02800 * log10(tc2/273.16))
> + (1.50475 * 10^(-4)* (1 - 10^(-8.2969*(tc2/273.16 - 1)))) +
> ( 0.42873 * 10^(-3) ) * (10^(4.76955 * (1-273.16/tc2))-1)+.78614))
>
> RI = (77.6 * (slp/tc2))+(3.73*(10^5)^(e/tc2^2))
> RI@description = "Refractivity index"
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ; Plotting options for T
> opts = ARWres
> opts@cnFillOn = True
> opts@ContourParameters = (/ 260., 300., 1./)
> ; opts@gsnSpreadColorEnd = -3 ; End third from the last color
> in color map
> opts@gsnSpreadColorEnd = -2 ; End third from the last color
> in color map
> contour_RI = wrf_contour(a[ifil],wks,RI,opts)
> delete(opts)
> delete(RI) ;because we're running outta memory!
>
> ; Plotting options for Td
> ; opts = ARWres
> ; opts@cnFillOn = True
> ; opts@cnLinesOn = True
> ; opts@cnLineLabelsOn = True
> ; opts@ContourParameters = (/ -20., 90., 5./)
> ; opts@cnLineLabelBackgroundColor = -1
> ; opts@gsnSpreadColorEnd = -3 ; End third from the last color
> in color map
> ; contour_td = wrf_contour(a[ifil],wks,td_f,opts)
> ; delete(opts)
> ; delete(td_f)
>
> ; Plotting options for SLP
> ; opts = ARWres
> ; opts@cnLineColor = "NavyBlue"
> ; opts@cnHighLabelsOn = True
> ; opts@cnLowLabelsOn = True
> ; opts@ContourParameters = (/ 960., 1040., 4. /)
> ; opts@cnLineLabelBackgroundColor = -1
> ; opts@gsnContourLineThicknessesScale = 2.0
> ; contour_psl = wrf_contour(a[ifil],wks,slp,opts)
> ; delete(opts)
> ; delete(slp)
>
> ; Plotting options for Wind Vectors
> opts = ARWres
> opts@FieldTitle = "Wind" ; overwrite Field Title
> opts@NumVectors = 47 ; density of wind barbs
> opts@vcGlyphStyle = "CurlyVector"
> vector = wrf_vector(a[ifil],wks,u10,v10,opts)
> delete(opts)
> delete(u10)
> delete(v10)
>
> ; Maximize plot
> ; psres = True
> ; maximize_output(wks,psres)
> ; MAKE PLOTS
> wrf_map_overlay(wks,map,(/contour_RI,vector/),True)
> ; wrf_map_overlay(wks,map,(/contour_td,vector/),True)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; delete(wks)
> ; end do ; end of the time loop
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> end do ; END IF BIG FILE LOOP
>
> end
> _______________________________________________
> 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
Received on Thu Jan 28 08:12:52 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 01 2010 - 08:05:34 MST