[ncl-talk] Inverted Pressure Levels produced by ncl script
Lyndon Mark Olaguera
olagueralyndonmark429 at gmail.com
Mon Nov 14 18:44:39 MST 2016
Dear All,
I'm trying to do a bandpass filter in ncl. When I compare the input and
output netcdf file the vertical levels seems to be reversed. Did I missed
something in writing the output netcdf file that caused this?
I'll appreciate any help:
*ncdump -h of input file:*
netcdf uwind_1981-2007 {
dimensions:
lon = 144 ;
lat = 73 ;
level = 17 ;
time = UNLIMITED ; // (9861 currently)
variables:
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "Longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "Latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
float level(level) ;
level:standard_name = "air_pressure" ;
level:long_name = "Level" ;
level:units = "millibar" ;
*level:positive = "down" ;*
level:axis = "Z" ;
*ncdump -h of processed file:*
netcdf uwind_anom_DJF_ph8 {
dimensions:
lon = 144 ;
lat = 73 ;
level = 17 ;
time = UNLIMITED ; // (1 currently)
variables:
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
float level(level) ;
level:standard_name = "air_pressure" ;
level:long_name = "Level" ;
level:units = "millibar" ;
*level:positive = "up" ;*
level:axis = "Z" ;
Here's my code:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
dir ="."
fili ="uwind*"
files =systemfunc("ls uwind_*.nc")
numfiles=dimsizes(files)
do ifil=0,numfiles-1
f = addfile(files(ifil), "r")
time := f->time
date := ut_calendar(time,-2)
ua := f->uwnd(:,:,:,:)
level= f->level
lat= f->lat
lon= f->lon
ca = 100.0
cb = 20.0
fca = 1.0/ca
fcb = 1.0/cb
opt = True
opt at m = 4
dims = 0
bf := bw_bandpass_filter(ua,fca,fcb,opt,dims)
copy_VarMeta(ua,bf)
bf at long_name = "Band Pass: "+cb+"-"+ca+" day"
ncdf = addfile("filt_"+files(ifil),"c")
fAtt = True
fAtt at title = "4th order Butterworth BPass Filter"
fAtt at source_file = "uwind_anom_1981-2007.nc"
fAtt at Conventions = "None"
fAtt at creation_date = systemfunc("date")
fileattdef(ncdf,fAtt) ; copy file attributes
ncdf->bf = bf
end do
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161115/2ace9092/attachment.html
More information about the ncl-talk
mailing list