VAPOR3 3.9.4
DerivedVar.h
Go to the documentation of this file.
1#include <iostream>
2#include <functional>
3#include <vapor/DC.h>
4#include <vapor/MyBase.h>
5#include <vapor/Proj4API.h>
7
8#ifndef _DERIVEDVAR_H_
9 #define _DERIVEDVAR_H_
10
11namespace VAPoR {
12
13class NetCDFCollection;
14
35public:
36 DerivedVar(string varName) { _derivedVarName = varName; };
37
38 virtual ~DerivedVar() {}
39
40 virtual int Initialize() = 0;
41
42 string GetName() const { return (_derivedVarName); }
43
44 virtual bool GetBaseVarInfo(DC::BaseVar &var) const = 0;
45
46 virtual bool GetAtt(string attname, std::vector<double> &values) const
47 {
48 values.clear();
49 return (false);
50 }
51
52 virtual bool GetAtt(string attname, std::vector<long> &values) const
53 {
54 values.clear();
55 return (false);
56 }
57
58 virtual bool GetAtt(string attname, string &values) const
59 {
60 values.clear();
61 return (false);
62 }
63
64 virtual std::vector<string> GetAttNames() const { return (std::vector<string>()); }
65
66 virtual DC::XType GetAttType(string attname) const { return (DC::INVALID); }
67
68 virtual std::vector<string> GetInputs() const = 0;
69
70 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const = 0;
71
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); }
73
74 virtual size_t GetNumRefLevels() const { return (1); }
75
76 virtual std::vector<size_t> GetCRatios() const { return (std::vector<size_t>(1, 1)); }
77
78 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0) = 0;
79
80 virtual int CloseVariable(int fd) = 0;
81
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);
84
85 virtual bool VariableExists(size_t ts, int reflevel, int lod) const = 0;
86
87protected:
90
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;
92
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;
94
95};
96
107public:
108 DerivedCoordVar(string varName) : DerivedVar(varName) {}
109 virtual ~DerivedCoordVar() {}
110
111 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const = 0;
112};
113
124public:
125 DerivedCFVertCoordVar(string varName, DC *dc, string mesh, string formula) : DerivedCoordVar(varName), _dc(dc), _mesh(mesh), _formula(formula) {}
126
128
129 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const = 0;
130
145 static bool ParseFormula(string formula_terms, map<string, string> &parsed_terms);
146
162 static bool ValidFormula(const vector<string> &required_terms, string formula);
163
164protected:
166 string _mesh;
167 string _formula;
168};
169
171//
172// DerivedCFVertCoordVarFactory Class
173//
175
177public:
179 {
180 static DerivedCFVertCoordVarFactory instance;
181 return &instance;
182 }
183
184 void RegisterFactoryFunction(string name, function<DerivedCFVertCoordVar *(DC *, string, string)> classFactoryFunction)
185 {
186 // register the class factory function
187 _factoryFunctionRegistry[name] = classFactoryFunction;
188 }
189
190 DerivedCFVertCoordVar *(CreateInstance(string standard_name, DC *, string, string));
191
192 vector<string> GetFactoryNames() const;
193
194private:
195 map<string, function<DerivedCFVertCoordVar *(DC *, string, string)>> _factoryFunctionRegistry;
196
199 DerivedCFVertCoordVarFactory &operator=(const DerivedCFVertCoordVarFactory &) { return *this; }
200};
201
203//
204// DerivedCFVertCoordVarFactoryRegistrar Class
205//
206// Register DerivedCFVertCoordVar derived class with:
207//
208// static DerivedCFVertCoordVarFactoryRegistrar<class> registrar("standard_name");
209//
210// where 'class' is a class derived from 'DerivedCFVertCoordVar', and
211// "standard_name" is the value of the CF "standard_name" attribute.
212//
214
216public:
218 {
219 // register the class factory function
220 //
221 DerivedCFVertCoordVarFactory::Instance()->RegisterFactoryFunction(standard_name, [](DC *dc, string mesh, string formula) -> DerivedCFVertCoordVar * { return new T(dc, mesh, formula); });
222 }
223};
224
235public:
236 DerivedDataVar(string varName) : DerivedVar(varName) {}
237 virtual ~DerivedDataVar() {}
238
239 virtual bool GetDataVarInfo(DC::DataVar &cvar) const = 0;
240};
241
252public:
253 DerivedCoordVar_PCSFromLatLon(string derivedVarName, DC *dc, std::vector<string> inNames, string proj4String, bool uGridFlag, bool lonFlag);
255
256 virtual int Initialize();
257
258 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
259
260 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
261
262 virtual std::vector<string> GetInputs() const { return (std::vector<string>{_lonName, _latName}); }
263
264 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
265
266 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
267
268 virtual int CloseVariable(int fd);
269
270 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
271
272 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
273
274private:
275 DC * _dc;
276 string _proj4String;
277 string _lonName;
278 string _latName;
279 string _xCoordName;
280 string _yCoordName;
281 bool _make2DFlag;
282 bool _uGridFlag;
283 bool _lonFlag;
284 std::vector<size_t> _dimLens;
285 Proj4API _proj4API;
286 DC::CoordVar _coordVarInfo;
287
288 int _setupVar();
289
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);
293};
294
306public:
307 DerivedCoordVar_CF1D(string derivedVarName, DC *dc, string dimName, int axis, string units);
309
310 virtual int Initialize();
311
312 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
313
314 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
315
316 virtual std::vector<string> GetInputs() const { return (std::vector<string>()); }
317
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;
320
321 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
322
323 virtual int CloseVariable(int fd);
324
325 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
326
327 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
328
329private:
330 DC * _dc;
331 string _dimName;
332 DC::CoordVar _coordVarInfo;
333};
334
346public:
347 DerivedCoordVar_CF2D(string derivedVarName, std::vector<string> dimNames, std::vector<size_t> dimLens, int axis, string units, const vector<float> &data);
349
350 virtual int Initialize();
351
352 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
353
354 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
355
356 virtual std::vector<string> GetInputs() const { return (std::vector<string>()); }
357
358 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
359
360 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
361
362 virtual int CloseVariable(int fd);
363
364 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
365
366 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
367
368private:
369 std::vector<string> _dimNames;
370 std::vector<size_t> _dimLens;
371 std::vector<float> _data;
372 DC::CoordVar _coordVarInfo;
373};
374
385public:
386 DerivedCoordVar_WRFTime(string derivedVarName, NetCDFCollection *ncdfc, string wrfTimeVar, string dimName, float p2si = 1.0);
388
389 virtual int Initialize();
390
391 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
392
393 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
394
395 virtual std::vector<string> GetInputs() const { return (std::vector<string>{_wrfTimeVar}); }
396
397 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
398
399 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
400
401 virtual int CloseVariable(int fd);
402
403 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
404
405 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, double *region);
406
407 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
408
409 size_t TimeLookup(size_t ts) const { return (ts < _timePerm.size() ? _timePerm[ts] : 0); }
410
411private:
412 NetCDFCollection * _ncdfc;
413 std::vector<double> _times;
414 std::vector<int> _timePerm;
415 string _wrfTimeVar;
416 float _p2si;
417 size_t _ovr_ts;
418 DC::CoordVar _coordVarInfo;
419
420 int _encodeTime(UDUnits &udunits, const vector<string> &timeStrings, vector<double> &times) const;
421};
422
433public:
434 DerivedCoordVar_TimeInSeconds(string derivedVarName, DC *dc, string nativeTimeVar, string dimName);
436
437 virtual int Initialize();
438
439 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
440
441 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
442
443 virtual std::vector<string> GetInputs() const { return (std::vector<string>{_nativeTimeVar}); }
444
445 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
446
447 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
448
449 virtual int CloseVariable(int fd);
450
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);
453
454 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
455
456 const vector<double> &GetTimes() const { return (_times); }
457
458private:
459 DC * _dc;
460 std::vector<double> _times;
461 string _nativeTimeVar;
462 DC::CoordVar _coordVarInfo;
463};
464
478public:
479 DerivedCoordVar_Time(string derivedVarName, string dimName, size_t n);
481
482 virtual int Initialize();
483
484 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
485
486 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
487
488 virtual std::vector<string> GetInputs() const { return (std::vector<string>()); }
489
490 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
491
492 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
493
494 virtual int CloseVariable(int fd);
495
496 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
497
498 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
499
500 const vector<double> &GetTimes() const { return (_times); }
501
502private:
503 std::vector<double> _times;
504 DC::CoordVar _coordVarInfo;
505};
506
508public:
509 DerivedCoordVar_Staggered(string derivedVarName, string stagDimName, DC *dc, string inName, string dimName);
511
512 virtual int Initialize();
513
514 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
515
516 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
517
518 virtual std::vector<string> GetInputs() const { return (std::vector<string>{_inName}); }
519
520 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
521
522 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
523
524 virtual int CloseVariable(int fd);
525
526 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
527
528 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
529
530private:
531 string _inName;
532 string _stagDimName;
533 string _dimName;
534 DC * _dc;
535 DC::CoordVar _coordVarInfo;
536 int _stagDim;
537};
538
540public:
541 DerivedCoordVar_UnStaggered(string derivedVarName, string unstagDimName, DC *dc, string inName, string dimName);
543
544 virtual int Initialize();
545
546 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
547
548 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
549
550 virtual std::vector<string> GetInputs() const { return (std::vector<string>{_inName}); }
551
552 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
553
554 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
555
556 virtual int CloseVariable(int fd);
557
558 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
559
560 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
561
562private:
563 string _inName;
564 string _unstagDimName;
565 string _dimName;
566 DC * _dc;
567 DC::CoordVar _coordVarInfo;
568 int _stagDim;
569};
570
572public:
573 DerivedCoordVarStandardWRF_Terrain(DC *dc, string mesh, string formula);
575
576 virtual int Initialize();
577
578 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
579
580 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
581
582 virtual std::vector<string> GetInputs() const { return (std::vector<string>{"PH", "PHB"}); }
583
584 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
585
586 virtual size_t GetNumRefLevels() const { return (_dc->GetNumRefLevels(_PHVar)); }
587
588 virtual std::vector<size_t> GetCRatios() const { return (_dc->GetCRatios(_PHVar)); }
589
590 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
591
592 virtual int CloseVariable(int fd);
593
594 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
595
596 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
597
598 static bool ValidFormula(string formula);
599
600private:
601 string _PHVar;
602 string _PHBVar;
603 float _grav;
604 DC::CoordVar _coordVarInfo;
605};
606
616//
618public:
619 DerivedCoordVarStandardOceanSCoordinate(DC *dc, string mesh, string formula);
621
622 virtual int Initialize();
623
624 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
625
626 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
627
628 virtual std::vector<string> GetInputs() const;
629
630 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
631
632 virtual size_t GetNumRefLevels() const { return (1); }
633
634 virtual std::vector<size_t> GetCRatios() const { return (std::vector<size_t>(1, 1)); }
635
636 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
637
638 virtual int CloseVariable(int fd);
639
640 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
641
642 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
643
644 static bool ValidFormula(string formula);
645
646private:
647 string _standard_name;
648 string _sVar;
649 string _CVar;
650 string _etaVar;
651 string _depthVar;
652 string _depth_cVar;
653 double _CVarMV;
654 double _etaVarMV;
655 double _depthVarMV;
656 bool _destaggerEtaXDim;
657 bool _destaggerEtaYDim;
658 bool _destaggerDepthXDim;
659 bool _destaggerDepthYDim;
660 DC::CoordVar _coordVarInfo;
661
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;
666};
667
677//
679public:
680 DerivedCoordVarStandardAHSPC(DC *dc, string mesh, string formula);
682
683 virtual int Initialize();
684
685 virtual bool GetBaseVarInfo(DC::BaseVar &var) const;
686
687 virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const;
688
689 virtual std::vector<string> GetInputs() const;
690
691 virtual int GetDimLensAtLevel(int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
692
693 virtual size_t GetNumRefLevels() const { return (1); }
694
695 virtual std::vector<size_t> GetCRatios() const { return (std::vector<size_t>(1, 1)); }
696
697 virtual int OpenVariableRead(size_t ts, int level = 0, int lod = 0);
698
699 virtual int CloseVariable(int fd);
700
701 virtual int ReadRegion(int fd, const std::vector<size_t> &min, const std::vector<size_t> &max, float *region);
702
703 virtual bool VariableExists(size_t ts, int reflevel, int lod) const;
704
705 static bool ValidFormula(string formula);
706
707private:
708 string _standard_name;
709 string _aVar;
710 string _apVar;
711 string _bVar;
712 string _p0Var;
713 string _psVar;
714 double _psVarMV;
715
716 DC::CoordVar _coordVarInfo;
717
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;
720};
721
722}; // namespace VAPoR
723
724#endif
Base class for storing variable metadata.
Definition: DC.h:754
Coordinate variable metadata.
Definition: DC.h:881
Data variable metadata.
Definition: DC.h:987
A Template Method design pattern for reading a collection of data.
Definition: DC.h:150
XType
External storage types for primitive data.
Definition: DC.h:154
DerivedCFVertCoordVarFactoryRegistrar(string standard_name)
Definition: DerivedVar.h:217
void RegisterFactoryFunction(string name, function< DerivedCFVertCoordVar *(DC *, string, string)> classFactoryFunction)
Definition: DerivedVar.h:184
vector< string > GetFactoryNames() const
DerivedCFVertCoordVar * CreateInstance(string standard_name, DC *, string, string))
static DerivedCFVertCoordVarFactory * Instance()
Definition: DerivedVar.h:178
Derived coordinate variable abstract class.
Definition: DerivedVar.h:123
static bool ParseFormula(string formula_terms, map< string, string > &parsed_terms)
DerivedCFVertCoordVar(string varName, DC *dc, string mesh, string formula)
Definition: DerivedVar.h:125
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const =0
static bool ValidFormula(const vector< string > &required_terms, string formula)
Convert a CF parameterless vertical coordinate to an Ocean s-coordinate, generic form 1 or 2.
Definition: DerivedVar.h:678
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 bool GetBaseVarInfo(DC::BaseVar &var) const
DerivedCoordVarStandardAHSPC(DC *dc, string mesh, string formula)
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< size_t > GetCRatios() const
Definition: DerivedVar.h:695
virtual std::vector< string > GetInputs() const
virtual size_t GetNumRefLevels() const
Definition: DerivedVar.h:693
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.
Definition: DerivedVar.h:617
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 std::vector< size_t > GetCRatios() const
Definition: DerivedVar.h:634
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 bool GetBaseVarInfo(DC::BaseVar &var) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:582
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
Definition: DerivedVar.h:586
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
Definition: DerivedVar.h:588
Derived 1D CF conventions coordinate variable using grid coordinates.
Definition: DerivedVar.h:305
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
Definition: DerivedVar.h:316
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...
Definition: DerivedVar.h:345
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 bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:356
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.
Definition: DerivedVar.h:251
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:262
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 bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual int OpenVariableRead(size_t ts, int level=0, int lod=0)
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:518
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)
Derived time coordinate variable.
Definition: DerivedVar.h:432
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 bool VariableExists(size_t ts, int reflevel, int lod) const
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:443
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
Definition: DerivedVar.h:456
Synthesize a time coordinate variable.
Definition: DerivedVar.h:477
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
Definition: DerivedVar.h:488
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 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
Definition: DerivedVar.h:500
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:550
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)
Derived WRF Time coordinate variable.
Definition: DerivedVar.h:384
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)
DerivedCoordVar_WRFTime(string derivedVarName, NetCDFCollection *ncdfc, string wrfTimeVar, string dimName, float p2si=1.0)
size_t TimeLookup(size_t ts) const
Definition: DerivedVar.h:409
virtual int CloseVariable(int fd)
virtual std::vector< string > GetInputs() const
Definition: DerivedVar.h:395
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.
Definition: DerivedVar.h:106
DerivedCoordVar(string varName)
Definition: DerivedVar.h:108
virtual ~DerivedCoordVar()
Definition: DerivedVar.h:109
virtual bool GetCoordVarInfo(DC::CoordVar &cvar) const =0
Derived data variable abstract class.
Definition: DerivedVar.h:234
virtual ~DerivedDataVar()
Definition: DerivedVar.h:237
virtual bool GetDataVarInfo(DC::DataVar &cvar) const =0
DerivedDataVar(string varName)
Definition: DerivedVar.h:236
Derived variable abstract class.
Definition: DerivedVar.h:34
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
Definition: DerivedVar.h:52
virtual bool GetAtt(string attname, string &values) const
Definition: DerivedVar.h:58
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
Definition: DerivedVar.h:72
virtual std::vector< string > GetAttNames() const
Definition: DerivedVar.h:64
virtual int ReadRegion(int fd, const std::vector< size_t > &min, const std::vector< size_t > &max, float *region)=0
virtual ~DerivedVar()
Definition: DerivedVar.h:38
virtual DC::XType GetAttType(string attname) const
Definition: DerivedVar.h:66
virtual bool GetAtt(string attname, std::vector< double > &values) const
Definition: DerivedVar.h:46
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
Definition: DerivedVar.h:74
virtual bool VariableExists(size_t ts, int reflevel, int lod) const =0
virtual std::vector< size_t > GetCRatios() const
Definition: DerivedVar.h:76
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
DC::FileTable _fileTable
Definition: DerivedVar.h:89
DerivedVar(string varName)
Definition: DerivedVar.h:36
virtual int Initialize()=0
string GetName() const
Definition: DerivedVar.h:42
virtual int CloseVariable(int fd)=0
string _derivedVarName
Definition: DerivedVar.h:88
Wrapper for a collection of netCDF files.
Wrapper for proj4 C API.
Definition: Proj4API.h:17
Wasp base class.
Definition: MyBase.h:67
#define VDF_API
Definition: common.h:73