CartesianODIM.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 RACK_CART_ODIM_H
32 #define RACK_CART_ODIM_H
33 
34 #include <drain/util/BoundingBox.h>
35 #include <drain/image/GeoFrame.h>
36 
37 #include "ODIM.h"
38 
39 namespace rack {
40 
41 
43 
46 // ? Proj4 proj could be part of this? No...
47 class CartesianODIM : public ODIM {
48 
49 public:
50 
51  inline
52  CartesianODIM(group_t initialize =ODIMPathElem::ALL_LEVELS) : ODIM(initialize) {
53  init(initialize);
54  };
55 
56  inline
58  initFromMap(odim);
59  };
60 
61  template <class T>
62  CartesianODIM(const std::map<std::string,T> & m) : ODIM(ODIMPathElem::ALL_LEVELS){
63  initFromMap(m);
64  }
65 
66  /*
67  inline
68  CartesianODIM(const CartesianODIM & odim, const drain::image::Image & img){
69  initFromMap(odim);
70  initFromImage(img);
71  };
72  */
73 
74 
75  inline
76  CartesianODIM(const drain::image::Image & img, const std::string & quantity="") : ODIM(ODIMPathElem::ALL_LEVELS) {
77  initFromImage(img, quantity);
78  };
79 
80 
81 
82 
84 
88  void setGeometry(size_t cols, size_t rows);
89 
91  void updateGeoInfo(const drain::image::GeoFrame & geoFrame);
92 
94  std::string projdef;
95  double xscale = 0.0;
96  double yscale = 0.0;
97 
98  //drain::Rectangle<double> bboxD ?
99  drain::BBox bboxD;
100  // double LL_lat;
101  // double LL_lon;
102  // double UR_lat;
103  // double UR_lon;
104  double UL_lat = 0.0; // or silent NaN?
105  double UL_lon = 0.0;
106  double LR_lat = 0.0;
107  double LR_lon = 0.0;
108 
110  std::string camethod;
111 
113  std::string nodes;
114 
116  //double NI;
117 
119  int epsg;
120 
121 
122  inline
123  const drain::Rectangle<double> & getBoundingBoxDeg() const {
124  /*
125  bboxD.lowerLeft.x = LL_lon;
126  bboxD.lowerLeft.y = LL_lat;
127  bboxD.upperRight.x = UR_lon;
128  bboxD.upperRight.y = UR_lat;
129  */
130  return bboxD;
131  }
132 
133 private:
134 
135  virtual // must
136  void init(group_t initialize = ODIMPathElem::ALL_LEVELS);
137 
138  //mutable drain::Rectangle<double> bboxD;
139 
140 };
141 
142 // Consider single-radar odim
143 
144 
145 
146 } // namespace rack
147 
148 
149 #endif
150 
151 // Rack
Container for geographical extent spanned by lowerLeft(x,y) and upperRight(x,y). Assumes longitude=x ...
Definition: BoundingBox.h:46
Array with georeferencing support.
Definition: GeoFrame.h:58
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition: Image.h:184
Metadata structure for Cartesian radar data products (single-radar or composites).
Definition: CartesianODIM.h:47
int epsg
This is needed for palette operations (of single-radar Cartesian products).
Definition: CartesianODIM.h:119
void updateGeoInfo(const drain::image::GeoFrame &geoFrame)
Updates size, projection and bounding box.
Definition: CartesianODIM.cpp:114
void setGeometry(size_t cols, size_t rows)
Sets number of cols (geometry.width == xsize) and number of rows (geometry.height == ysize)....
Definition: CartesianODIM.cpp:91
std::string projdef
WHERE.
Definition: CartesianODIM.h:94
std::string nodes
Radar nodes (Table 9) which have contributed data to the composite, e.g. “’searl’,...
Definition: CartesianODIM.h:113
std::string camethod
How cartesian data are processed, according to Table 12.
Definition: CartesianODIM.h:110
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: DataSelector.cpp:44