netcdfquestions

Daniel Packman (pack@acd.ucar.edu)
Mon, 13 Jan 92 15:15:14 -0700

	
> Is it possible and/or permitted in netCDF to have multidimensional 
> coordinate variables and attributes?

 Short answer to both is yes.  Longer answer is other people may not
know what you mean since the dataset will become a bit less self
describing.
	
> Here are two examples of what I'm talking about. First lets say I've
> divided up the globe into 90 regions each having the same amount of elements
> in the lat direction and the lon direction. The shape of the variable would
> thus be (90,36,72) and the dimension names would be (region,lat,lon).
> Now here is what I'm getting at. The lat and lon coordinates are different
> for each region. A one dimensional coordinate variable for the dimensions lat
> and lon will not cut it.  However, a two dimensional one would with a shape
> of (90,36) for lat and (90,72) for lon, would work. I haven't ever seen 
> any files with this organization. Is this legal?

Quite legal to have a *variable* with dimension (90,36,72).  Each dimension
may or may not have a *variable* associated with it.  This association is
achieved simply by having a variable of the same name as the dimension.
In our datasets we do not often have this implicit association.  You are
free to assign a variable of the same name as a dimension any fixed
dimensions.  What this variable means depends on interpretation.

	
> The second example concerns attributes. Lets say I have a 3D array and rather 
>than store the variable attributes min and max for the whole array. I'd like to
> have a variable attribute that stores an array of mins and maxs for individual
> 2D slices.  Is this resonable and legal? How are the dimensions of attributes
> stored? The attribute section of the netCDF guide shows attributes only having
> a type and a length, no dimensions.

Attributes have a "length" which translates to a singly dimensioned quantity.
You are free to increase this single dimension to essentially include multiple
dimensions, but the subscripting into this array and its ultimate interpretation
will have to be known by subsequent software.  If you define attributes
"mins" and "maxs", for example and say these are to apply to array(90,36,72)
where mins(90) correspond to each of the 90 two dimensional 36x72 arrays,
then things are fine.  But this is not the only way these attributes could
correspond and their correspondance would have to be understood by software
presented with this data.