[ncl-talk] Plot warnings
Mary Haley
haley at ucar.edu
Wed Jan 18 22:04:30 MST 2017
Ana,
Whenever you get error messages regarding a variable, we always recommend
"looking at your data" by using routines like printVarSummary, printMinMax,
or just print.
The error message is telling you what the problem is:
A valid latitude coordinate array should have a 'units' attribute equal to
one of the following values:
'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N'
'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
so it would be helpful to do a printVarSummary on both lat2 and lon2 to see
if they contain any "units":
printVarSummary(lat2)
printVarSummary(lon2)
My guess is that your "lon2" and "lat2" variables either don't have units
attributes at all, or they are wrong.
Try adding this code right after you read lat2 and lon2 off the file:
lat2 at units = "degrees_north"
lon2 at units = "degrees_east"
Also, it appears the leftmost two dimensions of z1 are dimensioned lon x
lat, and NCL needs them to be lat x lon in order to correctly plot them.
You will need to reorder the data when you call gsn_csm_contour_map. First,
you need to name the other two dimensions, which I'm assuming level and
time dimensions:
z1!2 = "lev"
z2!3 = "time"
Now you can reorder with:
plot= gsn_csm_contour_map(wks,z1(lat|:,lon|:,lev|25,time|0),res)
--Mary
On Wed, Jan 18, 2017 at 5:19 PM, Anahita Amiri Farahani <aamir003 at ucr.edu>
wrote:
> Hello all,
>
> I tried to plot a simple map but I got warnings. Here is my code and
> warnings:
>
>
> ;*********** From Observation **********
>
> ana=addfile("NOaerosol_allsky_3DQ.nc","r")
> lat2=ana->lat
> lon2=ana->lon
> lev2=ana->lev/10
> Absp3D=ana->Absp3D ; Atmospheric heating (K/sec)
> Absp=ana->Absp ; Solar radiation absorption in the atmosphere (W/m^2)
> Sfc=ana->Sfc ; Surface net flux (W/m^2)
>
> delete(ana)
>
> ;********* T's data *************
> ;z1 = asciiread("Absp.dat",(/12,128,64,26/),"float")
> z1 = asciiread("Absp.dat",(/128,64,26,12/),"float")
>
> z1!1="lat"
> z1!0="lon"
> ;Coordinate
> z1&lat=lat2
> z1&lon=lon2
>
>
> wks = gsn_open_wks("eps","T_Atmospheric_heating_26")
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> res = True ; plot mods desired
> res at cnFillOn = True ; turn on color
> res at gsnSpreadColors = True ; use full color map
> res at cnLinesOn = False ; no contour lines
> res at cnLineLabelsOn = False ; no line labels
>
> res at mpMaxLatF = 87.8638 ; specify the plot
> domain
> res at mpMinLatF = -87.8638 ;
>
> res at mpMinLonF = 0 ;
> res at mpMaxLonF = 357.1875
>
> res at gsnAddCyclic = False
>
> res at cnLevelSelectionMode = "AutomaticLevels" ; AutomaticLevels
>
>
> ;res at cnLevelSelectionMode = "ManualLevels" ; AutomaticLevels
> ;res at cnMinLevelValF = -15. ; min level
> ;res at cnMaxLevelValF = 15. ; max level
> ;res at cnLevelSpacingF = 1. ; interval
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> res at tiMainString = "Atmospheric Heating in Jan at 26th level"
>
> plot= gsn_csm_contour_map(wks,z1(:,:,25,0),res)
> delete(wks)
>
>
>
>
>
>
>
>
>
> 0) check_for_y_lat_coord: Warning: Data either does not contain a
> valid latitude coordinate array or doesn't contain one at all.
>
> (0) A valid latitude coordinate array should have a 'units' 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 a valid
> longitude coordinate array or doesn't contain one at all.
>
> (0) A valid longitude coordinate array should have a 'units' 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'
>
> (0) gsn_csm_map_ce: Warning: you set mpMaxLonF to a value > 180, but
>
> (0) didn't set mpCenterLonF. Setting mpCenterLonF to
> 178.594
>
>
>
>
> Thanks,
>
> Ana
>
> _______________________________________________
> 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/20170118/d5478e1c/attachment.html
More information about the ncl-talk
mailing list