DataSetStats.hpp
1 #pragma once
2 
3 #include "opals/config.hpp"
4 #include "opals/Vector.hpp"
5 #include "opals/Array.hpp"
6 #include "opals/Path.hpp"
7 #include "opals/DataSetType.hpp"
8 #include "opals/AttributeBandDescription.hpp"
9 #include "opals/IndexDescription.hpp"
10 
11 namespace opals
12 {
13  /// \brief DataSetStats provides generic information about a data file (use in opalsInfo).
14  ///
15  /// Beside the name, type, storage size (in bytes) and a nodata indicator of the attribute the
16  /// class provides basic statistic information such as min, max, mean and the standard deviation.
17  /// If a specific information is really set, can be retrieved by the corresponding isSet function.
18  /// Depending on the data type a specific no data value is used to indicate unset values.
19  ///
20  /// \author JO
21  /// \date 24.05.2012
22  class OPALS_API DataSetStats
23  {
24  public:
25  static DataSetStats merge(Vector<DataSetStats> &stats, bool mergeFilenames);
26  static DataSetStats readFromOverview(const Path &overviewFilename);
27 
28  typedef Array<double,6> ArrayD6;
32  typedef Array<double,2> ArrayD2;
34 
35  DataSetStats();
36  ~DataSetStats();
37 
38  void reset();
39 
40  // isSet functions ================================================
41  bool isEmpty() const;
42  bool hasValueFrequency() const;
43 
44  //common part
45  bool isSetFilename() const;
46  bool isSetType() const;
47  bool isSetVersion() const;
48  bool isSetCreator() const;
49  bool isSetBoundingBox() const;
50  bool isSetTimeOffset() const;
51  bool isSetCoordRefSys() const;
52  // odm part
53  bool isSetPointCount() const;
54  bool isSetLineCount() const;
55  bool isSetPolygonCount() const;
56  bool isSetBoundaryPolygon() const;
57  bool isSetPointDensity() const;
58  bool isSetAttributes() const;
59  bool isSetIndices() const;
60  //Raster Part
61  bool isSetPixelCount() const;
62  bool isSetRasterDimension() const;
63  bool isSetBands() const;
64  bool isSetPixelSize() const;
65  bool isSetCompression() const;
66  bool isSetInterleave() const;
67  bool isSetErrorMessage() const;
68 
69  // Get functions ================================================
70  //common part
71  Path getFilename() const;
72  DataSetType getType() const;
73  String getVersion() const;
74  String getCreator() const;
75  ArrayD6 getBoundingBox() const;
76  int getBoundingBoxDim() const;
77  double getTimeOffset() const;
78  String getCoordRefSys() const;
79  // odm part
80  long long getPointCount() const;
81  long long getLineCount() const;
82  long long getPolygonCount() const;
83  StringVector getBoundaryPolygon() const;
84  double getPointDensity() const;
85  AttributeVector getAttributes() const;
86  IndexVector getIndices() const; ///< get info object about the spatial indices
87  //Raster Part
88  long long getPixelCount() const;
89  AttributeVector getBands() const;
90  ArrayD2 getPixelSize() const;
91  ArrayU2 getRasterDimension() const;
92  bool getPixelAreaOrPointFlag() const;
93  String getCompression() const;
94  String getInterleave() const;
95  String getErrorMessage() const;
96 
97  // set functions ================================================
98  //common part
99  void setFilename(const Path& Filename);
100  void setType(const DataSetType &Type);
101  void setVersion(const String &Version);
102  void setCreator(const String& Creator);
103  void setBoundingBox(const ArrayD6& BoundingBox);
104  void setBoundingBoxDim(const int& BoundingBoxDim);
105  void setTimeOffset(const double& TimeOffset);
106  void setCoordRefSys(const String& crs);
107 
108  // odm part
109  void setPointCount(const long long& PointCount);
110  void setLineCount(const long long& LineCount);
111  void setPolygonCount(const long long& PolygonCount);
112  void setBoundaryPolygon(const StringVector& BoundaryPolygon);
113  void setPointDensity(const double &PointDensity);
114  void setAttributes(const AttributeVector& Attributes);
115  void setIndices(const IndexVector& Indecs);
116  //Raster Part
117  void setPixelCount(const long long& PixelCount);
118  void setBands(const AttributeVector& Bands) ;
119  void setPixelSize(const ArrayD2& PixelSize);
120  void setRasterDimension(const ArrayU2& dim);
121  void setPixelAreaOrPointFlag(const bool& PixelAreaOrPointFlag);
122  void setCompression(const String& Compression);
123  void setInterleave(const String& Interleave);
124  void setErrorMessage(const String& errorMessage);
125 
126  String logDataSetStats(int precision=3) const; ///< for xml output
127  String printDataSetStats() const; ///< for log output (in more readable format)
128  String printValueFrequency() const; ///< for log output (in more readable format)
129 
130  private:
131  Path filename;
132  DataSetType type;
133  String version;
134 
135  long long pointCount;
136  long long lineCount;
137  long long polygonCount;
138 
139  ArrayD6 boundingBox;
140  int boundingBoxDim;
141 
142  StringVector boundaryPolygon;
143  double pointDensity;
144 
145  String creator;
146  String coordRefSys;
147 
148  double timeOffset;
149 
150  AttributeVector attributes;
151  IndexVector indices;
152 
153  long long pixelcount;
154  AttributeVector bands;
155 
156  ArrayD2 pixelsize;
157  ArrayU2 rasterdim;
158  bool pixelareaorpointflag;
159  String compression;
160  String interleave;
161 
162  String errorMessage;
163  };
164 }
DataSetType
Possible data set types as used in DataSetStats (see opalsInfo)
Definition: DataSetType.hpp:8
A file/directory path.
Definition: Path.hpp:26
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
Mimics std::vector<T>
Definition: fwd.hpp:18
DataSetStats provides generic information about a data file (use in opalsInfo).
Definition: DataSetStats.hpp:22
A dynamic character string whose interface conforms to STL's std::string.
Definition: String.hpp:35