Reverse plot

From: ziying li <ziying-li_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 12 2011 - 13:17:35 MST

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
Received on Wed Jan 12 13:17:41 2011

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