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
150 void addCartesian(const PlainData<CartesianSrc> & src, const PlainData<CartesianSrc> & srcQuality, double weight = 1.0, int i=0, int j=0);
151
152
154
157 double decay = 0.0;
158
159 double getTimeDifferenceMinute(const CartesianODIM & odimIn) const;
160
162
167 void updateGeoData(); // const drain::image::GeoFrame & frame);
168
171
173 // drain::VariableMap metadataMap;
174
176
181 void updateInputSelector(const std::string & select);
182
183 // With current settings, create simple "Polar volume" containing coordinates.
184 // void createProjectionLookup(Hi5Tree & dst, const AreaGeometry & binGeometry = {500,360});
185 void createBinIndex(Hi5Tree & dst);
186
187 void createBinIndex(Hi5Tree & dst, const PolarODIM & odim);
188
189protected:
190
191 void addPolarInnerLoop(const PlainData<PolarSrc> & srcData, const PlainData<PolarSrc> & srcQuality, double priorWeight,
192 const RadarProj & pRadarToComposite, const drain::Rectangle<int> & bboxPix);
193
194 //static
195 //void createFieldList(const std::string & fields, std::list<FieldType> & fieldList);
196
197 void updateNodeMap(const std::string & node, int i, int j);
198
199 bool cropping = false;
200
201
202 Data<DstType<CartesianODIM> > & prepareDstData(DataSet<DstType<CartesianODIM> > & dstProduct);
203
204
205};
206
207} // rack::
208
209// DRAIN_ENUM_OSTREAM(rack::Composite::FieldType);
210
211
212#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:700
void updateGeoData()
Updates xscale, rscale and secondary Bounding Box attributes.
Definition Composite.cpp:600
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:157
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:565
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:170
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1278
Data structure consisting of plain data and an optional quality data.
Definition Data.h:1209
Essential class for storing radar data.
Definition Data.h:314
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:100
Namespace for images and image processing tools.
Definition AccumulationArray.cpp:45
Definition DataSelector.cpp:44
Rectange defined through lower left and upper right coordinates.
Definition Rectangle.h:65
Writable data type.
Definition Data.h:120