32#include <BESInternalError.h>
37#include "FONcAttributes.h"
48 : FONcBaseType(), _b(nullptr) {
49 _b =
dynamic_cast<Byte *
>(b);
51 string s = (
string)
"File out netcdf, FONcByte was passed a "
52 +
"variable that is not a DAP Byte";
73 D4Attributes *d4_attrs = _b->attributes();
74 updateD4AttrType(d4_attrs, NC_UBYTE);
77 AttrTable &attrs = _b->get_attr_table();
78 updateAttrType(attrs, NC_UBYTE);
99 BESDEBUG(
"fonc",
"FOncByte::write for var " << d_varname << endl);
104 _b->intern_data(*get_eval(), *get_dds());
109 unsigned char data = _b->value();
110 size_t var_index[] = {0};
111 int stax = nc_put_var1_uchar(ncid, d_varid, var_index, &data);
112 if (stax != NC_NOERR) {
113 string err =
string(
"fileout.netcdf - Failed to write byte data for ") + d_varname;
126 strm << BESIndent::LMarg <<
"FONcByte::dump - ("
127 << (
void *)
this <<
")" << endl;
129 strm << BESIndent::LMarg <<
"name = " << _b->name() << endl;
130 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 write(int ncid) override
Write the byte out to the netcdf file.
virtual void dump(ostream &strm) const override
dumps information about this object for debugging purposes
virtual void define(int ncid) override
define the DAP Byte in the netcdf file
FONcByte(libdap::BaseType *b)
Constructor for FONcByte that takes a DAP Byte.
static void handle_error(int stax, const string &err, const string &file, int line)
handle any netcdf errors