Re: coordinate subscripting eta levels

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 27 2010 - 12:04:09 MDT

Hi Zack,
The error message means that ZNU is 1-dimensional, but you are
specifying 2 dimensions when you do this: (0,{1:0.250})
and you are not using ZNU anywhere else in your script.

I think what you want to do is specify the eta levels within your X
array. You can do that in two places. Here:
X = f->T(nt,{:250.},:,:)
(the above assumes that lev goes from bottom to top, is in units of hPa,
and is a coordinate variable of T. According to your commented out
coding at the top, this is likely the case.)

or here:
plot = gsn_csm_pres_hgt(wks,X({:250.},{LAT},:),res)
plot = gsn_csm_pres_hgt(wks,X({:250.},:,{LON}),res)

You can also limit the extent of your y-axis within the resource list by
setting res@trYMaxF = 250. The downside to this approach is that unless
you are specifying the contour levels, NCL will base the contour levels
on the entire specified X array, and not just on X below 250hPa..
Let us know if that didn't help..
Adam

On 08/27/2010 11:50 AM, Zack Taylor wrote:
> Hello,
>
> I'm creating cross sections, and would like to limit the eta levels that
> are plotted. The following script is available on the NCL sample scripts
> (http://www.ncl.ucar.edu/Applications/Scripts/WRF_lc_9.ncl).
>
> The output generates a y-axis that goes from surface to 50 hPa (the top
> of my model). I'd like to limit ZNU to just 250 hPa. I figure that
> coordinate subscripting is the way to go, and have followed examples
> online.
>
> Is this the appropriate way to do it: znu = f->ZNU(0,{1:0.250}) ; eta levels
>
> This is the error message I get:
> fatal:Number of subscripts on rhs do not match number of dimensions of
> variable,(2) Subscripts used, (1) Subscripts expected
>
> Any help would be greatly appreciated. Thanks!
>
> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> ; Dimensions and sizes: [lev | 34] x [lat | 160] x [lon | 180]
> ; Coordinates:
> ; lev: [996.. 3]
> ; lat: [16.78917..34.54238]
> ; lon: [-105.1526..-82.84741]
>
> begin
> nt = 0
>
> fName = "wrfout_d01_2003-07-13_12:00:00.nc <http://00.nc>"
> LAT = 20
> LON = -90
>
> f = addfile(fName, "r")
>
> Time = chartostring( f->Times(nt,:) )
> X = f->T(nt,:,:,:)
> znu = f->ZNU(0,:) ; eta levels
> ; extract 1d arrays of lat and lon
> lat = f->XLAT(0,:,0) ; (south_north) => [16.78917..34.54238]
> lon = f->XLONG(0,0,:) ; (west_east) => [-105.1526..-82.84741]
> lat@units= "degrees_north"
> lon@units= "degrees_east"
> lat!0 = "lat"
> lon!0 = "lon"
> lat&lat = lat
> lon&lon = lon
> ; fake out gsn_csm_pres_hgt
> lev = znu*1000 ; [-105.1526..-82.84741]
> lev@long_name = "eta*1000"
> lev@units= "hPa"
> lev!0 = "lev"
> lev&lev = lev
>
> X!0 = "lev"
> X!1 = "lat"
> X!2 = "lon"
> X&lev = lev
> X&lat = lat
> X&lon = lon
> printVarSummary(X)
>
> ;************************************************
> ; create plots
> ;************************************************
> wks = gsn_open_wks("ps" ,"WRF_lc")
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map
>
> res = True ; plot mods desired
> res@gsnMaximize = True ; uncomment to maximize size
> res@gsnSpreadColors = True ; use full range of colormap
>
> res@cnFillOn = True ; color plot desired
> res@cnLinesOn = False ; turn off contour lines
> res@cnLineLabelsOn = False ; turn off contour labels
> res@gsnAddCyclic = False
> res@lbLabelAutoStride = True ; NCL will decide on spacing
> res@tmYRMode = "Automatic" ; turn off special labels on right axis
>
>
> res@tiMainString = Time+" lat="+sprintf("%5.2f" ,lat({LAT}))
> res@gsnMajorLonSpacing = 5 ; change maj lon tm spacing
> plot = gsn_csm_pres_hgt(wks,X(:,{LAT},:),res)
>
> res@tiMainString = Time+" lon="+sprintf("%6.2f" ,lon({LON}))
> res@gsnMajorLatSpacing = 5 ; change maj lat tm spacing
> plot = gsn_csm_pres_hgt(wks,X(:,:,{LON}),res)
>
>
> end
>
> --
> Zackary Taylor
> Graduate Research Assistant
> Earth, Ocean and Atmospheric Science
> Florida State University
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 27 12:04:35 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 09 2010 - 05:56:39 MDT