Re: Re: transect plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 28 Aug 2008 20:42:26 -0600

Lin,

You have the line:

   X&alt = alt

The "X&alt" part is okay, because you've named one of your X
dimensions to be "alt".
The "alt" on the right side of the equation is not okay, though,
because you don't have
a local NCL variable with this name.

You said that the real altitude values are stored in
Layer_Base_Altitude and
Layer_Top_Altitude, so you need to set X&alt equal to some
calculation based
on these two values.

-Mary

On Aug 28, 2008, at 12:18 PM, Lin Su wrote:

> Thanks, Mary:) No more error at the dimensional issue on
> triple2grid right now.
> But the following error comes up:
>
> fatal:Variable (alt) is undefined
> fatal:Execute: Error occurred at or near line 36 in file tran.ncl
>
> The problem is I need to define the height for the transect plot
> although the
> second dimension in x (and the 1st dimension in X) is layer numbers
> (8 layers
> totally). The real altitudes' values are stored in
> Layer_Base_Altitude and
> Layer_Top_Altitude.
>
> Any ideas or suggestions to do this?
>
> Thanks for your great help as always!
> -Lin
> ---
> Lin Su
> http://atoc.colorado.edu/~sul/
>
>
>
>
> 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")
> lat = f->Latitude ; (3001,3)
> lat_at_units = "degrees_north"
> lon = f->Longitude ; (3001,3)
> 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)
> altTop_at_units = "km"
> altTop_at_long_name = altTop_at_hdf_name
> altTop@_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.
> ;printVarSummary(x)
>
> ;dimensional issues
> X = new((/8,3001/), float)
> X(0,:) = x(:,0)
> X(1,:) = x(:,1)
> X(2,:) = x(:,2)
> X(3,:) = x(:,3)
> X(4,:) = x(:,4)
> X(5,:) = x(:,5)
> X(6,:) = x(:,6)
> X(7,:) = x(:,7)
> X!0 = "alt"
> X&alt = alt
> LAT = lat(:,1 )
> LON = lon(:,1 )
>
> ;res = True
> ;res_at_sfXArray = LON
> ;res_at_sfYArray = LAT
>
> latS = 30.
> latN = 45.
> lonL = 130.
> lonR = 140.
>
> ;delete(res_at_sfXArray)
> ;delete(res_at_sfYArray)
>
> dlat = 0.25 ; create a grid
> dlon = 0.25
> nlat = floattoint( (latN-latS)/dlat ) + 1
> mlon = floattoint( (lonR-lonL)/dlon ) + 1
> lonGrid = fspan(lonL, lonR, mlon)
> lonGrid!0 = "lon"
> lonGrid_at_units = "degrees_east"
> latGrid = fspan(latS, latN, nlat)
> latGrid!0 = "lat"
> latGrid_at_units = "degrees_north"
>
> TGRID = triple2grid(LON,LAT,X,lonGrid,latGrid, False)
> TGRID!0 = "alt"
> TGRID!1 = "lat"
> TGRID!2 = "lon"
> TGRID&alt = alt
> TGRID&lat = latGrid
> TGRID&lon = lonGrid
>
> printVarSummary(TGRID)
> printMinMax(TGRID, True)
> res_at_gsnCenterString = "Feature_Optical_Depth_532"
>
> ;transect plot
> ;calculate great circle along transect
> ;***************************
> leftlat = 30
> rightlat = 50
> leftlon = 110
> rightlon = 140
> 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(TGRID&lon,TGRID&lat,TGRID,True,
> dist_at_gclon,dist_at_gclat,2)
> copy_VarAtts(TGRID,trans)
> trans!0 = "alt"
> trans&alt = TGRID&alt
> ;plot
> wks = gsn_open_wks("x11","trans_os")
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>
> res1 = True
> res1_at_tmXBMode = "Explicit"
> res1_at_tmXBValue = (/points(0),points(npts-1)/)
> res1_at_tmXBLabels = (/leftlat +","+leftlon,rightlat+","+rightlon/)
> res1_at_cnFillOn = True
> res1_at_lbLabelAutoStride = True
> res1_at_gsnSpreadColors = True
> res1_at_cnLinesOn = False
> res1_at_lbOrientation = "vertical"
> res1_at_pmLabelBarOrthogonalPosF = -0.05
>
> plot = gsn_csm_contour(wks,trans,res1)
>
> end
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 28 2008 - 20:42:26 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 29 2008 - 07:39:21 MDT