Re: Unable to write out filtered data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 15 2011 - 09:19:10 MST

The 1st rule of data processing s to 'look at your data.'
I am sure if you used

  f = addfile("uwnd.mon.mean.nc", "r")
  x = f->uwnd
  printVarSummary(x)

you would see something like

Variable: x
   Type: short <============ 16 bit integer
   add_offset : ....
   scale_factor : ...

Further, I speculate it is 4-dimensional

   Dimensions and sizes: [time | ???] x [level | 17] x [lat | 73] x [lon
| 144]

You must unpack this before using the data
  http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml

   x = short2flt( f->uwnd )

It is 4-dimensional. It has 'named' dimensions (time,lev,lat,lon)

Hence, you must has gotten an eror message when you did

x(time|:,lat|:,lon|:)

On 11/15/11 3:49 AM, Zablone Owiti wrote:
> Dear all,
> I'm new to NCL and am trying to filter and write the filtered data to a
> file using the following code:
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
> begin
>
> f = addfile("uwnd.mon.mean.nc", "r")
> x = f->uwnd
> print( getfilevarnames(f))
>
> srate = 1 ; monthly means
> bpf = (/20,36,49/) ;
> wgty =latRegWgt(x&lon,"double",0)
> opt = False
>
> xBPF = band_pass_latlon_time (x(time|:,lat|:,lon|:), srate, bpf, opt)
> xBPF !0 = "time"
> xBPF !1 = "lat"
> xBPF !2 = "lon"
> printVarSummary( xBPF )
>
> ;Return variable to original dimension
>
> uwn = xBPF(time|:,lat|:,lon|:)
>
> uwn&time = x&time
> uwn&lon = x&lon
> uwn&lat = x&lat
> copy_VarAtts(x,uwn)
> ;open file to write
> fileName = "uwnd.nc"
> setfileoption("nc","Format","LargeFile")
> outFile = addfile(fileName,"c")
>
> ;write data to file
> outFile->uwn = uwn
> printVarSummary( uwn )
> ;print("Thank you,come again." + systemfunc("date"))
> end
> When I try to plot the written data (uwnd.nc), I get the error:
> *Warning: Countour plot; no valid values in scalar field; contourPlot
> possible: [errno=1101]*
> Any help please
> */===================================================/*
> */ZABLONE OWITI
> /*
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 15 09:19:28 2011

This archive was generated by hypermail 2.1.8 : Thu Nov 17 2011 - 11:50:12 MST