32#include <BESInternalError.h>
34#include <libdap/Float64.h>
36#include "FONcDouble.h"
38#include "FONcAttributes.h"
49 : FONcBaseType(), _f(0) {
50 _f =
dynamic_cast<Float64 *
>(b);
52 string s = (
string)
"File out netcdf, FONcDouble was passed a "
53 +
"variable that is not a DAP Float64";
75 D4Attributes *d4_attrs = _f->attributes();
76 updateD4AttrType(d4_attrs, NC_DOUBLE);
79 AttrTable &attrs = _f->get_attr_table();
80 updateAttrType(attrs, NC_DOUBLE);
99 BESDEBUG(
"fonc",
"FONcDouble::write for var " << d_varname << endl);
104 _f->intern_data(*get_eval(), *get_dds());
106 double data = _f->value();
107 size_t var_index[] = {0};
108 int stax = nc_put_var1_double(ncid, d_varid, var_index, &data);
109 if (stax != NC_NOERR) {
110 string err = (
string)
"fileout.netcdf - "
111 +
"Failed to write double data for "
116 BESDEBUG(
"fonc",
"FONcDouble::done write for var " << d_varname << endl);
127 strm << BESIndent::LMarg <<
"FONcDouble::dump - ("
128 << (
void *)
this <<
")" << endl;
130 strm << BESIndent::LMarg <<
"name = " << _f->name() << endl;
131 BESIndent::UnIndent();
exception thrown if internal error encountered
static void add_original_name(int ncid, int varid, const string &var_name, const string &orig)
Adds an attribute for the variable if the variable name had to be modified in any way.
static void add_variable_attributes(int ncid, int varid, BaseType *b, bool is_netCDF_enhanced, bool is_dap4)
Add the attributes for an OPeNDAP variable to the netcdf file.
virtual void define(int ncid)
Define the variable in the netcdf file.
virtual void dump(ostream &strm) const override
dumps information about this object for debugging purposes
virtual void write(int ncid) override
Write the float64 out to the netcdf file.
virtual void define(int ncid) override
define the DAP Float64 in the netcdf file
FONcDouble(libdap::BaseType *b)
Constructor for FOncDouble that takes a DAP Float64.
static void handle_error(int stax, const string &err, const string &file, int line)
handle any netcdf errors