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.
Neil, Did you remember to call nc_enddef(ncfileid) after defining your dimension and variable? Did you remember to call nc_close(ncfileid) after writing-out the data value? Regards, Steve Emmerson <http://www.unidata.ucar.edu> > To: address@hidden > From: Neil David Adams <address@hidden> > Subject: NC_UNLIMITED > Organization: UCAR/Unidata > Keywords: 200105030111.f431BTp21774 > > I'm having a hassle with the UNLIMITED dimension definition. I've > used nc_def_dim to define my time variable as UNLIMITED but this sets the > dimension to 0 and will then not write any data to disk that uses time as > a dimension. So I'm confused as to how I go about setting time as an > UNLIMITED dimension but giving it a dimensional value other than zero so I > can actually write data to to the file. My code lines are as follows : > > status = nc_def_dim(ncfileid,"time",NC_UNLIMITED,&timid); > dimids1[0] = timid; > status = nc_def_var(ncfileid,"time",NC_FLOAT,1,dimids1,&timid); > timestep = 0.0; > status = nc_put_var_float(ncfileid,timid,×tep); > > At this stage no value is actually written out for the variable > "time". When I use ncdump to look at the file created all the dimensions > are defined but with time = UNLIMITED; // currently 0 > > all variables that don't have time as a dimension are written out to disk > ok. > > Cheers > Neil > > -- > _____________________________________________________________________ > Neil Adams, Senior Meteorologist > Antarctic CRC and Bureau of Meteorology > Email: address@hidden Ph : Australia (08) 83662686 > Post: Bureau of Meteorology > PO Box 421 > Kent Town, SA > Australia 5071 > _____________________________________________________________________