comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » how to list variable names from netCDF file?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how to list variable names from netCDF file? [message #5498 is a reply to message #5351] Thu, 07 December 1995 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
T.Osborn wrote:
>
> Can anyone help me with the following problem?
>
> I am trying to write some IDL code to read in a number of netCDF files, without
> knowing in advance the names of the variables in the file. Is there a routine
> which can return the variable name of the Nth variable in the file?
>
> Once open, I can use ncdf_inquire to find the number of variables, but
> ncdf_varinq says it can only return the name of a variable if you give it
> the variable's id, which can be got from calling ncdf_varid. But ncdf_varid
> requires the variables name! What I need is an equivalent of ncdf_attname,
> which returns the name of the Nth attribute.
>

Maybe the documentation is causing you trouble (imagine that!).
Here is a small example...

file = '/Datasets/nmc/uwnd.79.nc'
ncid = NCDF_OPEN( file )
result = NCDF_INQUIRE( ncid )
num_vars = result.NVARS
for i = 0, num_vars-1 do print, ncdf_varinq(ncid,i)

--------
Andrew F. Loughe (afl@cdc.noaa.gov)
University of Colorado, CIRES * Campus Box 449 * Boulder, CO 80309
phone: (303) 492-0707 fax: (303) 497-7013
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Saving animation images
Next Topic: Re: mbar and event handlers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 22 18:22:03 PDT 2025

Total time taken to generate the page: 2.87841 seconds