36 using std::ostringstream;
37 using std::istringstream;
45 #include <Structure.h>
52 #define ATTRIBUTE_SEPARATOR "."
53 #define FONC_ORIGINAL_NAME "fonc_original_name"
55 #define RETURNAS_NETCDF "netcdf"
56 #define RETURNAS_NETCDF4 "netcdf-4"
74 string s = (string)
"File out netcdf, " +
"null DDS passed to constructor";
77 if (localfile.empty()) {
78 string s = (string)
"File out netcdf, " +
"empty local file name passed to constructor";
81 _localfile = localfile;
83 _returnAs = ncVersion;
108 vector<FONcBaseType *>::iterator i = _fonc_vars.begin();
109 vector<FONcBaseType *>::iterator e = _fonc_vars.end();
138 DDS::Vars_iter vi = _dds->var_begin();
139 DDS::Vars_iter ve = _dds->var_end();
140 for (; vi != ve; vi++) {
141 if ((*vi)->send_p()) {
143 BESDEBUG(
"fonc",
"converting " << v->name() << endl);
145 fb->setVersion( FONcTransform::_returnAs );
146 _fonc_vars.push_back(fb);
147 vector<string> embed;
158 stax = nc_create(_localfile.c_str(), NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &_ncid);
161 stax = nc_create(_localfile.c_str(), NC_CLOBBER, &_ncid);
164 if (stax != NC_NOERR) {
165 string err = (string)
"File out netcdf, " +
"unable to open file " + _localfile;
177 vector<FONcBaseType *>::iterator i = _fonc_vars.begin();
178 vector<FONcBaseType *>::iterator e = _fonc_vars.end();
179 for (; i != e; i++) {
185 AttrTable &globals = _dds->get_attr_table();
186 BESDEBUG(
"fonc",
"Adding Global Attributes" << endl << globals << endl);
187 FONcAttributes::addattrs(_ncid, NC_GLOBAL, globals,
"",
"");
191 int stax = nc_enddef(_ncid);
195 if (stax != NC_NOERR) {
196 string err = (string)
"File out netcdf, " +
"unable to end the define mode " + _localfile;
201 i = _fonc_vars.begin();
202 e = _fonc_vars.end();
203 for (; i != e; i++) {
227 strm <<
BESIndent::LMarg <<
"FONcTransform::dump - (" << (
void *)
this <<
")" << endl;
232 vector<FONcBaseType *>::const_iterator i = _fonc_vars.begin();
233 vector<FONcBaseType *>::const_iterator e = _fonc_vars.end();
234 for (; i != e; i++) {
exception thrown if inernal error encountered
virtual void dump(ostream &strm) const =0
dump the contents of this object to the specified ostream
string get_container_type() const
retrieve the type of data this container holds, such as cedar or netcdf.
virtual void define(int ncid)
Define the variable in the netcdf file.
static string name_prefix
If a variable name, dimension name, or attribute name begins with a character that is not supported b...
Abstract exception class for the BES with basic string message.
static ostream & LMarg(ostream &strm)
static void handle_error(int stax, string &err, const string &file, int line)
handle any netcdf errors
static void reset()
Resets the FONc transformation for a new input and out file.
A DAP BaseType with file out netcdf information included.
Structure storing information used by the BES to handle the request.
void first_container()
set the container pointer to the first container in the containers list
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
static FONcBaseType * convert(BaseType *v)
creates a FONc object for the given DAP object
BESContainer * container
pointer to current container in this interface