Re: Reverse plot

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 12 2011 - 13:27:08 MST

> lat=fspan(89.5,-89.5,numlat)
> lon=fspan(-179.5,179.5,numlon)
>
> lat@units="degrees_north"
> lon@units="degrees_east"
>
> data@lat=lat < WRONG SYNTAX
> data@lon=lon

data!0 = "lat" ; name the dimension
data!1 = "lon

data&lat = lat ; assign values to named dimension
data&lon = lon

On 01/12/2011 01:17 PM, ziying li wrote:
>
> Hi,
>
> I got a graphic for a TRMM file. The pattern is correct, but the plot
> should from North to South, not South to North.
>
> I also try to add line: 'lat=(::-1)' and it does not change the
> direction. I attach my codes below.
>
> Can you help me check what I could do to fix it? The hdf file can be
> retrieved here
> <ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/NASAHDF/3A46.080101.2.HDF>
>
> Thanks
>
> Ziying
>
>
> ---------------------------------------------------------------------------------------------------------------------------
>
> 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"
>
> begin
> eos_file=addfile("3A46.080101.2.HDF", "r") ; Read file.
>
>
> data=eos_file->ssmiData(0,0,:,:) ; read data field
>
> data@_FillValue=-9999.9 ; turn -9999.9's to an arbitrary fill value in
> order to display 0 correctly
>
>
> data!1="lon" ; This file does not contain coordinate variables.
> data!0="lat" ; To properly display the data, the latitude/longitude must
> be remapped from its metadata.
>
> dimsize = dimsizes(data)
> numlon = dimsize(1) ; 360
> numlat = dimsize(0) ; 180
>
> ;http://disc.sci.gsfc.nasa.gov/additional/faq/precipitation_faq.shtml#lat_lon
> lat=fspan(89.5,-89.5,numlat)
> lon=fspan(-179.5,179.5,numlon)
>
> lat@units="degrees_north"
> lon@units="degrees_east"
>
> data@lat=lat
> data@lon=lon
>
>
> xwks=gsn_open_wks("pdf","3A46.080101.2_ssmiData_test") ; 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" ; faster
> res@lbOrientation="vertical" ; 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="3A46.080101.2.HDF" ; create title
>
> res@gsnLeftString="FIELD NAME: ssmiData"
> res@gsnCenterString="Precipitation Rate"
> res@gsnRightString="UNITS: mm/hr"
>
> plot=gsn_csm_contour_map_ce(xwks,data(lat|:,lon|:),res)
>
>
> ; cleaning up resources used
> delete(plot)
> 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

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 12 13:27:14 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:20 MST