Re: on reading NCDF files [message #37669] |
Tue, 20 January 2004 05:57  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Sangwoo wrote:
> Hi everyone!
>
> I'm gonna read a NCDF file. It may contain several variables within
> itself. When I extract a variable named "image", the procedure is as
> follows:
>
> cid=ncdf_open('test.nc')
> vid=ncdf_varid(cid,'image')
> ncdf_varget,cid,vid,image
>
> But suppose I don't know the name of each variable unfortunately. Is
> there any way to figure out the details of the included
> variables(name, dimension, etc.)? The second command fails when I put
> a wrong variable. And is there any way to read the included variables
> all at once? (something like /all keyword)
>
> I wonder if there's any way to figure out all details of the included
> variables from an NCDF file directly.
Dear Sangwoo
you could try our read_ncdf function.
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/read_ncdf_dbase.pro.html
This routine reads all international defined attributes and some more.
The attributes has to be defined in a definition routine, e.g. def_icg.
A different diffinition could be given with a keyword: def_struct
you could call it this way
x=read_ncdf(file) reads everything of parameters
x=read_ncdf(file,[var1,var2]) var1 ... short_name of parameter,
all coordination parameters are readed too
x=read_ncdf(file, /raw,/as_pointer) result is a structure all values are
pointer, no valid index vectors are creaeted no scale_factor no
add_offset is used.
x=read_ncdf(file,/status) additional info about definition of varibales
is added
There are more keywords available. And there are lots of routines for
the ICG-DATA-STRUCTURE in our libray at
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
regards
Reimar
|
|
|