<div dir="ltr"><div class="gmail_default" style="font-size:small">Liang,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The error is telling you that NCL can't find any lat/lon information associated with your data, so it doesn't know where to put your data on the map.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing a dump of your NetCDF file. It shows that you have two-dimensional lat/lon coordinates:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> float longitude ( y, x )</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> standard_name : longitude</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> long_name : longitude</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> units : degrees_east</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> _CoordinateAxisType : Lon</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> float latitude ( y, x )</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> standard_name : latitude</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> long_name : latitude</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> units : degrees_north</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"> _CoordinateAxisType : Lat</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)">In order to correctly plot these, you need to attach them as "lat2d" and "lon2d" attributes to your data variable:</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)">Instead of this:</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)" face="monospace, monospace"><div style="line-height:13.52px">temp = f->air_temperature (0,:,:)</div><div style="line-height:13.52px">lon = f->longitude (:,:)</div><div style="line-height:13.52px">lat = f->latitude (:,:)</div><div style="line-height:13.52px">timebnds = f->time_bnds</div></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)">Do this:</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)"><br></font></div><div style="line-height:13.52px"><font color="#000000" style="background-color:rgb(255,255,255)" face="monospace, monospace"><div style="line-height:13.52px">temp = f->air_temperature (0,:,:)</div><div style="line-height:13.52px">temp@lon2d = f->longitude ; Note, the "(:,:)" is not needed</div><div style="line-height:13.52px">temp@lat2d = f->latitude</div><div style="line-height:13.52px">timebnds = f->time_bnds</div></font></div></div><div class="gmail_extra"><span style="background-color:rgb(255,255,255)"><br></span></div><div class="gmail_extra"><span style="background-color:rgb(255,255,255)"><br></span></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,255)">If your data is not global, then you may also need this:</span></div><div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,255)"><br></span></div><div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,255)"><font face="monospace, monospace"> res@gsnAddCyclic = False ; don't add a longitude cyclic point</font></span></div><div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,255)"><br></span></div><div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,255)"></span></div><div class="gmail_default" style="font-size:small">I did notice that you have these two lines commented out:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div style="font-family:Verdana;line-height:13.52px"><font color="#0000ff">;res@sfXArray = lon</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#0000ff">;res@sfYArray = lat</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000">This is a second way that you can provide the lat/lon information to the plotting routine. I usually prefer the "lat2d/lon2d" attribute method, because gsnAddCyclic only works with this method.</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000">I will try to come up with a "generic" page on contouring, to better explain these various methods.</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#000000">--Mary</font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#0000ff"><br></font></div><div style="font-family:Verdana;line-height:13.52px"><font color="#0000ff"><br></font></div></div><br><div class="gmail_quote">On Mon, Oct 26, 2015 at 8:26 AM, wh.lakes.2015 <span dir="ltr"><<a href="mailto:wh.lakes.2015@gmail.com" target="_blank">wh.lakes.2015@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><u></u>
<div style="line-height:1.3;border-width:0px;margin:12px" marginheight="0" marginwidth="0">
<div><font color="#000000" size="3" face="宋体"></font> </div>
<div> </div>
<div><font size="2" face="Verdana">
<hr>
</font></div>
<div><font size="2" face="Verdana"><strong>发件人:</strong>Si ZH
<<a href="mailto:wh.lakes.2015@gmail.com" target="_blank">wh.lakes.2015@gmail.com</a>></font></div>
<div><font size="2" face="Verdana"><strong>发送时间:</strong>2015-10-25 16:36</font></div>
<div><font size="2" face="Verdana"><strong>主题:</strong>about "check_for_y_lat_coord
and valid latitude coordinate array"</font></div>
<div><font size="2" face="Verdana"><strong>收件人:</strong>"ncl-talk"<<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></font></div>
<div><font size="2" face="Verdana"><strong>抄送:</strong></font></div>
<div><font size="2" face="Verdana"></font> </div>
<div><font size="2" face="Verdana">
<div dir="ltr">Hi there,
<div><br></div>
<div>I am a new learner of UCL and was blocked at the gate of .nc file "read in"
step. I use "ncl_filedump" and can see the dimensions and variables in my .nc
file, but I don't know how to read those dimensions and variables correctly in
NCL,</div>
<div><br></div>
<div>NCL version I am using is 6.3.0, the contents of "<a href="http://myfile.nc" target="_blank">myfile.nc</a>" like below:</div>
<div><br></div>
<div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">$
ncl_filedump <a href="http://myfile.nc" target="_blank">myfile.nc</a></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"> Copyright (C) 1995-2015 - All Rights Reserved</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"> University Corporation for Atmospheric Research</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"> NCAR
Command Language Version 6.3.0</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"> The
use of this software is governed by a License Agreement.</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more
details.</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"><br></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">Variable:
f</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">Type:
file</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">filename:
myfile</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">path:
<a href="http://myfile.nc" target="_blank">myfile.nc</a></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
file global attributes:</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
CDI : Climate Data Interface version 1.6.1 (<a href="http://code.zmaw.de/projects/cdi" target="_blank">http://code.zmaw.de/projects/cdi</a>)</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
Conventions : CF-1.5</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
history : Thu Jan 22 19:25:20 2015: cdo sub <a href="http://SM_MAM.zhyaa.pm.03236.206912-209911.nc" target="_blank">SM_MAM.zhyaa.pm.03236.206912-209911.nc</a>
<a href="http://SM_MAM.zhyaa.03236.198012-201011.nc" target="_blank">SM_MAM.zhyaa.03236.198012-201011.nc</a>
<a href="http://zhyaa.MAM.mean.diff.2080.03236.nc" target="_blank">zhyaa.MAM.mean.diff.2080.03236.nc</a></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">Thu Jan 15
16:48:56 2015: cdo -timmean -selmon,3,4,5 <a href="http://zhyaa.03236.monthly.198012-201011.nc" target="_blank">zhyaa.03236.monthly.198012-201011.nc</a>
<a href="http://SM_MAM.zhyaa.03236.198012-201011.nc" target="_blank">SM_MAM.zhyaa.03236.198012-201011.nc</a></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">Converted
from PP by cf-python v0.9.8.3</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
source : UM</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
runid : zhyaa</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
stash_code : 3236</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
lbproc : 0</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
submodel : 1</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
CDO : Climate Data Operators version 1.6.1 (<a href="http://code.zmaw.de/projects/cdo" target="_blank">http://code.zmaw.de/projects/cdo</a>)</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
dimensions:</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
x = 134</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
y = 102</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
time = 1 // unlimited</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
nb2 = 2</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
variables:</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
float longitude ( y, x )</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
standard_name :
longitude</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
long_name : longitude</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
units :
degrees_east</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
_CoordinateAxisType : Lon</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"><br></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
float latitude ( y, x )</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
standard_name :
latitude</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
long_name : latitude</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
units :
degrees_north</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
_CoordinateAxisType : Lat</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"><br></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
double time ( time )</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
standard_name :
time</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
bounds : time_bnds</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
units : days since
1950-12-01 00:00:00</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
calendar : 360_day</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"><br></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
double time_bnds ( time, nb2 )</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
units : days since
1950-12-01 00:00:00</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
calendar : 360_day</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000"><br></font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
float air_temperature ( time, y, x )</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
standard_name :
air_temperature</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
long_name : TEMPERATURE AT
1.5M</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
units : K</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
coordinates : longitude latitude</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
_FillValue : -1.073742e+09</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
missing_value :
-1.073742e+09</font></div>
<div><font style="background-color:rgb(217,234,211)" color="#000000">
cell_methods : time: mean</font></div></div>
<div><br></div>
<div><br></div>
<div>My NCL scripts I wrote like below:</div>
<div><br></div>
<div><br></div>
<div>
<div><font color="#0000ff">load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</font></div>
<div><font color="#0000ff">load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">begin</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;;;read in temp data</font></div>
<div><font color="#0000ff">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">f = addfile("<a href="http://myfile.nc" target="_blank">myfile.nc</a>","r")</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">temp = f->air_temperature (0,:,:)</font></div>
<div><font color="#0000ff">lon = f->longitude (:,:)</font></div>
<div><font color="#0000ff">lat = f->latitude (:,:)</font></div>
<div><font color="#0000ff">timebnds = f->time_bnds</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;temp!0 = "time"</font></div>
<div><font color="#0000ff">;temp!1 = "y"</font></div>
<div><font color="#0000ff">;temp!2 = "x"</font></div>
<div><font color="#0000ff"> </font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"> ; temp&y@units = "degrees_north"</font></div>
<div><font color="#0000ff"> ;temp&x@units = "degrees_east"</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;temp = temp - 273.15</font></div>
<div><font color="#0000ff">lon = lon-180</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">temp@units = "(C)"</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">wks = gsn_open_wks("x11", "myfile")</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">wks@wkWidth = 6400</font></div>
<div><font color="#0000ff">wks@wkHeight = 4000</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">res = True
;Indicate you want to set some
resources.</font></div>
<div><font color="#0000ff">res@cnFillOn = True ; Turn
on contour line fill.</font></div>
<div><font color="#0000ff">;res@cnLinesOn = False ; no
contour lines. </font></div>
<div><font color="#0000ff">res@cnLevelSpacingF = 0.5 ;
contour spacing.</font></div>
<div><font color="#0000ff">res@gsnSpreadColors = True
; full colors</font></div>
<div><font color="#0000ff">res@cnLineLabelsOn = False ;
turn off line label.</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">res@cnMonoFillColor = False
; Use multiple colors.</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;res@mpMinLatF = 40</font></div>
<div><font color="#0000ff">;res@mpMaxLatF = 50</font></div>
<div><font color="#0000ff">;res@mpMinLonF = -92.5</font></div>
<div><font color="#0000ff">;res@mpMaxLonF = -75.5</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">res@pmLabelBarDisplayMode = "Always"</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">res@pmLabelBarOrthogonalPosF = 0.08</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;res@tiXAxisString =
lon@long_name</font></div>
<div><font color="#0000ff">;res@tiYAxisString =
lat@long_name</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;res@sfXArray =
lon</font></div>
<div><font color="#0000ff">;res@sfYArray =
lat</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">;res@lbAutoLabelStride = True</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">plot = gsn_csm_contour_map (wks,temp,res)</font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff">end</font><br></div></div>
<div><br></div>
<div><br></div>
<div>and NCL error message like below:</div>
<div><br></div>
<div><br></div>
<div>
<div><span style="background-color:rgb(0,255,255)">(0)
check_for_y_lat_coord: Warning: Data either does not contain a valid latitude
coordinate array or doesn't contain one at all.</span></div>
<div><span style="background-color:rgb(0,255,255)">(0) A valid
latitude coordinate array should have a 'units' attribute equal to one of the
following values:</span></div>
<div><span style="background-color:rgb(0,255,255)">(0)
'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg
north'</span></div>
<div><span style="background-color:rgb(0,255,255)">(0)
check_for_lon_coord: Warning: Data either does not contain a valid longitude
coordinate array or doesn't contain one at all.</span></div>
<div><span style="background-color:rgb(0,255,255)">(0) A valid
longitude coordinate array should have a 'units' attribute equal to one of the
following values:</span></div>
<div><span style="background-color:rgb(0,255,255)">(0)
'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E'
'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'</span></div></div>
<div><br></div>
<div><br></div>
<div>The data in "<a href="http://myfile.nc" target="_blank">myfile.nc</a>" are North American
Great Lakes area temperature contour data (the large boundary is middle and East
of US and Canada, and I have narrowed the map latitude and longitude to Great
Lakes area, but the results looks nothing about my data, it looks like all over
the world or East Asian area, it is why I used lon = lon - 180). My object is to
figure out Great lakes Area temperature contour.</div>
<div><br></div>
<div>I think my error is like NCL message said (I didn't read in correct
dimensions and coordinates), but I can't 100% understand "<a href="http://myfile.nc" target="_blank">myfile.nc</a>" via NCL mini manuals, and don't know how
to write tha correct scripts that can read in "<a href="http://myfile.nc" target="_blank">myfile.nc</a>" (with dimensions: y, x, time and
time_bnd)</div>
<div><br></div>
<div>I attach "<a href="http://myfile.nc" target="_blank">myfile.nc</a>" inside the attachment,
hope you can help this,</div>
<div><br></div>
<div>Thank you,</div>
<div><br></div>
<div>Liang Zhang</div>
<div><br></div>
<div><br></div>
<div> </div>
<div><br></div></div></font></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>