Hi Keith
Try:
http://www.ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/getvardims.shtml
So
f = addfile ("atmos.nc" , "r")
dSizes = getfiledimsizes( f )
dNames = getvardims( f )
print(dSizes+" "+dNames)
Yields
(0) 1 ncl_scalar
(1) 128 lon
(2) 30 lev
(3) 31 ilev
(4) 64 lat
(5) 81 nchar
(6) 1 time
=============================================
[1] At one level, it looks like 'getvardims' may be a poorly named function.
However, like light that can be viewed as particles and waves, the
reference to the file [ f ] is both a file reference *and* a
variable. :-)
[2] Still, I think I will request that there be a function 'getfiledimnames'
which will, under the hood, uses getvardims.
[3] I will add some documentation.
Good luck
D
Keith Lindsay wrote:
> Hi,
>
> I have a NetCDF file that has some named dimensions in it whose size I
> would like to get inside an NCL script I'm writing.
>
> The catch is that the file doesn't have any variables that contain these
> dimensions. Because of this I don't see how I can use getfilevardimsizes
> to get the dimension sizes. There are no variables to call it with.
>
> A potentially promising NCL function is getfiledimsizes, which returns
> the sizes of all named dimensions in a file. But I don't see how to
> connect the dimension sizes returned from getfiledimsizes with
> particular dimension names. I don't see a corresponding getfiledimnames
> function.
>
> If I were doing this in Fortran, I would use NF_INQ_DIMID and
> NF_INQ_DIMLEN, but I don't see how to translate that into NCL.
>
> Anyone see how I get size of a dimension out of a file that doesn't have
> a corresponding variable?
>
> Thanks, Keith
>
>
-- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed May 07 2008 - 10:58:32 MDT
This archive was generated by hypermail 2.2.0 : Wed May 14 2008 - 14:24:59 MDT