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

Re: (Fwd) Simple question WRT netCDF



Bill,

> -> A single ncrecput() call can write a block of data containing mixed
> -> types, so a series of of ncrecput() calls can probably do what you are
> -> attempting.  I have to qualify that with "probably" because I don't
> -> know all the constraints you are under, for example, whether it's
> -> possible for you to make "Ntotal" the record dimension for your
> -> dataset.
> 
> The file would consist of "Ntotal" elements where each element (record?)
> would be M bytes in size.  Presumably I will need to add data
> "attributes" to each record to allow the file to be self describing.  No?

No, netCDF attributes are assigned to netCDF variables, not records.
Records contain the data for record variables.  Record variables are
netCDF variables that use the unlimited (record) dimension.

If you declare the dimension Ntotal to be of size "unlimited", declare a
record variable of the appropriate type for each field you want included in
a record, and use ncrecput() you will be able to write data of multiple
types in a record with a single call.

However your nesting of structures will not be directly represented in the
netCDF file.  The best you can do with netCDF is a kind of flattened
structure where every component of the structure is a scalar or array of one
of the basic six netCDF types.

I don't think you can represent nested structures in CDF either.  You can
represent nested structures in HDF if you first "register" the structure to
get a tag assigned to it and then mark each record of the data with that
tag, but it's questionable whether such a file is really "self-describing".

Also, if you could represent nested structures in the data, a Fortran
program would not be able to read the data.

--Russ