Loading...
Searching...
No Matches
PseudoRhiOp.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
32#ifndef PseudoRhiOP_OP_H_
33#define PseudoRhiOP_OP_H_
34
35#include <string>
36
37#include "data/Data.h"
38#include "data/DataSelector.h"
39#include "data/PolarODIM.h"
40#include "data/VerticalODIM.h"
41#include "product/VolumeOp.h"
42
43namespace rack {
44
45using namespace drain::image;
46
48
51class PseudoRhiOp : public VolumeOp<RhiODIM> { // Consider class lift
52public:
53
54 //PseudoRhiOp(const std::string & name = "PolarProductOp", const std::string & description = "");
55 PseudoRhiOp(double az_angle=0.0, drain::Range<double> range={0.0, 0.0}, drain::Range<double> height={0.0, 12000.0},
56 drain::Frame2D<unsigned short> size={800,600}, double beamWidth = 0.25, double beamThreshold = 0.01) : //, std::string type="C", double gain=0.5, double offset=-32.0) :
57 VolumeOp<RhiODIM>("PseudoRhiOp","Computes vertical intersection in a volume in the beam direction.") {
58
59 odim.object = "XSEC";
60 odim.product = "PRHI";
61
62 parameters.link("az_angle", odim.az_angle = az_angle, "deg");
63
64 // Odim Version km/m?
65 // odim.range.set(minRange, range);
66 parameters.link("range", odim.range.tuple(range.min, range.max), "m");
67
68 // odim.altitudeRange.set(minHeight, maxHeight);
69 parameters.link("height", odim.altitudeRange.tuple(height.min, height.max), "m" );
70
71 parameters.link("size", odim.area.tuple(size.width, size.height), "pix");
72
73 /*
74 parameters.link("minRange", odim.minRange = minRange, "km");
75 parameters.link("range", odim.range = range, "km");
76 parameters.link("minHeight", odim.minheight = minHeight, "m");
77 parameters.link("maxHeight", odim.maxheight = maxHeight, "m");
78 */
79 //link("levels", odim.levels, levels);
80
81 parameters.link("beamWidth", this->beamWidth = beamWidth, "deg");
82 //parameters.link("beamThreshold", this->weightThreshold.tuple(0.5*beamThreshold, beamThreshold), "0..1").setFill(true);
83 parameters.link("beamThreshold", this->weightThreshold = beamThreshold, "0..1");
84
85 // link("undetectValue", undetectValue, -30.0); AUTOMATIC, see --quantity DBZH:undetectValue
86 // link("type", odim.type, "C"); // TODO
87 // link("gain", odim.scaling.scale, 0.5);
88 // link("offset", odim.scaling.offset, -32.0);
89
90 allowedEncoding.link("type", odim.type = "C"); // TODO: automatic?
91 allowedEncoding.link("gain", odim.scaling.scale);
92 allowedEncoding.link("offset", odim.scaling.offset);
93
94 dataSelector.setQuantities("^DBZH$");
95
96 }
97
98 virtual
99 inline
100 ~PseudoRhiOp(){};
101
102
103 double beamWidth = 0.25;
104 double weightThreshold = 0.1;
105 // drain::Range<double> weightThreshold = {0.1,0.2}; // = 0.1;
106
107 virtual
108 void setPolarSelector(const PolarSelector & ps) override;
109
110
112 virtual
113 void computeSingleProduct(const DataSetMap<PolarSrc> & src, DataSet<RhiDst> & dstProduct) const;
114
115protected:
116
117 inline
118 void setGeometry(const PolarODIM & srcODIM, PlainData<RhiDst> & dstData) const;
119
121
125 static inline
126 double relativeBeamPower(double angle, double beamWidth2){
127 return beamWidth2 / (beamWidth2 + angle*angle);
128 }
129
130
131};
132
133
134} // namespace rack
135
136#endif /* RACKOP_H_ */
137
138// Rack
Something that has width and height.
Definition Frame.h:55
Definition Range.h:52
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:282
Definition Data.h:1419
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1264
Essential class for storing radar data.
Definition Data.h:300
Metadata structure for single-radar data (polar scans, volumes and products).
Definition PolarODIM.h:45
drain::ReferenceMap allowedEncoding
Defines which encoding parameters can be changed by the user from command line.
Definition ProductBase.h:206
Pseudo Range-Height indicator.
Definition PseudoRhiOp.h:51
virtual void computeSingleProduct(const DataSetMap< PolarSrc > &src, DataSet< RhiDst > &dstProduct) const
Implements VolumeOp::filter.
Definition PseudoRhiOp.cpp:125
static double relativeBeamPower(double angle, double beamWidth2)
Simple non-gaussian model for a beam.
Definition PseudoRhiOp.h:126
MD odim
The default data parameters for encoding output (the product).
Definition RadarProductOp.h:101
Base class for radar data processors.
Definition VolumeOp.h:82
Namespace for images and image processing tools.
Definition AccumulationArray.cpp:45
Definition DataSelector.cpp:44
Definition PolarSector.h:110