21 #ifndef DCREADERGRIB_H 
   22 #define DCREADERGRIB_H 
   24 #include <vapor/DCReader.h> 
   30 #include <vapor/UDUnitsClass.h> 
   32 #include "vapor/udunits2.h" 
   47         int HydrostaticPressureEqn();
 
   48         int LoadHydroData(
float* T, 
float* Q, 
float* Sp);
 
   49         int CalcVirtualTemperature(
float* T, 
float* Q, 
float* Sum, 
float* Tv);
 
   50         int DoHydroVarsExist();
 
   52         void _generateWeightTable();
 
   53         string GetGridType() 
const;
 
   55             return(_vertCoordinates);};
 
   58         virtual int OpenVariableRead(
size_t timestep, 
string varname, 
 
   59                                       int reflevel=0, 
int lod=0);
 
   61                                   fclose(_inFile); 
return 0;}
 
   62         virtual int Read(
float *values);
 
   63         virtual int ReadSlice(
float *slice);
 
   64         virtual bool VariableExists(
size_t ts, 
string varname,
 
   65                                  int reflevel=0, 
int lod=0) 
const;     
 
   66         virtual void GetLatLonExtents(
size_t ts, 
double lon_exts[2],
 
   67                                    double lat_exts[2]) 
const;
 
   68         virtual std::vector<std::string> GetVariables2DExcluded() 
const;
 
   69         virtual std::vector<std::string> GetVariables3DExcluded() 
const;
 
   71         virtual long GetNumTimeSteps() 
const;                                 
 
   72         virtual void GetGridDim(
size_t dim[3]) 
const;                         
 
   73         virtual std::vector<string> GetVariables3D() 
const;                   
 
   74         virtual std::vector<string> GetVariables2DXY() 
const;                 
 
   77         std::vector<string> empty; 
return(empty);};
 
   79         std::vector<string> empty; 
return(empty);};
 
   86         virtual void GetBlockSize(
size_t bs[3], 
int reflevel)
 const { GetGridDim(bs); }
 
   87         virtual std::vector<double> 
GetExtents(
size_t ts = 0)
 const {
return _cartographicExtents;}
 
   88         virtual std::vector<long> GetPeriodicBoundary() 
const;              
 
   89         virtual std::vector<long> GetGridPermutation() 
const;               
 
   90         virtual void GetTSUserTimeStamp(
size_t ts, std::string &s) 
const;
 
   91         virtual std::string GetMapProjection() 
