Re: Need to transpose lattitude and longitude? How?

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 08 2010 - 20:32:28 MDT

Hi Yi,
See the FAQ on that error message here:
http://www.ncl.ucar.edu/FAQ/#err_msgs_017
I think your units settings are incorrect. Change this:
 lat@units="degrees_north <lat@units=%22degrees_north>"
 lon@units="degrees_east <lon@units=%22degrees_east>"
to this:
lat@units = "degrees_north"
lon@units = "degrees_east"
Let us know if that doesn't work...
Adam

> Dear Friends,
>
> I met another problem. My plot looks weird. The latitude should be between
> -49.875 and 49.875, and the longitude should be between -179.875 and
> 179.875. But my current plot has latitude from 90S to 90N (see
> 3B42.100331.21.6A_precipitation.pdf in attachment). Could you please tell
> me
> where came this problem? (I guess transpose the lat and lon is needed, if
> so, how to transpose?)
>
> I also met some warning message 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'
> (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'
> Do you know where came the problem? Thanks a lot.
>
> Best wishes,
> Yi Wang
>
>
> *The corresponding HDF file named 3B42.100331.21.6A.hdf is in the
> attachment.*
>
> *And the ncl codes:*
> load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ; This is an example of a 3-D data field at one level.
> ; It is assumed users know how to obtain information such as _FillValue
> from
> HDFView.
> ; For information about HDFView, visit
> http://www.hdfgroup.org/hdf-java-html/hdfview/.
> begin
> eos_file=addfile("3B42.100331.21.6A.hdf", "r") ; Read file.
> ; Since the file is not HDF-EOS2, it is not necessary to append .he2
> data=eos_file->precipitation(0,:,:) ; read data field
> ; Here, because the file is not HDF-EOS2, it is not necessary to append
> the
> group name
> data@_FillValue=0h ; turn 0's to an arbitrary fill value in order to
> display
> 0 correctly
> data@_FillValue=-9999h
> data!0="lon" ; This file does not contain coordinate variables.
> data!1="lat" ; To properly display the data, the latitude/longitude must
> be
> remapped from its metadata.
> ; See http://www.ncl.ucar.edu/Applications/Scripts/regrid_10.ncl for more
> information
>
> dimsize = dimsizes(data)
> numlon = dimsize(0)
> numlat = dimsize(1)
> ;
> http://disc.sci.gsfc.nasa.gov/additional/faq/precipitation_faq.shtml#lat_lon
> lat=fspan(-49.875,49.875,numlat)
> lon=fspan(-179.875,179.875,numlon)
> lat@units="degrees_north <lat@units=%22degrees_north>"
> lon@units="degrees_east <lon@units=%22degrees_east>"
> ;printVarSummary(lon)
> ;printVarSummary(lat)
> data&lat=lat
> data&lon=lon
>
> xwks=gsn_open_wks("pdf","3B42.100331.21.6A_precipitation") ; open
> workstation
> res=True ; plot mods desired
> res@cnFillOn=True ; enable contour fill
> res@gsnMaximize=True; make plot large
> res@gsnPaperOrientation = "portrait" ; force portrait orientation
> res@cnLinesOn=False ; turn off contour lines
> res@cnLineLabelsOn = False; turn off contour line labels
> res@gsnSpreadColors=True ; use the entire color spectrum
> res@cnFillMode="RasterFill <res@cnFillMode=%22RasterFill>" ; faster
> res@lbOrientation="vertical <res@lbOrientation=%22vertical>" ; vertical
> labels
> res@cnMissingValFillPattern = 0 ; missing value pattern is set to
> "SolidFill"
> res@cnMissingValFillColor=0 ; white color for missing values
> res@lbLabelAutoStride = True ; ensure no label overlap
>
> gsn_define_colormap(xwks,"BlAqGrYeOrReVi200") ; define colormap
>
> res@tiMainString="3B42.100331.21.6A.HDF<res@tiMainString=%223B42.100331.21.6A.HDF>"
> ; create title
> res@gsnCenterString="precipitation <res@gsnCenterString=%22precipitation>
> at
> scan=0" ; create center text
> plot=gsn_csm_contour_map_ce(xwks,data,res) ; plot on world map first
>
> delete(plot) ; cleaning up resources used
> delete(lat)
> delete(lon)
> delete(xwks)
> delete(data)
> delete(res)
> delete(eos_file)
> end
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 8 20:32:33 2010

This archive was generated by hypermail 2.1.8 : Fri Jun 11 2010 - 09:33:24 MDT