Loading...
Searching...
No Matches
CartesianODIM.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood 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
39namespace rack {
40
41
43
46// ? Proj4 proj could be part of this? No...
47class CartesianODIM : public ODIM {
48
49public:
50
52 inline
53 CartesianODIM(group_t initialize =ODIMPathElem::ALL_LEVELS) : ODIM(initialize) {
54 init(initialize);
55 };
56
57 // TODO: CHECK: same -Wdeprecated-copy concern as ODIM's own copy constructor (see ODIM.h):
58 // this copy constructor does a full initFromMap(odim), but the implicit operator= would not.
60 inline
61 CartesianODIM(const CartesianODIM & odim) : ODIM(ODIMPathElem::ALL_LEVELS) {
62 initFromMap(odim);
63 };
64
66 template <class T>
67 CartesianODIM(const std::map<std::string,T> & m) : ODIM(ODIMPathElem::ALL_LEVELS){
68 initFromMap(m);
69 }
70
71 /*
72 inline
73 CartesianODIM(const CartesianODIM & odim, const drain::image::Image & img){
74 initFromMap(odim);
75 initFromImage(img);
76 };
77 */
78
79
81 inline
82 CartesianODIM(const drain::image::Image & img, const std::string & quantity="") : ODIM(ODIMPathElem::ALL_LEVELS) {
83 initFromImage(img, quantity);
84 };
85
86
87
88
90
94 void setGeometry(size_t cols, size_t rows);
95
97 void updateGeoInfo(const drain::image::GeoFrame & geoFrame);
98
100 std::string projdef;
101 double xscale = 0.0;
102 double yscale = 0.0;
103
104 //drain::Rectangle<double> bboxD ?
105 drain::BBox bboxD;
106 // double LL_lat;
107 // double LL_lon;
108 // double UR_lat;
109 // double UR_lon;
110 double UL_lat = 0.0; // or silent NaN?
111 double UL_lon = 0.0;
112 double LR_lat = 0.0;
113 double LR_lon = 0.0;
114
116 std::string camethod;
117
119 std::string nodes;
120
122 // double NI;
123
125 int epsg = 0;
126
127
128 inline
129 const drain::Rectangle<double> & getBoundingBoxDeg() const {
130 /*
131 bboxD.lowerLeft.x = LL_lon;
132 bboxD.lowerLeft.y = LL_lat;
133 bboxD.upperRight.x = UR_lon;
134 bboxD.upperRight.y = UR_lat;
135 */
136 return bboxD;
137 }
138
139private:
140
141 virtual // must
142 void init(group_t initialize = ODIMPathElem::ALL_LEVELS);
143
144 //mutable drain::Rectangle<double> bboxD;
145
146};
147
148// Consider single-radar odim
149
150
151
152} // namespace rack
153
154
155#endif
156
157// Rack
Container for geographical extent spanned by lowerLeft(x,y) and upperRight(x,y). Assumes longitude=x ...
Definition BoundingBox.h:47
Array with georeferencing support.
Definition GeoFrame.h:56
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition Image.h:183
Metadata structure for Cartesian radar data products (single-radar or composites).
Definition CartesianODIM.h:47
CartesianODIM(const drain::image::Image &img, const std::string &quantity="")
Constructor initializing ODIM from image metadata.
Definition CartesianODIM.h:82
int epsg
This is needed for palette operations (of single-radar Cartesian products).
Definition CartesianODIM.h:125
void updateGeoInfo(const drain::image::GeoFrame &geoFrame)
Updates size, projection and bounding box.
Definition CartesianODIM.cpp:121
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:96
CartesianODIM(group_t initialize=ODIMPathElem::ALL_LEVELS)
Default constructor.
Definition CartesianODIM.h:53
CartesianODIM(const CartesianODIM &odim)
Copy constructor.
Definition CartesianODIM.h:61
std::string projdef
WHERE.
Definition CartesianODIM.h:100
std::string nodes
Radar nodes (Table 9) which have contributed data to the composite, e.g. “’searl’,...
Definition CartesianODIM.h:119
CartesianODIM(const std::map< std::string, T > &m)
Constructor.
Definition CartesianODIM.h:67
std::string camethod
How cartesian data are processed, according to Table 12.
Definition CartesianODIM.h:116
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
DOC: Add class description.
Definition ODIMPath.h:82
static const group_t ALL_LEVELS
Abbreviation for linking (referencing) attributes at different levels (tree depths).
Definition ODIMPath.h:121
ODIM metadata (quantity, gain, offset, undetect, nodata, date, time)
Definition ODIM.h:79
std::string quantity
dataX/what (obligatory)
Definition ODIM.h:192
Definition AltitudeOp.cpp:42
Rectange defined through lower left and upper right coordinates.
Definition Rectangle.h:65