34using std::ostringstream;
41int FONcDim::DimNameNum = 0;
50 _name(name), _size(size), _dimid(0), _defined(false), _ref(1)
64 if (!_ref)
delete this;
83 ostringstream dimname_strm;
84 dimname_strm <<
"dim" << FONcDim::DimNameNum + 1;
85 FONcDim::DimNameNum++;
86 _name = dimname_strm.str();
91 int stax = nc_def_dim(ncid, _name.c_str(), _size, &_dimid);
92 if (stax != NC_NOERR) {
93 string err = (string)
"fileout.netcdf - " +
"Failed to add dimension " + _name;
108 strm << BESIndent::LMarg <<
"FONcDim::dump - (" << (
void *)
this <<
")" << endl;
110 strm << BESIndent::LMarg <<
"name = " << _name << endl;
111 strm << BESIndent::LMarg <<
"size = " << _size << endl;
112 strm << BESIndent::LMarg <<
"dimid = " << _dimid << endl;
113 strm << BESIndent::LMarg <<
"already defined? ";
119 BESIndent::UnIndent();
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
virtual void define(int ncid)
define the DAP dimension in the netcdf file
virtual void decref()
Decrement the reference count for this dimension.
FONcDim(const std::string &name, int size)
Constructor for FOncDim that defines the dimension of an array.
static void handle_error(int stax, const string &err, const string &file, int line)
handle any netcdf errors
static string id2netcdf(string in)
convert the provided string to a netcdf allowed identifier.