[ncl-talk] How can I plot one WRF variable at a given time and given level?
zilore mumba
zmumba at yahoo.com
Mon Mar 11 05:27:44 MDT 2019
Hello,
All the script samples I use for WRF output plot several fields in a loop. I would like to plot just one variable at any given time step and a given level.
With my script below, my T is T(T,L,L,L), i.e. T(Time,Level, Lat,Lon)=T(17,31,60,69).
When I run the code below I get a plot, but alos the error:
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
(0) check_for_y_lat_coord: Warning: Data either does not contain
(0) a valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units'
(0) 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
(0) a valid longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units'
(0) 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'
I have seen a number of posts on ncl-talk on this error, but I do not understand the solutions given.
When I put the following code after addfile
[code]; lat = f->XLAT ; get lat from the file
lon = f->XLONG ; get lon from the file
t!0 = "time" ; dimension 0 for t is time
dimension 1 for t is level
t!2 = "lat" ; dimension 2 for t is lat
t!3 = "lon" ; dimension 3 for t is lon
t2 at units = "degrees_north"
t2 at units = "degrees_east"
[/code]
I get the error:
fatal:Variable (t) has (2) dimensions can not write to dimension (2)
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 16 in file contplot1.ncl
My main code is below.
In addition I get titles which I do not know where they come from ("perturbation potential temperature ()" above the figure, and "contour from -6 to 24 by 2" below)
I hope someone can assist me.
Zilore Mumba
[code]
begin
f= addfile("/home/zmumba/Rwanda_Radar_Proj/Training_Materials/Data/wrfout_d01_2017-04-18_00:00:00.nc", "r")
t = f->T(0,0,:,:)
wks = gsn_open_wks("png","firstcontplot")
res = True
res at tiMainString = "NCL plot in 5 steps"
res at mpFillOn = False ; turn off gray fill
res at mpOutlineBoundarySets = "National" ; turn on country boundaries
; res at mpGeophysicalLineColor = "Navy" ; color of cont. outlines
; res at mpGeophysicalLineThicknessF = 1.5 ; thickness of outlines
; res at mpNationalLineColor = "Black"
res at mpNationalLineThicknessF = 2.5 ; turn on country boundaries
res at mpDataBaseVersion = "MediumRes" ; choose higher resolution
res at mpDataSetName = "Earth..4" ; choose most recent boundaries
res at mpMaxLatF = -8 ; choose a subregion
res at mpMinLatF = -18
res at mpMaxLonF = 34
res at mpMinLonF = 21
plot = gsn_csm_contour_map(wks, t, res)
end
[/code]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190311/abce8c95/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firstcontplot.png
Type: image/png
Size: 67733 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190311/abce8c95/attachment.png>
More information about the ncl-talk
mailing list