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.
>To: address@hidden >From: James Adams <address@hidden> >Subject: Re: Problem putting data to variables >Organization: ? >Keywords: 200207240011.g6O0B2917202 netCDF Hi James, > As it turns out the "Time" coordinate variable info is > being modified by my writing of normal variable data. > If I don't put any variable data to the file then the > "Time" coordinate variable stays at zero and no values > are shown for this coordinate. It turns out that the > nc_put_vara_float() that I am using to populate the > variables is what incremented the "Time" count. The > nc_put_var_float() call to populate the "Time" > coordinate variable with values just doesn't work, > even though it doesn't produce an exception or show > any other signs of failure. This approach works for > populating the other three coordinate variables but > not with "Time" which has a NC_UNLIMITED dimension. > Still no clue on why this is a special case and not > working like the other calls using coordinate > variables with normal (limited) dimensions > > Is there any document which explains or gives an > example of how to correctly define and then populate > coordinate variables ? This really shouldn't be so > difficult and could probably be explained with a few > lines of valid code. In the netCDF User's Guide for Fortran 90 (and soon to be added to the other netCDF User's Guides as well) there is the following explanation of why you shouldn't use the simplest netCDF interface to write arrays that use the NC_UNLIMITED (or record) dimension: Take care when using the simplest forms of this interface with record variables when you don't specify how many records are to be written. If you try to write all the values of a record variable into a netCDF file that has no record data yet (hence has 0 records), nothing will be written. Similarly, if you try to write all of a record variable but there are more records in the file than you assume, more data may be written to the file than you supply, which may result in a segmentation violation. Here are a couple of previous support responses dealing with this issue http://www.unidata.ucar.edu/cgi-bin/mfs/70/4293 http://www.unidata.ucar.edu/cgi-bin/mfs/70/4679 This apparently should be documented more clearly, and I should also add it to the FAQ list of frequently asked questions, since several users have indicated that it's a problem. > Are there any NetCDF user mailing lists which I could > post this sort of question ? It appears that ncdigest > isn't really appropriate for user questions such as > this, but I am at a loss to find any other sources of > information/help (which is why I am pestering this > address with so many questions). This (address@hidden) is the right address to use for such questions. And we don't mind being pestered, especially when we forget or neglect to answer a well-posed question such as yours ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu