Re: character dimensions, attribute lengths

Nan Galbraith <ngalbraith@xxxxxxxx> writes:

> My apologies, I didn't make this clear enough, or else I don't
> exactly understand the answer. They are specifying dimensions
> as a way to define the length of character attributes, not for data
> parameters.
>
> Dimensions: time, dept, lat, long, string256, ... string4
> Attributes:  Name      Definition               Example
>   DataType  char DataType(STRING32); Real-time PLATFORM  char
> PLATFORM (STRING8); "PIRATA"
>
> Do you think it is reasonable to include these string dimensions in
> the standard specification, when they are not dimensions of data
> parameters?

I'm a bit confused. (Nothing new, certainly!)

In netCDF you don't need dimensions for attributes. Every attribute is
a scalar or a one-dimensional array.

Here is the function prototype for writing an attribute which is an
array of integers, and may be written as any netCDF type:

EXTERNL int
nc_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
        size_t len, const int *op);

As you can see, there is no need (and no place) for any dimension IDs
in this function call. You provide an array of int as "op", it's
length in "len", and the type of the attribute in "xtype". (For
example, the most straightforward choice would be NC_INT, to write the
attributes as an array of ints.)

The same thing works for attributes which are arrays of NC_CHAR. They
don't need dimensions, just a length, which can be different for each
attribute.

Dimensions are only needed when defining (non-scalar) variables.

Ed
-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: