Hi all,
I use a cutoff freqency for 7 day to get low pass filter potential
vorticity. Then I calculate the gradient of this potential vorticity by
using the function "gradsg". When I run my script, it shows that "warning:
gradsg: 6 2-dimensional input array(s) contained missing values. No
interpolation performed on these arrays." My result looks reasonable even
though this warning exists. I try to use "linmsg" to interpolate missing
values before computing their gradient. But the warning still existed and
the pattern is wrong. My script is attached below.
I would be very appreciated if people can give me some suggestions. Thanks
a lot,
Yi-Hui
load "/usr/lib/ncarg/ncarg/nclscripts/csm/contributed.ncl"
begin
yr = new((/160/),float)
yr = 0
do n = 1,80
yr(n-1) = n
yr(79+n) = n + 100
end do
Q_sum = new((/152,64,128/),float)
Q_sum = 0
;open files of 160 ensemble members
do i=0,159
if (yr(i) .lt. 10) then
name="./ctl_PV_00" + yr(i) + ".nc"
else
if (yr(i) .lt. 100) then
name="./ctl_PV_0" + yr(i) + ".nc"
else
name="./ctl_PV_" + yr(i) + ".nc"
end if
end if
f = addfile(name,"r")
lat = f->lat
lon = f->lon
PV = f->PV_total(:,:,:)
;low pass filter
nwt = 7
fca = 1.0/7.0
ihp = 0
nsigma = 1.
wgt = filwgts_lancos(nwt,ihp,fca,-999.,nsigma)
PVf = wgt_runave_Wrap(PV(lat|:,lon|:,time|:),wgt,0) ;64*128*152
PVf!0="lat"
PVf!1="lon"
PVf!2="time"
PVf_reorder = PVf(time|:,lat|:,lon|:)
PVf_reorder!0="time"
PVf_reorder!1="lat"
PVf_reorder!2="lon"
;try linmsg, PVf_new replaces PVf_reorder in gradsg
;msg = 1e36
;PVf_reorder@_FillValue = msg
;PVf_new = linmsg(PVf_reorder,-1)
;PV_grad_lon = PVf_new
;PV_grad_lat = PVf_new
;calculate the gradient
PV_grad_lon = PVf_reorder
PV_grad_lat = PVf_reorder
gradsg(PVf_reorder,PV_grad_lon,PV_grad_lat)
PV_grad_lon_at_long_name = "PV longitudinal gradient (derivative)"
PV_grad_lat_at_long_name = "PV latitudinal gradient (derivative)"
Q = sqrt((PV_grad_lon(:,:,:))^2 + (PV_grad_lat(:,:,:))^2)
Q_sum = Q_sum + Q(:,:,:)
copy_VarCoords(Q,Q_sum)
delete(PV)
delete(PVf)
delete(PVf_reorder)
delete(PV_grad_lon)
delete(PV_grad_lat)
delete(Q)
end do
;average Q from all ensemble members
Q_avg = Q_sum/160
copy_VarCoords(Q_sum,Q_avg)
end
Yi-Hui Wang
Graduate Student
2101D Croul Hall, Dept of Earth System Science
University of California at Irvine
Irvine, CA 92697-3100
yihuiw_at_uci.edu
949-824-8448
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 04 2008 - 12:18:38 MST
This archive was generated by hypermail 2.2.0 : Fri Nov 07 2008 - 13:41:15 MST