32#include <BESInternalError.h>
37#include "FONcAttributes.h"
62 _grid =
dynamic_cast<Grid *
>(b);
64 string s = (
string)
"File out netcdf, FONcGrid was passed a " +
"variable that is not a DAP Grid";
81 while (i != _maps.end()) {
107 BESDEBUG(
"fonc",
"FOncGrid::define - defining grid " << d_varname << endl);
109 for (
auto map: _maps)
118 BESDEBUG(
"fonc",
"FOncGrid::define - done defining grid " << d_varname << endl);
141 FONcBaseType::convert(embed, _dap4, is_dap4_group);
142 BESDEBUG(
"fonc",
"FONcGrid:: version: '" << d_ncVersion <<
"'" << endl);
144 BESDEBUG(
"fonc",
"FONcGrid::convert - converting grid " << d_varname << endl);
148 Grid::Map_iter mi = _grid->map_begin();
149 Grid::Map_iter me = _grid->map_end();
150 for (; mi != me; mi++) {
154 if ((*mi)->send_p()) {
156 Array *
map =
dynamic_cast<Array *
>((*mi));
158 string err = (
string)
"file out netcdf, grid " + d_varname +
" map is not an array";
166 map->intern_data(*get_eval(), *get_dds());
168 if (d_is_dap4 || get_eval() ==
nullptr || get_dds() ==
nullptr)
171 map->intern_data(*get_eval(), *get_dds());
183 fa->
convert(map_embed, _dap4,is_dap4_group);
184 map_found =
new FONcMap(fa,
true);
195 _maps.push_back(map_found);
202 if (_grid->get_array()->send_p()) {
203 _arr =
new FONcArray(_grid->get_array());
204 _arr->setVersion(d_ncVersion);
205 _arr->setNC4DataModel(d_nc4_datamodel);
207 _arr->convert(d_embed, _dap4, is_dap4_group);
210 BESDEBUG(
"fonc",
"FONcGrid::convert - done converting grid " << d_varname << endl);
225 BESDEBUG(
"fonc",
"FOncGrid::define - writing grid " << d_varname << endl);
231 for (; i != e; i++) {
242 BESDEBUG(
"fonc",
"FOncGrid::define - done writing grid " << d_varname << endl);
251 return _grid->name();
264 strm << BESIndent::LMarg <<
"FONcGrid::dump - (" << (
void *)
this <<
")" << endl;
266 strm << BESIndent::LMarg <<
"name = " << _grid->name() <<
" { " << endl;
268 strm << BESIndent::LMarg <<
"maps:";
274 for (; i != e; i++) {
278 BESIndent::UnIndent();
281 strm <<
" empty" << endl;
283 BESIndent::UnIndent();
284 strm << BESIndent::LMarg <<
"}" << endl;
285 strm << BESIndent::LMarg <<
"array:";
290 BESIndent::UnIndent();
293 strm <<
" not set" << endl;
295 BESIndent::UnIndent();
299FONcGrid::InMaps(Array *array)
305 for (; vi != ve && !found; vi++) {
310 found = map_found->
compare(array);
exception thrown if internal error encountered
A DAP Array with file out netcdf information included.
virtual void convert(std::vector< std::string > embed, bool _dap4=false, bool is_dap4_group=false) override
Converts the DAP Array to a FONcArray.
virtual void setNC4DataModel(const string &nc4_datamodel)
Identifies the netCDF4 data model (CLASSIC or ENHANCED)
virtual void setVersion(const std::string &version)
Identifies variable with use of NetCDF4 features.
FONcGrid(libdap::BaseType *b)
Constructor for FONcGrid that takes a DAP Grid.
virtual ~FONcGrid()
Destructor that cleans up the grid.
virtual void define(int ncid) override
define the DAP Grid in the netcdf file
virtual void convert(vector< string > embed, bool _dap4, bool is_dap4_group) override
convert the DAP Grid to a set of embedded variables
string name() override
returns the name of the DAP Grid
static vector< FONcMap * > Maps
global list of maps that could be shared amongst the different grids
virtual void write(int ncid) override
Write the maps and array for the grid.
static bool InGrid
tells whether we are converting or defining a grid.
virtual void dump(ostream &strm) const override
dumps information about this object for debugging purposes
A map of a DAP Grid with file out netcdf information included.
virtual void clear_embedded()
clear the embedded names for the FONcArray kept by this instance
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
virtual void add_grid(const std::string &name)
Add the name of the grid as a grid that uses this map.
virtual bool compare(libdap::Array *arr)
a method to compare two grid maps, or possible grid maps.
static string gen_name(const vector< string > &embed, const string &name, string &original)
generate a new name for the embedded variable