13class NetCDFCollection;
36 DerivedVar(
string varName) { _derivedVarName = varName; };
42 string GetName()
const {
return (_derivedVarName); }
46 virtual bool GetAtt(
string attname, std::vector<double> &values)
const
52 virtual bool GetAtt(
string attname, std::vector<long> &values)
const
58 virtual bool GetAtt(
string attname,
string &values)
const
64 virtual std::vector<string>
GetAttNames()
const {
return (std::vector<string>()); }
70 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const = 0;
72 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level,
long ts)
const {
return GetDimLensAtLevel(level, dims_at_level, bs_at_level); }
76 virtual std::vector<size_t>
GetCRatios()
const {
return (std::vector<size_t>(1, 1)); }
82 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region) = 0;
83 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
double *region);
91 int _getVar(
DC *dc,
size_t ts,
string varname,
int level,
int lod,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region)
const;
93 int _getVarDestagger(
DC *dc,
size_t ts,
string varname,
int level,
int lod,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region,
int stagDim)
const;
145 static bool ParseFormula(
string formula_terms, map<string, string> &parsed_terms);
162 static bool ValidFormula(
const vector<string> &required_terms,
string formula);
187 _factoryFunctionRegistry[name] = classFactoryFunction;
199 DerivedCFVertCoordVarFactory &operator=(
const DerivedCFVertCoordVarFactory &) {
return *
this; }
262 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{_lonName, _latName}); }
264 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
270 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
284 std::vector<size_t> _dimLens;
290 int _readRegionHelperCylindrical(
DC::FileTable::FileObject *f,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
291 int _readRegionHelper1D(
DC::FileTable::FileObject *f,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
292 int _readRegionHelper2D(
DC::FileTable::FileObject *f,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
316 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>()); }
318 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
319 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level,
long ts)
const;
325 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
347 DerivedCoordVar_CF2D(
string derivedVarName, std::vector<string> dimNames, std::vector<size_t> dimLens,
int axis,
string units,
const vector<float> &data);
356 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>()); }
358 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
364 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
369 std::vector<string> _dimNames;
370 std::vector<size_t> _dimLens;
371 std::vector<float> _data;
395 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{_wrfTimeVar}); }
397 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
403 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
405 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
double *region);
409 size_t TimeLookup(
size_t ts)
const {
return (ts < _timePerm.size() ? _timePerm[ts] : 0); }
413 std::vector<double> _times;
414 std::vector<int> _timePerm;
420 int _encodeTime(
UDUnits &udunits,
const vector<string> &timeStrings, vector<double> ×)
const;
443 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{_nativeTimeVar}); }
445 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
451 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
452 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
double *region);
456 const vector<double> &
GetTimes()
const {
return (_times); }
460 std::vector<double> _times;
461 string _nativeTimeVar;
488 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>()); }
490 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
496 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
500 const vector<double> &
GetTimes()
const {
return (_times); }
503 std::vector<double> _times;
518 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{_inName}); }
520 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
526 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
550 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{_inName}); }
552 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
558 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
564 string _unstagDimName;
582 virtual std::vector<string>
GetInputs()
const {
return (std::vector<string>{
"PH",
"PHB"}); }
584 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
588 virtual std::vector<size_t>
GetCRatios()
const {
return (_dc->GetCRatios(_PHVar)); }
594 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
630 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
634 virtual std::vector<size_t>
GetCRatios()
const {
return (std::vector<size_t>(1, 1)); }
640 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
647 string _standard_name;
656 bool _destaggerEtaXDim;
657 bool _destaggerEtaYDim;
658 bool _destaggerDepthXDim;
659 bool _destaggerDepthYDim;
662 int initialize_missing_values();
663 int initialize_stagger_flags();
664 void compute_g1(
const vector<size_t> &min,
const vector<size_t> &max,
const float *s,
const float *C,
const float *eta,
const float *depth,
float depth_c,
float *region)
const;
665 void compute_g2(
const vector<size_t> &min,
const vector<size_t> &max,
const float *s,
const float *C,
const float *eta,
const float *depth,
float depth_c,
float *region)
const;
691 virtual int GetDimLensAtLevel(
int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level)
const;
695 virtual std::vector<size_t>
GetCRatios()
const {
return (std::vector<size_t>(1, 1)); }
701 virtual int ReadRegion(
int fd,
const std::vector<size_t> &min,
const std::vector<size_t> &max,
float *region);
708 string _standard_name;
718 int initialize_missing_values();
719 void compute_a(
const vector<size_t> &min,
const vector<size_t> &max,
const float *a,
const float *b,
const float *ps,
float p0,
float *region)
const;
Base class for storing variable metadata.
Coordinate variable metadata.
A Template Method design pattern for reading a collection of data.
XType
External storage types for primitive data.
DerivedCFVertCoordVarFactoryRegistrar(string standard_name)
void RegisterFactoryFunction(string name, function< DerivedCFVertCoordVar *(DC *, string, string)> classFactoryFunction)
vector< string > GetFactoryNames() const
DerivedCFVertCoordVar * CreateInstance(string standard_name, DC *, string, string))
static DerivedCFVertCoordVarFactory * Instance()
Derived coordinate variable abstract class.
static bool ParseFormula(string formula_terms, map< string, string > &parsed_terms)
DerivedCFVertCoordVar(string varName, DC *dc, string mesh, string formula)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const =0
static bool ValidFormula(const vector< string > &required_terms, string formula)
virtual ~DerivedCFVertCoordVar()
Convert a CF parameterless vertical coordinate to an Ocean s-coordinate, generic form 1 or 2.
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
static bool ValidFormula(string formula)
virtual ~DerivedCoordVarStandardAHSPC()
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
DerivedCoordVarStandardAHSPC(DC *dc, string mesh, string formula)
virtual int CloseVariable(int fd)
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< size_t > GetCRatios() const
virtual std::vector< string > GetInputs() const
virtual size_t GetNumRefLevels() const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
Convert a CF parameterless vertical coordinate to an Ocean s-coordinate, generic form 1 or 2.
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int CloseVariable(int fd)
virtual std::vector< size_t > GetCRatios() const
static bool ValidFormula(string formula)
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
DerivedCoordVarStandardOceanSCoordinate(DC *dc, string mesh, string formula)
virtual std::vector< string > GetInputs() const
virtual ~DerivedCoordVarStandardOceanSCoordinate()
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual size_t GetNumRefLevels() const
virtual ~DerivedCoordVarStandardWRF_Terrain()
virtual std::vector< string > GetInputs() const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
DerivedCoordVarStandardWRF_Terrain(DC *dc, string mesh, string formula)
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
static bool ValidFormula(string formula)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual size_t GetNumRefLevels() const
virtual int CloseVariable(int fd)
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual std::vector< size_t > GetCRatios() const
Derived 1D CF conventions coordinate variable using grid coordinates.
virtual ~DerivedCoordVar_CF1D()
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level, long ts) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< string > GetInputs() const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
DerivedCoordVar_CF1D(string derivedVarName, DC *dc, string dimName, int axis, string units)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int CloseVariable(int fd)
Derived 2D CF conventions coordinate variable . Coordinates are provided by data, whose length must b...
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
DerivedCoordVar_CF2D(string derivedVarName, std::vector< string > dimNames, std::vector< size_t > dimLens, int axis, string units, const vector< float > &data)
virtual ~DerivedCoordVar_CF2D()
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< string > GetInputs() const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual int CloseVariable(int fd)
Derived PCS coordinate variable from lat-lon coordinate pairs.
virtual std::vector< string > GetInputs() const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
DerivedCoordVar_PCSFromLatLon(string derivedVarName, DC *dc, std::vector< string > inNames, string proj4String, bool uGridFlag, bool lonFlag)
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual ~DerivedCoordVar_PCSFromLatLon()
virtual int CloseVariable(int fd)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual std::vector< string > GetInputs() const
DerivedCoordVar_Staggered(string derivedVarName, string stagDimName, DC *dc, string inName, string dimName)
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual int CloseVariable(int fd)
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual ~DerivedCoordVar_Staggered()
Derived time coordinate variable.
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
DerivedCoordVar_TimeInSeconds(string derivedVarName, DC *dc, string nativeTimeVar, string dimName)
virtual ~DerivedCoordVar_TimeInSeconds()
virtual int CloseVariable(int fd)
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< string > GetInputs() const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, double *region)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
const vector< double > & GetTimes() const
Synthesize a time coordinate variable.
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual std::vector< string > GetInputs() const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual ~DerivedCoordVar_Time()
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual int CloseVariable(int fd)
DerivedCoordVar_Time(string derivedVarName, string dimName, size_t n)
const vector< double > & GetTimes() const
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual std::vector< string > GetInputs() const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual int CloseVariable(int fd)
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
DerivedCoordVar_UnStaggered(string derivedVarName, string unstagDimName, DC *dc, string inName, string dimName)
virtual ~DerivedCoordVar_UnStaggered()
Derived WRF Time coordinate variable.
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
virtual ~DerivedCoordVar_WRFTime()
DerivedCoordVar_WRFTime(string derivedVarName, NetCDFCollection *ncdfc, string wrfTimeVar, string dimName, float p2si=1.0)
size_t TimeLookup(size_t ts) const
virtual int CloseVariable(int fd)
virtual std::vector< string > GetInputs() const
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, double *region)
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual bool GetBaseVarInfo(DC::BaseVar &var) const
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
Derived coordinate variable abstract class.
DerivedCoordVar(string varName)
virtual ~DerivedCoordVar()
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const =0
Derived data variable abstract class.
virtual ~DerivedDataVar()
virtual bool GetDataVarInfo(DC::DataVar &cvar) const =0
DerivedDataVar(string varName)
Derived variable abstract class.
int _getVarDestagger(DC *dc, size_t ts, string varname, int level, int lod, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region, int stagDim) const
virtual bool GetAtt(string attname, std::vector< long > &values) const
virtual bool GetAtt(string attname, string &values) const
virtual std::vector< string > GetInputs() const =0
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level, long ts) const
virtual std::vector< string > GetAttNames() const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)=0
virtual DC::XType GetAttType(string attname) const
virtual bool GetAtt(string attname, std::vector< double > &values) const
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, double *region)
int _getVar(DC *dc, size_t ts, string varname, int level, int lod, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region) const
virtual size_t GetNumRefLevels() const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const =0
virtual std::vector< size_t > GetCRatios() const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)=0
virtual bool GetBaseVarInfo(DC::BaseVar &var) const =0
virtual int GetDimLensAtLevel(int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const =0
DerivedVar(string varName)
virtual int Initialize()=0
virtual int CloseVariable(int fd)=0
Wrapper for a collection of netCDF files.