GlobeEngine
WeatherData.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_WeatherData_h
10 #define GlobeEngine_WeatherData_h
11 
12 #include <vmmlib/vmmlib.hpp>
13 #include <vector>
14 #include "FlowDataBlueprint.h"
15 
16 #include "ncFile.h"
17 
18 namespace geFlow {
19 
20  struct ClimateGridInfo {
21  float* longCoords;
22  float* latCoords;
23  float* heightCoords;
24  };
25 
26  struct ClimateDataInfo {
27  vmml::Vector4ui sizes;
28  std::vector<std::string> names;
29  };
30 
32  std::vector<vmml::Vector2f> directions;
33  };
34 
36  vmml::Vector2f minMax;
37  std::vector<float> data;
38  };
39 
40  class WeatherData {
41 
42  public:
43  WeatherData();
44  ~WeatherData();
45  void clear();
46  void loadFromNetCDF(std::shared_ptr<geFlow::WeatherDataLoadingInfo> _loadinginfo);
47 
48  const std::vector<vmml::Vector2f>& getWindDirections(int _timestep = 0) const;
49  const vmml::Vector2f& getWindDirectionAtIdx(int _longIdx, int _latIdx, int _timestep = 0) const;
50 
51  unsigned int getTotalDataSize() const;
52  unsigned int getTimeSteps() const;
53  vmml::Vector2s getLongLatCellExtent() const;
54  vmml::Vector3s getLongHeightLatCellExtent() const;
55  const vmml::Vector4ui& getCellExtent() const;
56  const vmml::Vector2d& getGridLongLatMidPoint() const;
57  const vmml::Vector4d& getGridLongLatBounds() const;
58  const vmml::Vector2d& getGridLongLatBoundSize() const;
59  const ClimateGridInfo& getGridInfo() const;
60  ClimateDataLayer1D& getCloudInfo(int _timestep = 0);
61  const double getGridHeight() const;
62  private:
63  void setDataArraySize();
64  void loadWindInformation(const netCDF::NcFile& _dataFile,
65  std::shared_ptr<geFlow::WeatherDataLoadingInfo> _info);
66  void loadCloudInformation(const netCDF::NcFile& _dataFile,
67  std::shared_ptr<geFlow::WeatherDataLoadingInfo> _info);
68  void loadVolumeInformation(const netCDF::NcFile& _dataFile,
69  std::shared_ptr<geFlow::WeatherDataLoadingInfo> _info);
70  // usually assumes ordered data as in
71  // the variable: dataInfo
72  ClimateLoadingRange getLoadingRange(
73  std::vector<std::string> _orderingStrings,
74  vmml::Vector4ui _ranges);
75  int getIdxForName(std::string _name) const;
76  // returns 0=totaldataperlayer and 1=totaldatatoload
77  static vmml::Vector2ui computeDataSizeForVariable(vmml::Vector4ui _dataSize);
78 
79  ClimateGridInfo grid;
80  std::vector<ClimateDataLayer2D> wind;
81  std::vector<ClimateDataLayer1D> layer1D;
82  // usually assumes ordered data:
83  // longitude = x-axis
84  // height = y-axis
85  // latitude = z-axis
86  // timesteps = w-axis
87  ClimateDataInfo dataInfo;
88  //vmml::Vector4ui dataSize;
89  // long min, long max, lat min, lat max
90  vmml::Vector2d gridMidpoint;
91  vmml::Vector4d gridbounds;
92  vmml::Vector2d gridboundsLenght;
93  // top and bottom bound
94  vmml::Vector2d volumeHeightbounds;
95  double volumeHeight;
96 
97  unsigned int totDataSize;
98  };
99 }
100 #endif
Definition: WeatherData.h:31
Definition: WeatherData.h:35
std::vector< vmml::Vector2f > directions
Definition: WeatherData.h:32
Definition: FlowDataBlueprint.h:19
float * latCoords
Definition: WeatherData.h:22
const ClimateGridInfo & getGridInfo() const
Definition: WeatherData.cpp:332
std::vector< std::string > names
Definition: WeatherData.h:28
void clear()
Definition: WeatherData.cpp:31
const double getGridHeight() const
Definition: WeatherData.cpp:344
Definition: ArrowField.h:16
Definition: WeatherData.h:20
unsigned int getTotalDataSize() const
Definition: WeatherData.cpp:312
unsigned int getTimeSteps() const
Definition: WeatherData.cpp:316
ClimateDataLayer1D & getCloudInfo(int _timestep=0)
Definition: WeatherData.cpp:340
vmml::Vector3s getLongHeightLatCellExtent() const
Definition: WeatherData.cpp:328
~WeatherData()
Definition: WeatherData.cpp:19
const vmml::Vector4d & getGridLongLatBounds() const
Definition: WeatherData.cpp:353
const vmml::Vector2f & getWindDirectionAtIdx(int _longIdx, int _latIdx, int _timestep=0) const
Definition: WeatherData.cpp:349
void loadFromNetCDF(std::shared_ptr< geFlow::WeatherDataLoadingInfo > _loadinginfo)
Definition: WeatherData.cpp:42
vmml::Vector2f minMax
Definition: WeatherData.h:36
vmml::Vector4ui sizes
Definition: WeatherData.h:27
Definition: WeatherData.h:40
vmml::Vector2s getLongLatCellExtent() const
Definition: WeatherData.cpp:324
std::vector< float > data
Definition: WeatherData.h:37
const vmml::Vector2d & getGridLongLatMidPoint() const
Definition: WeatherData.cpp:361
const vmml::Vector2d & getGridLongLatBoundSize() const
Definition: WeatherData.cpp:357
WeatherData()
Definition: WeatherData.cpp:15
const std::vector< vmml::Vector2f > & getWindDirections(int _timestep=0) const
Definition: WeatherData.cpp:336
float * heightCoords
Definition: WeatherData.h:23
Definition: WeatherData.h:26
const vmml::Vector4ui & getCellExtent() const
Definition: WeatherData.cpp:320
float * longCoords
Definition: WeatherData.h:21