VerticalODIM.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 #ifndef Vertical_ODIM
32 #define Vertical_ODIM
33 
34 #include <ostream>
35 #include <cmath>
36 #include <set>
37 //#include <drain/util/Options.h>
38 #include <drain/util/ReferenceMap.h>
39 
40 
41 #include "hi5/Hi5.h"
42 
43 #include "ODIM.h"
44 
45 namespace rack {
46 
47 
48 
55 public:
56 
57  // Notice: these are also in CartesianODIM
58 
60  //long xsize;
61  int64_t xsize; // Recommended by ODIM. Here a compiler test...
62 
64  long ysize;
65 
66 
68  double xscale;
69 
71  double yscale;
72 
76  //double minheight;
77 
79  //double maxheight;
80 
82  double NI;
83 
84  inline
85  VerticalCrossSectionODIM(group_t initialize =ODIMPathElem::ALL_LEVELS) : ODIM(initialize) {
86  init(initialize);
87  };
88 
89  VerticalCrossSectionODIM(const ODIM & odim){
90  initFromMap(odim);
91  };
92 
93  inline
94  void setGeometry(size_t cols, size_t rows){
95  xsize = cols;
96  ysize = rows;
97  }
98 
99 protected:
100 
101  virtual
102  void init(group_t initialize =ODIMPathElem::ALL_LEVELS);
103 
104 };
105 
106 
107 class VerticalProfileODIM : public VerticalCrossSectionODIM { // TODO VerticalODIM as a base, without xsize,ysize etc.
108 public:
109 
110  // where (radar site)
111  double lon;
112  double lat;
113  //double height;
114 
115  // where (profile)
116  long int levels;
117  double interval;
118  //double minRange;
119  //double range; // was 'maxRange', should be 'range'
120  drain::Range<double> distanceRange;
121 
122  // where
123  drain::Range<double> azmRange;
124  //double startaz; // non-stardard for profile
125  //double stopaz; // non-stardard for profile
126  long int azSlots; // non-stardard
127 
128 
129  inline
130  VerticalProfileODIM(group_t initialize =ODIMPathElem::ALL_LEVELS) : VerticalCrossSectionODIM(initialize) {
131  init(initialize);
132  }
133 
134  inline
136  initFromMap(odim);
137  }
138 
139  template <class T>
140  VerticalProfileODIM(const std::map<std::string,T> & m){
141  initFromMap(m);
142  }
143 
144  VerticalProfileODIM(const drain::image::Image & img, const std::string & quantity=""){
145  initFromImage(img, quantity);
146  }
147 
148 protected:
149 
150  virtual
151  void init(group_t initialize =ODIMPathElem::ALL_LEVELS);
152 
153 };
154 
155 
157 public:
158 
159  // where (radar site)
160  double lon;
161  double lat;
162  //double height;
163 
164 
165  // where
166  double az_angle; // non-stardard for profile
167  double angles; // non-stardard for profile
168 
169 
170  //long int azSlots; // non-stardard
171  drain::Range<double> range;
172  //double minRange; // nonstandard
173  //double range;
174 
175  inline
176  RhiODIM(group_t initialize =ODIMPathElem::ALL_LEVELS) : VerticalCrossSectionODIM(initialize) {
177  init(initialize);
178  };
179 
180  RhiODIM(const RhiODIM & odim){
181  initFromMap(odim);
182  };
183 
184  template <class T>
185  RhiODIM(const std::map<std::string,T> & m){
186  initFromMap(m);
187  }
188 
189  RhiODIM(const drain::image::Image & img, const std::string & quantity=""){
190  initFromImage(img, quantity);
191  };
192 
193 protected:
194 
195  virtual
196  void init(group_t initialize =ODIMPathElem::ALL_LEVELS);
197 };
198 
199 
200 
201 } // namespace rack
202 
203 
204 #endif
205 
206 // Rack
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition: Image.h:184
static const group_t ALL_LEVELS
Abbreviation for linking (referencing) attributes at different levels (tree depths).
Definition: ODIMPath.h:118
ODIM metadata (quantity, gain, offset, undetect, nodata, date, time)
Definition: ODIM.h:79
std::string quantity
dataX/what (obligatory)
Definition: ODIM.h:181
Definition: VerticalODIM.h:156
Definition: VerticalODIM.h:54
double yscale
Vertical resolution in m.
Definition: VerticalODIM.h:71
void setGeometry(size_t cols, size_t rows)
Sets number of columns (nbins) and number of rows (nrays). Does not change resolution.
Definition: VerticalODIM.h:94
long ysize
Number of pixels in vert dimension.
Definition: VerticalODIM.h:64
double NI
Minimum height in meters above mean sea level.
Definition: VerticalODIM.h:82
drain::Range< double > altitudeRange
Corresponding to what:height, yet less risky for confusions with tower height or site height (altitud...
Definition: VerticalODIM.h:74
double xscale
Horizontal resolution in m.
Definition: VerticalODIM.h:68
int64_t xsize
Number of pixels in horizontal dimension.
Definition: VerticalODIM.h:61
Definition: VerticalODIM.h:107
Definition: DataSelector.cpp:44