Re: file dim names and var names

From: David Brown (dbrown AT ucar.edu)
Date: Mon Oct 11 2004 - 11:08:44 MDT


Hi Jim,

On Oct 11, 2004, at 10:41 AM, Jim Edwards wrote:

> 1. Is there a method to get the dim names from a netcdf file?
>

getfilevardims

> 2. The function getfilevarnames does not seem to work with addfiles:
>

This seems like a bug. I'll look into it.
  -dave

> This method works:
> ; Open the files
> fnames = systemfunc("ls movies/*.nc")
> f = addfiles(fnames,"r") ; Open netCDF files.
> ; Get the dimensions
> fcnt = dimsizes(fnames)
> f1=addfile(fnames(0),"r")
> varnames = getfilevarnames(f1)
> print (varnames)
> exit
>
> Variable: varnames
> Type: string
> Total Size: 80 bytes
> 10 values
> Number of Dimensions: 1
> Dimensions and sizes: [10]
> Coordinates: (0) Q
> (1) ke
> (2) v
> (3) u
> (4) T
> (5) zeta
> (6) ps
> (7) Time
> (8) lonP
> (9) latP
>
>
> This does not:
>
> ; Open the files
> fnames = systemfunc("ls movies/*.nc")
> f = addfiles(fnames,"r") ; Open netCDF files.
>
> ; Get the dimensions fcnt = dimsizes(fnames)
> varnames = getfilevarnames(f[0])
> print (varnames)
> exit
>
> Variable: varnames
> Type: string
> Total Size: 0 bytes
> 0 values
> Number of Dimensions: 1
> Dimensions and sizes: [0]
> Coordinates: (0) (1) (2) (3) (4) (5) (6)
> (7) ...
> (2554) (2555) (2556) (2557) (2558) (2559) Segmentation fault
> (core dumped)
>
>
> --
> Jim Edwards jedwards@ucar.edu
> IBM Applications Analyst
> NCAR SCD
> BOULDER CO 303-497-1842
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Tue Oct 12 2004 - 17:06:33 MDT