Re: Reading special dataset with addfile

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 28 2012 - 21:23:08 MDT

Use string referencing to read the variable into memory. The file
variable names can include periods, but the memory variable names can
not (I think).

http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#StringRef

Here is a live example made by editing "plant.start" into an existing CDL file:

ncl 0> f = addfile ("test.nc", "r")
ncl 1> varname = "plant.start"
ncl 2> x = f->$varname$
ncl 3> printVarSummary (x)

Variable: x
Type: float
Total Size: 259200 bytes
            64800 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 180] x [lon | 360]
Coordinates:
            lat: [-89.5..89.5]
            lon: [ 0.5..359.5]
Number Of Attributes: 2
  units : mm
  _FillValue : -9.99e+08
ncl 4>

The same method also works for file variable attributes and memory
variable attributes.

--Dave

On Wed, Mar 28, 2012 at 8:50 PM, Xin Xi <xxi@gatech.edu> wrote:
> Hi, there
> I have a dataset (netcdf format) with parameters named as "plant.end",
> "harvest.start" and "harvest.end", etc. While using add_file, it reported
> errors due to the naming of the parameters - with dot (.) or reserved
> character ("end"). Any idea what I can do to it, other than go through the
> trouble of revising the netcdf file?
> Thanks!
> Xin
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 28 21:23:18 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 09 2012 - 13:43:03 MDT