[ncl-talk] about "check_for_y_lat_coord and valid latitude coordinate array"

wh.lakes.2015 wh.lakes.2015 at gmail.com
Mon Oct 26 08:26:22 MDT 2015






发件人:Si ZH <wh.lakes.2015 at gmail.com>
发送时间:2015-10-25 16:36
主题:about "check_for_y_lat_coord and valid latitude coordinate array"
收件人:"ncl-talk"<ncl-talk at ucar.edu>
抄送:

Hi there,


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,


NCL version I am using is 6.3.0, the contents of "myfile.nc" like below:


$ ncl_filedump myfile.nc
 Copyright (C) 1995-2015 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.3.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.


Variable: f
Type: file
filename:       myfile
path:   myfile.nc
   file global attributes:
      CDI : Climate Data Interface version 1.6.1 (http://code.zmaw.de/projects/cdi)
      Conventions : CF-1.5
      history : Thu Jan 22 19:25:20 2015: cdo sub SM_MAM.zhyaa.pm.03236.206912-209911.nc SM_MAM.zhyaa.03236.198012-201011.nc zhyaa.MAM.mean.diff.2080.03236.nc
Thu Jan 15 16:48:56 2015: cdo -timmean -selmon,3,4,5 zhyaa.03236.monthly.198012-201011.nc SM_MAM.zhyaa.03236.198012-201011.nc
Converted from PP by cf-python v0.9.8.3
      source : UM
      runid : zhyaa
      stash_code : 3236
      lbproc : 0
      submodel : 1
      CDO : Climate Data Operators version 1.6.1 (http://code.zmaw.de/projects/cdo)
   dimensions:
      x = 134
      y = 102
      time = 1  // unlimited
      nb2 = 2
   variables:
      float longitude ( y, x )
         standard_name :        longitude
         long_name :    longitude
         units :        degrees_east
         _CoordinateAxisType :  Lon


      float latitude ( y, x )
         standard_name :        latitude
         long_name :    latitude
         units :        degrees_north
         _CoordinateAxisType :  Lat


      double time ( time )
         standard_name :        time
         bounds :       time_bnds
         units :        days since 1950-12-01 00:00:00
         calendar :     360_day


      double time_bnds ( time, nb2 )
         units :        days since 1950-12-01 00:00:00
         calendar :     360_day


      float air_temperature ( time, y, x )
         standard_name :        air_temperature
         long_name :    TEMPERATURE AT 1.5M
         units :        K
         coordinates :  longitude latitude
         _FillValue :   -1.073742e+09
         missing_value :        -1.073742e+09
         cell_methods : time: mean




My NCL scripts I wrote like below:




load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"


begin


;;;read in temp data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


f = addfile("myfile.nc","r")


temp = f->air_temperature (0,:,:)
lon  = f->longitude (:,:)
lat  = f->latitude (:,:)
timebnds = f->time_bnds


;temp!0 = "time"
;temp!1 = "y"
;temp!2 = "x"
  


 ; temp&y at units = "degrees_north"
  ;temp&x at units = "degrees_east"


;temp = temp - 273.15
lon = lon-180


temp at units = "(C)"


wks = gsn_open_wks("x11", "myfile")


wks at wkWidth = 6400
wks at wkHeight = 4000


res = True                      ;Indicate you want to set some resources.
res at cnFillOn = True         ; Turn on contour line fill.
;res at cnLinesOn = False       ; no contour lines.       
res at cnLevelSpacingF = 0.5        ; contour spacing.
res at gsnSpreadColors = True            ; full colors
res at cnLineLabelsOn      = False   ; turn off line label.


res at cnMonoFillColor       = False    ; Use multiple colors.




;res at mpMinLatF = 40
;res at mpMaxLatF = 50
;res at mpMinLonF = -92.5
;res at mpMaxLonF = -75.5




res at pmLabelBarDisplayMode = "Always"


res at pmLabelBarOrthogonalPosF =  0.08


;res at tiXAxisString    = lon at long_name
;res at tiYAxisString    = lat at long_name


;res at sfXArray         = lon
;res at sfYArray         = lat




;res at lbAutoLabelStride = True


plot = gsn_csm_contour_map (wks,temp,res)




end





and NCL error message like below:




(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'




The data in "myfile.nc" 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.


I think my error is like NCL message said (I didn't read in correct dimensions and coordinates), but I can't 100% understand "myfile.nc" via NCL mini manuals, and don't know how to write tha correct scripts that can read in "myfile.nc" (with dimensions: y, x, time and time_bnd)


I attach "myfile.nc" inside the attachment, hope you can help this,


Thank you,


Liang Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151026/3229b33e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myfile.nc.nc
Type: application/x-netcdf
Size: 165776 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151026/3229b33e/attachment.nc 


More information about the ncl-talk mailing list