This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>Organization: Institute for Stratospheric Chemistry(ICG-1), Institute for the >Chemistry and Dynamics of the Geosphere >Keywords: 199605231111.AA16583 Danny, > If I am most specific hopfillxy it should be clearer. > > What I would like to do is have a data structure that has at least two > dimentions. An unlimited time dimension and a parameter dimension that could > typically be between 50 and 300 in length. I would like to assign > each parameter with a dimension value that is a string i.e. H2O or HNO3 > or PV etc. Currently, netCDF only supports one variable-length dimension per file, the unlimited dimension. When another variable-length dimension is needed, e.g for "ragged arrays" with variable row-length, there are several approaches to simulating it: - Just use a maximum dimension (e.g. 300) for the rows and waste space for those variables needing less than the full 300. This can be unacceptable if the maximum dimension is much larger than the typical value, since it wastes so much space. - Instead of a two-dimensional variable, use two one-dimensional variables, one of which is an index into the other, that tells where each variable-length row should start. This saves space, but is inefficient if you later have to extend any rows or if the rows change sizes frequently, requiring some sort of garbage collection. - Use a different fixed dimension for each variable-sized row. As you have noted, this runs up against the arbitrary limit of 100 dimensions per file, and requires copying all the data if any of the row sizes ever change. - Use multiple files for multiple unlimited dimensions. This won't work if a single variable needs two variable dimensions. > My desire to do this was because I thought that if I had to define a dimension > for each parameter then I would quickly run foul of the limit(albeit > arbitrary) of 100 dimension. However I have now realised that what I can > easily do is just define each parameter to a variable that has the requisit > string for its name. The only limitation that this gives me is that it is > somewhat inelegent > and will be a little slow to place data into the data structure. So if there > is some > obvious way for me to achieve this please let me know however if it requires > any thought on your part then I think I have a method that will be adequate > so please do not go to too much trouble. That's another solution I hadn't thought of. I don't know any other obvious solutions with the current format. --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu