Why I can not set the correct units for coordinates?

From: xiang lin <leo.aries.g_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 25 2011 - 11:10:06 MST

Hi, all
     The error message i met was as 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'
    I was puzzled because I used to believe in my way to define the
coordinates and can not find mistake in my codes. Anyone can show me a
hand?
   ThankŁˇ

parts of my codes as below :
.....
 lon = asciiread("/Work/smi/Obs_Longseries/71sta_lon.txt", -1, "float")
 lat = asciiread("/Work/smi/Obs_Longseries/71sta_lat.txt", -1, "float")
........
; PLot SVD
; ******************************************************
   ; =================================
   ; define new grid
   ; =================================
   ; printVarSummary(eofs)
   nlon = fspan(100,134,69)
   nlon@long_name = "longitude"
   nlon@units = "degree_east"
   nlat = fspan(20,50,61)
   nlat@long_name = "latitude"
   nlat@units = "degree_north"

; =================================
; convert station data. --> lon-lat grid
; =================================
   pgrid1 = new((/nsvd,69,61/),"float")
   pgrid2 = new((/nsvd,69,61/),"float")

   do i = 0,nsvd-1
      pgrid1(i,:,:) = natgrids(lon,lat,hetlft(i,:),nlon,nlat)
      pgrid2(i,:,:) = natgrids(lon,lat,hetrgt(i,:),nlon,nlat)
   end do

    pgrid1!0 = "svd"
    pgrid1!1 = "lon"
    pgrid1!2 = "lat"
    pgrid1&lon = nlon
    pgrid1&lon@units = "degrees_east"
    pgrid1&lat = nlat
    pgrid1&lat@units = "degrees_north"
    pgrid1@long_name = "Left Homogeneous array"

    pgrid2!0 = "svd"
    pgrid2!1 = "lon"
    pgrid2!2 = "lat"
    pgrid2&lon = nlon
    pgrid2&lon@units = "degrees_east"
    pgrid2&lat = nlat
    pgrid2&lat@units = "degrees_north" ; I was
puzzled, In fact I define the ˇ±unitsˇ° twice (first time when I defining
nlon)
    pgrid2@long_name = "Right Homogeneous array"
    printVarSummary(pgrid1)
    printVarSummary(pgrid1&lon)

  ; *********************************************************
   wks = gsn_open_wks("eps",plot_filename+"_svd_homogeneous_array")
   gsn_define_colormap(wks,"BlWhRe") ; choose colormap

   map = new(nsvd*2,graphic)
   dum = new(nsvd*2,graphic)

   res2 = True
   res2@gsnDraw = False
   res2@gsnFrame = False

   res2@gsnAddCyclic = False

   res2@mpLimitMode = "LatLon"
   res2@mpMinLatF = 10.
   res2@mpMaxLatF = 60.
   res2@mpMinLonF = 100.
   res2@mpMaxLonF = 135.
   res2@mpLandFillColor = -1 ; set to be transparent in land area

    res2@cnFillOn = True
    res2@gsnSpreadColors = True
    res2@gsnSpreadColorStart = 12
    res2@gsnSpreadColorEnd = 92

    res2@cnLinesOn = False
  ; res2@cnLevelSelectionMode = "ExplicitLevels"
  ; res2@cnLevels =
  ; res2@cnMonoLineDashPattern = False
  ; res2@cnLineDashPatterns = (/2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0/)
  ; res2@cnMonoLineThicknessF = False

   res2@cnInfoLabelOn = False

 ; add a marker for chronology
  gsres = True
  gsres@gsMarkerIndex = 17 ; Use filled dots for markers. 12 for
wujiaoxing
  gsres@gsMarkerColor = (/"yellow"/)
  gsres@gsMarkerSizeF = 0.01
  gsres@gsMarkerThicknessF = 2.

   do i =0,nsvd-1
        map(i*2) = gsn_csm_contour_map(wks,pgrid1(i,:,:),res2)
        dum(i*2) = gsn_add_polymarker( wks,map(i*2),lon,lat,gsres )

        map(i*2+1) = gsn_csm_contour_map(wks,pgrid2(i,:,:),res2)
        dum(i*2+1) = gsn_add_polymarker( wks,map(i*2+1),lon,lat,gsres )
   end do

   resp = True
   resp@gsnMaximize = True

   gsn_panel(wks,map,(/3,2/),resp)

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 25 11:10:17 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST