I want to subtract the time average of the zonally averaged wind,
from the zonally averaged wind itself. I then want to plot the result
as a function of level and time. I am currently using 45 files to
produce the time average.
When I have produced the time average of the zonally averaged wind, I
am assuming that this will be the same at all times (the zonally
averaged wind of course has a time variation). The zonally average
wind is a 3-D quantity, which is a function of lev, lat and time. The
time average of the zonally averaged wind is a 2-D quantity, which is
a function of lev and lat. However, there is no reason that a value
which is constant in time cannot be subtracted from another value
that varies in time. I am not sure how to get my script to accept
that though.
I get the following error:
fatal:Minus: Number of dimensions do not match, can't continue
fatal:Execute: Error occurred at or near line 61 in file timediff.ncl
Does anyone know how to get this to work ?.
I enclose my current script below.
Thanks,
Helen.
;***********************
; timediff.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
; Keep all files open when have a lot of files :
setfileoption("nc","SuppressClose",False)
diri = "./"
fili = systemfunc("cd "+diri+" ; ls zeusorigsponge*nc")
; fili = systemfunc("cd "+diri+" ; ls
zeusrand09125daily*.cam2.h0*nc")
; fili = systemfunc("cd "+diri+" ; ls rand09125*.cam2.h0*nc")
f = addfiles (fili,"r")
U = addfiles_GetVar(f,fili,"U")
lat = addfiles_GetVar(f,fili,"lat")
lon = addfiles_GetVar(f,fili,"lon")
lev = addfiles_GetVar(f,fili,"lev")
time = addfiles_GetVar(f,fili,"time")
printVarSummary( U )
dimu = dimsizes( U )
ntim = dimu(0)
klvl = dimu(1)
nlon = dimu(2)
mlon = dimu(3)
uavg = dim_avg_Wrap(U)
uavg_reorder = uavg(lev | :, lat | :, time | :) ; (lev,lat,time)
utimeav = dim_avg_Wrap(uavg_reorder) ; (lev,lat)
;***********************
; Create Plot
;***********************
wks = gsn_open_wks ("pdf",
"difftime.zeusorigsponge1to44" ) ; open workstation
gsn_define_colormap(wks,"rainbow") ; choose colormap
res = True
res_at_cnFillOn = True
res_at_lbLabelAutoStride = True
res_at_gsnMaximize = True ; if [ps, eps, pdf] make large
res_at_gsnSpreadColors = True ; span color map
nl = 96
res_at_gsnCenterString = "zeusorigsponge years 1 to 45"
res_at_tiXAxisString = "Time (years)"
plot = gsn_csm_contour(wks, (uavg_reorder(:,nl,:)-utimeav
(:,nl)), res ) ; (lev,lat,time)
res_at_trYReverse = True
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 06 2009 - 04:12:16 MST
This archive was generated by hypermail 2.2.0 : Sun Mar 08 2009 - 12:05:46 MDT