bes
Updated for version 3.20.6
|
32 #include <BESInternalError.h>
36 #include "FONcUtils.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";
80 vector<FONcMap *>::iterator i = _maps.begin();
81 while (i != _maps.end()) {
107 BESDEBUG(
"fonc",
"FOncGrid::define - defining grid " << _varname << endl);
110 vector<FONcMap *>::iterator i = _maps.begin();
111 vector<FONcMap *>::iterator e = _maps.end();
112 for (; i != e; i++) {
122 BESDEBUG(
"fonc",
"FOncGrid::define - done defining grid " << _varname << endl);
145 FONcBaseType::convert(embed);
147 BESDEBUG(
"fonc",
"FONcGrid::convert - converting grid " << _varname << endl);
151 Grid::Map_iter mi = _grid->map_begin();
152 Grid::Map_iter me = _grid->map_end();
153 for (; mi != me; mi++) {
157 if ((*mi)->send_p()) {
159 Array *map =
dynamic_cast<Array *
>((*mi));
161 string err = (string)
"file out netcdf, grid " + _varname +
" map is not an array";
165 vector<string> map_embed;
167 FONcMap *map_found = FONcGrid::InMaps(map);
176 map_found =
new FONcMap(fa,
true);
187 _maps.push_back(map_found);
194 if (_grid->get_array()->send_p()) {
195 _arr =
new FONcArray(_grid->get_array());
199 BESDEBUG(
"fonc",
"FONcGrid::convert - done converting grid " << _varname << endl);
214 BESDEBUG(
"fonc",
"FOncGrid::define - writing grid " << _varname << endl);
218 vector<FONcMap *>::iterator i = _maps.begin();
219 vector<FONcMap *>::iterator e = _maps.end();
220 for (; i != e; i++) {
231 BESDEBUG(
"fonc",
"FOncGrid::define - done writing grid " << _varname << endl);
240 return _grid->name();
253 strm << BESIndent::LMarg <<
"FONcGrid::dump - (" << (
void *)
this <<
")" << endl;
255 strm << BESIndent::LMarg <<
"name = " << _grid->name() <<
" { " << endl;
257 strm << BESIndent::LMarg <<
"maps:";
261 vector<FONcMap *>::const_iterator i = _maps.begin();
262 vector<FONcMap *>::const_iterator e = _maps.end();
263 for (; i != e; i++) {
267 BESIndent::UnIndent();
270 strm <<
" empty" << endl;
272 BESIndent::UnIndent();
273 strm << BESIndent::LMarg <<
"}" << endl;
274 strm << BESIndent::LMarg <<
"array:";
279 BESIndent::UnIndent();
282 strm <<
" not set" << endl;
284 BESIndent::UnIndent();
288 FONcGrid::InMaps(Array *array)
294 for (; vi != ve && !found; vi++) {
299 found = map_found->
compare(array);
A DAP Array with file out netcdf information included.
FONcGrid(BaseType *b)
Constructor for FONcGrid that takes a DAP Grid.
static string gen_name(const vector< string > &embed, const string &name, string &original)
generate a new name for the embedded variable
A map of a DAP Grid with file out netcdf information included.
virtual void write(int ncid)
Write the array out to the netcdf file.
virtual void convert(vector< string > embed)
convert the DAP Grid to a set of embedded variables
virtual string name()
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 add_grid(const std::string &name)
Add the name of the grid as a grid that uses this map.
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
virtual bool compare(libdap::Array *arr)
a method to compare two grid maps, or possible grid maps.
virtual ~FONcGrid()
Destructor that cleans up the grid.
exception thrown if internal error encountered
A DAP BaseType with file out netcdf information included.
virtual void write(int ncid)
Write the maps and array for the grid.
virtual void dump(ostream &strm) const
dumps information about this object for debugging purposes
virtual void convert(std::vector< std::string > embed)
Converts the DAP Array to a FONcArray.
virtual void define(int ncid)
define the DAP Array in the netcdf file
virtual void clear_embedded()
clear the embedded names for the FONcArray kept by this instance
static bool InGrid
tells whether we are converting or defining a grid.
virtual void define(int ncid)
define the DAP Grid in the netcdf file
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes