transect plot

From: Lin Su <Lin.Su_at_nyahnyahspammersnyahnyah>
Date: Tue, 26 Aug 2008 14:04:36 -0600 (MDT)

Dear NCL users,

I believe NCL can give the beautiful transect plots on the satellite data. However, I
followed the example(http://www.ncl.ucar.edu/Applications/transect.shtml) and
just messed things up. It shows the error in line 56. Attached please find the NCL
code.

Thanks for you time and great help in advance!
-Lin

---
Lin Su
http://atoc.colorado.edu/~sul/

;*****************************
;CSM_Graphics: tran_os.ncl
;*****************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
 f = addfile("CAL_LID_L2_05kmALay-Prov-V2-01.2007-05-02T16-57-30ZN.hdf", "r")
 latt = f->Latitude ; (3001,3)
 lat = new((/3001/),float)
 lat(:) = latt(:,1)
 lat!0 = "lat"
 lat_at_units = "degrees_north"
 lonn = f->Longitude ; (3001,3)
 lon = new((/3001/),float)
 lon(:) = lonn(:,1)
 lon!0 = "lon"
 lon_at_units = "degrees_east"
 altBase = f->Layer_Base_Altitude ;(3001,8)
 altBase_at_long_name = altBase_at_hdf_name
 altBase@_FillValue = -9999.
 altTop = f->Layer_Top_Altitude ;(3001,8)
 alt = new((/8/),float)
 alt(:)=altTop(639,:)
 alt!0 = "alt"
 alt_at_units = "km"
 alt_at_long_name = alt_at_hdf_name
 alt@_FillValue = -9999.
 numlayer = f->Number_Layers_Found ;(3001,1)
 numlayer_at_long_name = numlayer_at_hdf_name
 x = f->Feature_Optical_Depth_532 ; (3001,8)
 x_at_long_name = x_at_hdf_name
 x@_FillValue = -9999.
 xx=new((/3001,3001,8/),float)
 xx!0 = "lat"
 xx&lat = lat
 xx!1 = "lon"
 xx&lon = lon
 xx!2 = "alt"
 xx&alt =alt

;*****************************
;calculate great circle along transect
;***************************
 leftlat = 30
 rightlat = 50
 leftlon = 120
 rightlon = 150
 npts = 100
 dist = gc_latlon(leftlat,leftlon,rightlat,rightlon,npts,2)
 points = ispan(0,npts-1,1)*1.0
 ;**************************
 ;interpolate data to great circle
 ;***********************
  trans = linint2_points(xx&lon,xx&lat,x,True, dist_at_gclon,dist_at_gclat,2)
  copy_VarAtts(xx,trans)
  trans!0 = "alt"
  trans&alt = alt&alt
;plot
  wks = gsn_open_wks("x11","trans_os")
  gsn_define_colormap(wks,"BlAqGrYeOrReVi200")

  res = True
  res_at_tmXBMode = "Explicit"
  res_at_tmXBValue = (/points(0),points(npts-1)/)
  res_at_tmXBLabels = (/leftlat +","+leftlon,rightlat+","+rightlon/)
  res_at_cnFillOn = True
 res_at_lbLabelAutoStride = True
 res_at_gsnSpreadColors = True
 res_at_cnLinesOn = False
 res_at_lbOrientation = "vertical"
 res_at_pmLabelBarOrthogonalPosF = -0.05
 
 plot = gsn_csm_contour(wks,trans,res)

 frame(wks)
end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 26 2008 - 14:04:36 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 27 2008 - 10:22:45 MDT