32#include <BESInternalError.h>
34#include <libdap/Int16.h>
35#include <libdap/Byte.h>
39#include "FONcAttributes.h"
52 Int16 *i16 =
dynamic_cast<Int16 *
>(b);
54 string s = (string)
"File out netcdf, FONcShort was passed a "
55 +
"variable that is not a DAP Int16";
58 _unsigned_int8 =
false;
67 string s = (string)
"File out netcdf, FONcShort was passed a "
68 +
"variable that is not a DAP Int16";
75 string s = (string)
"File out netcdf, FONcShort was passed a "
76 +
"variable that is not a DAP Byte";
110 D4Attributes *d4_attrs = _bt->attributes();
111 updateD4AttrType(d4_attrs,NC_SHORT);
114 AttrTable &attrs = _bt->get_attr_table();
115 updateAttrType(attrs,NC_SHORT);
121 _varname, _orig_varname ) ;
139 BESDEBUG(
"fonc",
"FONcShort::write for var " << _varname << endl);
140 size_t var_index[] = {0};
146 _bt->intern_data(*get_eval(), *get_dds());
149 unsigned char *data_8 =
new unsigned char;
150 _bt->buf2val((
void **) &data_8);
151 short temp_8 = (short)(*data_8);
152 stax = nc_put_var1_short(ncid, _varid, var_index, &temp_8);
156 short *data =
new short;
157 _bt->buf2val((
void **) &data);
158 stax = nc_put_var1_short(ncid, _varid, var_index, data);
161 if (stax != NC_NOERR) {
162 string err = (string)
"fileout.netcdf - "
163 +
"Failed to write short data for "
167 BESDEBUG(
"fonc",
"FONcShort::done write for var " << _varname << endl);
199 strm << BESIndent::LMarg <<
"FONcShort::dump - ("
200 << (
void *)
this <<
")" << endl;
202 strm << BESIndent::LMarg <<
"name = " << _bt->name() << endl;
203 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.
A DAP BaseType with file out netcdf information included.
virtual void define(int ncid)
Define the variable in the netcdf file.
virtual string name()
returns the name of the DAP Int16 or UInt16
FONcShort(BaseType *b)
Constructor for FOncShort that takes a DAP Int16 or UInt16.
virtual void define(int ncid)
define the DAP Int16 or UInt16 in the netcdf file
virtual nc_type type()
returns the netcdf type of the DAP object
virtual void dump(ostream &strm) const
dumps information about this object for debugging purposes
virtual ~FONcShort()
Destructor that cleans up the short.
virtual void write(int ncid)
Write the short out to the netcdf file.
static void handle_error(int stax, const string &err, const string &file, int line)
handle any netcdf errors