const;
 
   96         void _LinearInterpolation(
float* values);
 
  102         int _Initialize(vector<string> files);
 
  104         int PrintVar(
string var);
 
  105         float GetLevel(
int index)
 const {
return _pressureLevels[index];}
 
  109         double BarometricFormula(
const double pressure) 
const;
 
  110         int _InitCartographicExtents(
string mapProj);
 
  113         struct MessageLocation {
 
  123                 void _AddTime(
double t) {_unitTimes.push_back(t);}
 
  124                 void  _AddMessage(
int msg) {_messages.push_back(msg);} 
 
  125                 void _AddLevel(
float lvl) {_pressureLevels.push_back(lvl);}
 
  126                 void _AddIndex(
double time, 
float level, 
string file, 
int offset);
 
  128                 int GetOffset(
double time, 
float level) 
const;
 
  129                 string GetFileName(
double time, 
float level) 
const;
 
  130                 std::vector<int> GetMessages()
 const {
return _messages;}
 
  131                 std::vector<double> GetTimes()
 const {
return _unitTimes;}
 
  132                 std::vector<float> GetLevels()
 const {
return _pressureLevels;}
 
  133                 float GetLevel(
int index)
 const {
return _pressureLevels[index];}
 
  135                 void PrintMessages();
 
  136                 void PrintIndex(
double time, 
float level);
 
  137                 void _SortLevels() {sort(_pressureLevels.begin(), _pressureLevels.end());}
 
  138                 void _SortTimes() {sort(_unitTimes.begin(), _unitTimes.end());}
 
  139                 bool _Exists(
double time) 
const;
 
  140                 void setScanDirection(
bool i, 
bool j) {iScan = i; jScan = j;}
 
  141                 void setOperatingCenter(
string oc) {_operatingCenter = oc;}
 
  142                 void setParamId(
int id) {_paramId = id;}
 
  143                 string getOperatingCenter() {
return _operatingCenter;}
 
  144                 int getParamId() {
return _paramId;}
 
  145                 bool getiScan()
 const {
return iScan;}
 
  146                 bool getjScan()
 const {
return jScan;}
 
  150                 std::map<double, std::map<float, MessageLocation> > _indices;
 
  151                 std::vector<int> _messages;
 
  152                 std::vector<float> _pressureLevels;
 
  155                 std::vector<size_t> _varTimes;
 
  157                 std::vector<double> _unitTimes;
 
  158                 string _operatingCenter;
 
  165         bool _ignoreForecastData;
 
  166         static int _sliceNum;
 
  171         double _LaDInDegrees;
 
  172         double _LoVInDegrees;
 
  181         string _Latin1InDegrees;
 
  182         string _Latin2InDegrees;
 
  183         string _orientationOfTheGridInDegrees;     
 
  188         std::vector<double> _pressureLevels;
 
  189         std::vector<double> _vertCoordinates;
 
  190         std::vector<double> _cartesianExtents;
 
  191         std::vector<double> _cartographicExtents;
 
  192         std::vector<double> _gribTimes;
 
  193         std::map<std::string, Variable*> _vars1d;
 
  194         std::map<std::string, Variable*> _vars2d;
 
  195         std::map<std::string, Variable*> _vars3d;
 
  196         double* _gaussianLats;
 
  197         std::vector<double> _weights;
 
  198         std::vector<int> _latIndices;
 
  200         double* _regularLats;
 
  201         float* _hydrostaticElevation;
 
  209                 int _LoadRecord(
string file, 
size_t offset);
 
  210                 int _LoadRecordKeys(
const string file); 
 
  212                 std::vector<std::map<std::string, std::string> > GetRecords()
 const {
return _recordKeys;}
 
  213                  int doWeIgnoreForecastTimes() {
return _ignoreForecastTimes;}
 
  217                 std::vector<std::map<std::string, std::string> > _recordKeys;
 
  218                 std::vector<std::string> _consistentKeys;
 
  219                 std::vector<std::string> _varyingKeys;
 
  220                 bool _recordKeysVerified;
 
  221                 int _ignoreForecastTimes;
 
  222                 DCReaderGRIB *_metadata;
 
  225                 unsigned long _key_iterator_filter_flags;
 
  232                 double _min,_max,_average;
 
  242                 Record(
string file, 
int recordNum);
 
  244                 void setTime(
string input) {time = input;}
 
  245                 void setUnits(
string input) {units = input;}
 
  246                 void setNi(
string input) {Ni = input;}
 
  247                 void setNj(
string input) {Nj = input;}
 
  248                 void setGridType(
string input) {gridType = input;}
 
  249                 void setVarName(
string input) {varName = input;}
 
  250                 string getTime() {
return time;}
 
  251                 string getUnits() {
return units;}
 
  252                 string getNi() {
return Ni;}
 
  253                 string getNj() {
return Nj;}
 
  254                 string getGridType() {
return gridType;}
 
  255                 string getVarName() {
return varName;}
 
  267 #endif // GRIBPARSER_H 
virtual double GetTSUserTime(size_t ts) const 
 
virtual int CloseVariable()
 
virtual std::vector< double > GetExtents(size_t ts=0) const 
 
virtual void GetBlockSize(size_t bs[3], int reflevel) const 
 
vector< double > GetZCoordsInMeters() const 
 
virtual std::vector< string > GetVariables2DYZ() const 
 
virtual std::vector< double > GetTSZCoords(size_t) const 
 
virtual std::vector< string > GetVariables2DXZ() const