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"
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
Received on Fri Aug 27 11:50:53 2010
This archive was generated by hypermail 2.1.8 : Thu Sep 09 2010 - 05:56:39 MDT