Loading...
Searching...
No Matches
Composite.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_COMPOSITE2
32#define RACK_COMPOSITE2
33
34#include <drain/image/AccumulationConverter.h>
35#include <drain/image/AccumulatorGeo.h>
36#include <drain/util/Rectangle.h>
37
38#include "hi5/Hi5.h"
39#include "data/CartesianODIM.h"
40#include "data/Data.h"
41
42#include "RadarAccumulator.h"
43#include "RadarProj.h"
44
45namespace rack
46{
47
48using namespace drain::image;
49
50
51
53
101class Composite : public RadarAccumulator<drain::image::AccumulatorGeo,CartesianODIM>
102{
103public:
104
105 // Possible future extension.
106 //typedef std::map<int,std::string> legend_t;
107 //legend_t legend;
108
109 Composite();
110
111 virtual ~Composite(){};
112
113 // To allow consecutive --cExtract calls (for --encoding )
114 bool extracting = false;
115
117
120 inline
121 void setCropping(bool cropping = true){ this->cropping = cropping; };
122
123 inline
124 bool isCropping(){
125 return cropping;
126 };
127
128
130 void checkQuantity(const std::string & quantity);
131
132
134
141 void addPolar(const PlainData<PolarSrc> & src, const PlainData<PolarSrc> & srcQuality, double weight, bool autoProj);
142
144
149 void addCartesian(const PlainData<CartesianSrc> & src, const PlainData<CartesianSrc> & srcQuality, double weight = 1.0, int i=0, int j=0);
150
151
153
156 double decay = 0.0;
157
158 double getTimeDifferenceMinute(const CartesianODIM & odimIn) const;
159
161
166 void updateGeoData(); // const drain::image::GeoFrame & frame);
167
170
172 // drain::VariableMap metadataMap;
173
175
180 void updateInputSelector(const std::string & select);
181
182 // With current settings, create simple "Polar volume" containing coordinates.
183 // void createProjectionLookup(Hi5Tree & dst, const AreaGeometry & binGeometry = {500,360});
184 void createBinIndex(Hi5Tree & dst);
185
186 void createBinIndex(Hi5Tree & dst, const PolarODIM & odim);
187
188protected:
189
192
193 //static
194 //void createFieldList(const std::string & fields, std::list<FieldType> & fieldList);
195
196 void updateNodeMap(const std::string & node, int i, int j);
197
198 bool cropping = false;
199
200
202
203
204};
205
206} // rack::
207
208// DRAIN_ENUM_OSTREAM(rack::Composite::FieldType);
209
210
211#endif /*COMPOSITE_H_*/
A map of Variables.
Definition VariableMap.h:61
Metadata structure for Cartesian radar data products (single-radar or composites).
Definition CartesianODIM.h:47
Cartesian composite (mosaic) of data from several radars.
Definition Composite.h:102
void addPolar(const PlainData< PolarSrc > &src, const PlainData< PolarSrc > &srcQuality, double weight, bool autoProj)
Projects radar data in polar coordinates to Cartesian coordinates.
Definition Composite.cpp:328
void setCropping(bool cropping=true)
If cropping is set, calling addPolar() also crops the bounding box to intersection of radar area and ...
Definition Composite.h:121
void addPolarInnerLoop(const PlainData< PolarSrc > &srcData, const PlainData< PolarSrc > &srcQuality, double priorWeight, const RadarProj &pRadarToComposite, const drain::Rectangle< int > &bboxPix)
Definition Composite.cpp:196
void createBinIndex(Hi5Tree &dst)
Definition Composite.cpp:94
void updateInputSelector(const std::string &select)
EXPERIMENTAL: save elangles TODO: consider rename metadataMap (for hairy details)
Definition Composite.cpp:706
void updateGeoData()
Updates xscale, rscale and secondary Bounding Box attributes.
Definition Composite.cpp:606
double decay
Weight decrease (0.0...1.0), per minute, in the weighting of delayed data. Zero means no change in we...
Definition Composite.h:156
void addCartesian(const PlainData< CartesianSrc > &src, const PlainData< CartesianSrc > &srcQuality, double weight=1.0, int i=0, int j=0)
Add data that matches the Cartesian projection and scaling of the composite.
Definition Composite.cpp:571
void checkQuantity(const std::string &quantity)
Sets quantity. Warns if input has a different quantity.
Definition Composite.cpp:154
Composite()
Definition Composite.cpp:64
drain::VariableMap nodeMap
Node keys (like "fivan") associated with upper left corner pixel coordinates [int] of the "tile".
Definition Composite.h:169
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
Metadata structure for single-radar data (polar scans, volumes and products).
Definition PolarODIM.h:45
Data array for creating composites and accumulated polar products (Surface rain fall or cluttermaps)
Definition RadarAccumulator.h:122
CartesianODIM odim
For storing the scaling and encoding of (1st) input or user-defined values. Also for bookkeeping of d...
Definition RadarAccumulator.h:185
Definition RadarProj.h:99
Namespace for images and image processing tools.
Definition AccumulationArray.cpp:45
Definition AltitudeOp.cpp:42
Rectange defined through lower left and upper right coordinates.
Definition Rectangle.h:65