[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ncdiminq



>From: address@hidden (CHENG M)
>Organization: Oak Ridge National Laboratory
>Keywords: 199402091449.AA14047 netCDF

Meng-Dawn,

>YES.  I found that I could get the actual no. of records in a CDF file
>when I used "ncdiminq" call.  After that it is a matter of getting
>data out by setting up a do-loop using "ncvarget1" call for a number
>of times <i.e., number = that came out from ncdiminq>.
>
>My question was if there is a macro definition like MAX_NC_VARS
>that determines the actual no. of records in a CDF file.  So I can
>can use this macro in the declaration of 
>
>static long count[] = {that macro definition};
>
>if I want to use "ncvarget" instead of "ncvarget1".  ncvarget gets
>a hyperslab of data rather than one single value.
>
>I appreciate very much your quick response.

Since the length of the unlimited dimension is variable (you could add to
the file), there is no macro defined (macros are compile-time options) that 
can tell you the number of records in the file.  Perhaps you don't quite have 
the flavor of a netCDF.  All of the information you need to get data out of 
the file is contained in the file.  The process for doing this is to execute 
inquire type functions that return information like how many variables you 
have in the file, the dimensionality of the variables, the length of the 
unlimited dimension, etc.  You then use this information to setup things like 
the count vector.  The fact that you don't know, apriori, the dimensionality 
of a variable suggests that general code will have to malloc space based on 
information you gather from the inquire type functions.  A reasonable example 
showing these techniques that you might want to look at is the source for 
ncdump.

Please let me know if there is anything I can do to help you.

Tom Yoksas