18class DerivedCoordVar_WRFTime;
56 virtual int initialize(
const vector<string> &paths,
const std::vector<string> &options);
106 virtual string getMapProjection()
const {
return (
"+proj=eqc +ellps=WGS84 +lon_0=0.0 +lat_0=0.0"); }
110 virtual bool getAtt(
string varname,
string attname, vector<double> &values)
const;
111 virtual bool getAtt(
string varname,
string attname, vector<long> &values)
const;
112 virtual bool getAtt(
string varname,
string attname,
string &values)
const;
124 virtual int getDimLensAtLevel(
string varname,
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
134 virtual int readRegion(
int fd,
const vector<size_t> &min,
const vector<size_t> &max,
float *region) {
return (_readRegionTemplate(fd, min, max, region)); }
135 virtual int readRegion(
int fd,
const vector<size_t> &min,
const vector<size_t> &max,
double *region) {
return (_readRegionTemplate(fd, min, max, region)); }
136 virtual int readRegion(
int fd,
const vector<size_t> &min,
const vector<size_t> &max,
int *region) {
return (_readRegionTemplate(fd, min, max, region)); }
140 virtual bool variableExists(
size_t ts,
string varname,
int reflevel = 0,
int lod = 0)
const;
150 MPASFileObject(
size_t ts,
string varname,
int level,
int lod,
int fd,
bool derivedFlag) : FileObject(ts, varname, level, lod, fd), _derivedFlag(derivedFlag) {}
152 bool GetDerivedFlag()
const {
return (_derivedFlag); }
158 std::map<string, DC::Dimension> _dimsMap;
159 std::map<string, DC::CoordVar> _coordVarsMap;
160 std::map<string, DC::Mesh> _meshMap;
161 std::map<string, DC::DataVar> _dataVarsMap;
162 std::map<string, DC::AuxVar> _auxVarsMap;
163 std::vector<string> _cellVars;
164 std::vector<string> _pointVars;
165 std::vector<string> _edgeVars;
170 int _InitDerivedVars(NetCDFCollection *ncdfc);
171 int _InitCoordvars(NetCDFCollection *ncdfc);
173 int _InitVerticalCoordinatesDerivedAtmosphere(NetCDFCollection *ncdfc);
174 int _InitVerticalCoordinatesDerivedOcean(NetCDFCollection *ncdfc);
176 int _CheckRequiredFields(NetCDFCollection *ncdfc)
const;
177 bool _HasVertical(NetCDFCollection *ncdfc)
const;
179 int _InitDimensions(NetCDFCollection *ncdfc);
181 int _GetVarCoordinates(NetCDFCollection *ncdfc,
string varname, vector<string> &sdimnames, vector<string> &scoordvars,
string &time_dim_name,
string &time_coordvar);
183 int _InitMeshes(NetCDFCollection *ncdfc);
184 int _InitAuxVars(NetCDFCollection *ncdfc);
185 int _InitDataVars(NetCDFCollection *ncdfc);
187 vector<string> _GetSpatialDimNames(NetCDFCollection *ncdfc,
string varname)
const;
189 bool _isAtmosphere(NetCDFCollection *ncdfc)
const;
190 bool _isOcean(NetCDFCollection *ncdfc)
const;
192 bool _isCoordVar(
string varname)
const;
193 bool _isDataVar(
string varname)
const;
195 int _read_nEdgesOnCell(
size_t ts);
196 void _addMissingFlag(
int *data)
const;
197 int _readVarToSmartBuf(
size_t ts,
string varname,
Wasp::SmartBuf &smartBuf);
198 int _readCoordinates(
size_t ts);
200 void _splitOnBoundary(
string varname,
int *connData)
const;
202 int _readRegionTransposed(MPASFileObject *w,
const vector<size_t> &min,
const vector<size_t> &max,
float *region);
204 int _readRegionEdgeVariable(MPASFileObject *w,
const vector<size_t> &min,
const vector<size_t> &max,
float *region);
206 template<
class T>
int _readRegionTemplate(
int fd,
const vector<size_t> &min,
const vector<size_t> &max, T *region);
208 template<
class T>
bool _getAttTemplate(
string varname,
string attname, T &values)
const;
212 class DerivedCoordVertFromCell :
public DerivedCoordVar {
214 DerivedCoordVertFromCell(
string derivedVarName,
string derivedDimName, DC *dc,
string inName,
string cellsOnVertexName);
218 bool GetBaseVarInfo(DC::BaseVar &var)
const;
220 bool GetCoordVarInfo(DC::CoordVar &cvar)
const;
222 virtual std::vector<string> GetInputs()
const {
return (std::vector<string>{_inName}); }
224 int GetDimLensAtLevel(
int, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
226 int OpenVariableRead(
size_t ts,
int,
int);
228 int CloseVariable(
int fd);
230 int ReadRegion(
int fd,
const vector<size_t> &min,
const vector<size_t> &max,
float *region);
232 bool VariableExists(
size_t ts,
int,
int)
const;
235 string _derivedDimName;
238 string _cellsOnVertexName;
239 DC::CoordVar _coordVarInfo;
241 float *_getCellData();
243 int *_getCellsOnVertex(
size_t i0,
size_t i1,
int &vertexDegree);
248 class DerivedZonalMeridonal :
public DerivedDataVar {
250 DerivedZonalMeridonal(
string derivedVarName, DC *dc, NetCDFCollection *ncdfc,
string normalVarName,
string tangentialVarName,
bool zonalFlag);
254 bool GetBaseVarInfo(DC::BaseVar &var)
const;
256 bool GetDataVarInfo(DC::DataVar &cvar)
const;
258 virtual std::vector<string> GetInputs()
const {
return (std::vector<string>{_normalVarName, _tangentialVarName}); }
260 int GetDimLensAtLevel(
int, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
262 int OpenVariableRead(
size_t ts,
int,
int);
264 int CloseVariable(
int fd);
266 int ReadRegion(
int fd,
const vector<size_t> &min,
const vector<size_t> &max,
float *region);
268 bool VariableExists(
size_t ts,
int,
int)
const;
272 NetCDFCollection *_ncdfc;
273 string _normalVarName;
274 string _tangentialVarName;
276 DC::DataVar _dataVarInfo;
Class for reading a NetCDF Climate Forecast (MPAS) data set stored as a series of NetCDF files.
virtual std::vector< string > getDimensionNames() const
virtual bool getDataVarInfo(string varname, DC::DataVar &datavar) const
virtual string getMapProjection() const
std::vector< string > getMeshNames() const
virtual bool getAtt(string varname, string attname, vector< double > &values) const
virtual std::vector< string > getDataVarNames() const
virtual int closeVariable(int fd)
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, float *region)
virtual std::vector< string > getAttNames(string varname) const
virtual bool getAtt(string varname, string attname, vector< long > &values) const
virtual bool getAuxVarInfo(string varname, DC::AuxVar &var) const
virtual bool variableExists(size_t ts, string varname, int reflevel=0, int lod=0) const
virtual bool getAtt(string varname, string attname, string &values) const
virtual bool getDimension(string dimname, DC::Dimension &dimension) const
virtual int getDimLensAtLevel(string varname, int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual size_t getNumRefLevels(string varname) const
virtual XType getAttType(string varname, string attname) const
virtual std::vector< string > getCoordVarNames() const
virtual int initialize(const vector< string > &paths, const std::vector< string > &options)
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, int *region)
virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const
virtual std::vector< string > getAuxVarNames() const
virtual int openVariableRead(size_t ts, string varname, int, int)
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, double *region)
virtual bool getBaseVarInfo(string varname, DC::BaseVar &var) const
virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvar) const
Auxiliary variable metadata.
Base class for storing variable metadata.
Coordinate variable metadata.
Metadata describing a named dimension length.
Metadata describing a computational mesh.
A Template Method design pattern for reading a collection of data.
XType
External storage types for primitive data.
Derived variables constructed from other variables.
Wrapper for a collection of netCDF files.
RENDER_API int Initialize(int *argc, char **argv)