Re: file dim names and var names

From: David Brown (dbrown AT XXXXXX)
Date: Mon Oct 11 2004 - 14:19:00 MDT


Hi all,

Jim pointed out to me that 'getfilevardims' gets the dimension names
for a particular variable in the file. In order to get all the
dimensions
in a file you should use 'getvardims' (where the 'variable' argument is
set to the NCL file variable.

Also I can report that I have found and fixed the bug in
'getfilevarnames'
called with a list element referencing a file variable.
  -dave

>
> 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 AT ucar.edu
>> IBM Applications Analyst
>> NCAR SCD
>> BOULDER CO 303-497-1842
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk AT ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk AT ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

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



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