Loading...
Searching...
No Matches
NonMetOp.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_NONMET_OP_H_
32#define RACK_NONMET_OP_H_
33
34//#include "DetectorOp.h"
35
36#include "FuzzyDetectorOp.h"
37
38//using namespace drain::image;
39
40namespace rack {
41
43
46class NonMetOp: public DetectorOp {
47
48public:
49
51
57 //NonMetOp(double threshold=0.4, double thresholdWidth=0.2, double windowWidth=0.0, double windowHeight=0.0, double medianPos=0.95) :
58 NonMetOp(const drain::UniTuple<double,2> & threshold = {0.7,0.8}, const drain::UniTuple<double,2> & medianWindow = {0.0,0.0}, double medianThreshold=0.95) :
59 DetectorOp(__FUNCTION__,"Detects clutter. Based on dual-pol parameter RhoHV . Optional post processing: morphological closing. Universal.", "nonmet"){
60
61 dataSelector.setQuantities("RHOHV");
63 UNIVERSAL = true;
64
65 parameters.link("threshold", this->threshold.tuple() = threshold, "0...1[:0...1]");
66 parameters.link("medianWindow", this->medianWindow.tuple() = medianWindow, "metres,degrees");
67 parameters.link("medianPos", this->medianPos = medianPos, "0...1"); //parameters.link("area", this->area, area);
68 };
69
70 /*
71 inline
72 NonMetOp(const NonMetOp & op) : DetectorOp(op){
73 UNIVERSAL = true;
74 std::cerr << __FUNCTION__ << " copy const \n";
75 }
76 */
77
78 //double threshold;
79 //double thresholdWidth;
80 drain::Range<double> threshold;
81 drain::Frame2D<double> medianWindow;
82 // double windowWidth;
83 // double windowHeight;
84 double medianPos;
85
86
87protected:
88
89 virtual
90 void runDetector(const PlainData<PolarSrc> & srcData, PlainData<PolarDst> & dstProb) const;
91
92
93
94};
95
96
98
102
103public:
104
106
111 //NonMetOp(double threshold=0.4, double thresholdWidth=0.2, double windowWidth=0.0, double windowHeight=0.0, double medianPos=0.95) :
112 NonMet2Op(const drain::UniTuple<double,2> & threshold = {0.75,0.95}, const drain::UniTuple<double,2> & medianWindow = {0.0,0.0}, double medianThreshold=0.95);
113
114 //double threshold;
115 //double thresholdWidth;
116 drain::Range<double> threshold;
117 drain::Frame2D<double> medianWindow;
118 // double windowWidth;
119 // double windowHeight;
120 double medianPos;
121
123 virtual inline
126 ftor_t & functor = bank.clone<ftor_t>();
127 // Ensure INVERSE (decreasing step function)
128 if (rhoHVthreshold.min > rhoHVthreshold.max){
129 functor.set(rhoHVthreshold);
130 }
131 else if (rhoHVthreshold.min < rhoHVthreshold.max){
132 functor.set(rhoHVthreshold.max, rhoHVthreshold.min); // invert
133 }
134 else {
135 functor.set(rhoHVthreshold.max, 0.8 * rhoHVthreshold.max);
136 }
137 return functor;
138 }
139
140protected:
141
142 //virtual
143 //void runDetector(const PlainData<PolarSrc> & srcData, PlainData<PolarDst> & dstProb) const;
144
145 virtual
146 void init(const drain::UniTuple<double,2> & threshold, const drain::UniTuple<double,2> & medianWindow, double medianThreshold);
147
148 /*
149 virtual inline
150 void computeFuzzyDBZ(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const {};
151
152 virtual inline
153 void computeFuzzyVRAD(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const {};
154
155 virtual
156 void computeFuzzyZDR(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
157
158 virtual
159 void computeFuzzyRHOHV(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
160 */
161};
162
163
164
167
168public:
169
170 // BIRD: double dbzPeak = -5.0, double vradDevMin = 5.0, double rhoHVmax = 0.7, double zdrAbsMin = 2.0, double windowWidth = 2500, double windowHeight = 5.0
171
181 ChaffOp(double dbzPeak = 10.0, double vradDevMax = +5.0, double rhoHVmax = 0.50, double zdrAbsMin = 0.5, double windowWidth = 2500, double windowHeight = 5.0) :
182 FuzzyDetectorOp(__FUNCTION__, "Estimates chaff probability from DBZH, VRAD, RhoHV and ZDR.", "nonmet.chaff"){
183 init(dbzPeak, vradDevMax, rhoHVmax, zdrAbsMin, windowWidth, windowHeight);
184 };
185
188 this->parameters.copyStruct(op.getParameters(), op, *this);
189 }
190
191 virtual
192 void init(double dbzPeak, double vradDevMax, double rhoHVmax, double zdrDevMin, double windowWidth, double windowHeight);
193
194 /*
195 virtual
196 void computeFuzzyDBZ(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
197
198 virtual
199 void computeFuzzyVRAD(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
200
201 virtual
202 void computeFuzzyZDR(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
203
204 virtual
205 void computeFuzzyRHOHV(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
206 */
207
208 /*
209 virtual inline
210 const drain::Fuzzifier<double> & getDBZFuzzifier() const override {
211 // dbzFuzzifier.set(dbzParam);
212 return dbzFuzzifier;
213 }
214 */
215
216 /*
217 virtual inline
218 RadarFunctorBaseOp & getDBZFuzzifier() const override {
219 dbzFuzzifier.functor.set(dbzParam);
220 return dbzFuzzifier;
221 }
222 */
223
224private:
225
226 //mutable
227 // RadarFunctorOp<drain::FuzzyStep<double> > dbzFuzzifier;
228 // RadarDataFunctor<drain::FuzzyStep<double> > dbzFuzzifier;
229
230};
231
232
233
234} // rack::
235
236#endif /* NONMET_OP_H_ */
map_t parameters
Parameters (name -> linked variable), typically linked to member variables of the derived class.
Definition BeanLike.h:313
const map_t & getParameters() const
Returns the parameter map (const access).
Definition BeanLike.h:116
Something that has width and height.
Definition Frame.h:53
A base class for fuzzy functions; also an unary functor.
Definition Fuzzy.h:62
A simple linear transition from 0 to 1 .
Definition Fuzzy.h:170
Definition Range.h:52
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition ReferenceMap.h:412
Tuple of N elements of type T.
Definition UniTuple.h:65
DOC: Add class description.
Definition NonMetOp.h:166
ChaffOp(double dbzPeak=10.0, double vradDevMax=+5.0, double rhoHVmax=0.50, double zdrAbsMin=0.5, double windowWidth=2500, double windowHeight=5.0)
Definition NonMetOp.h:181
ChaffOp(const ChaffOp &op)
Copy constructor.
Definition NonMetOp.h:187
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:299
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
Base class for anomaly detectors.
Definition DetectorOp.h:49
bool REQUIRE_STANDARD_DATA
Set to true if operator expects fixed background intensities instead of "nodata" defined by the Polar...
Definition DetectorOp.h:212
bool UNIVERSAL
If true, applies also to quantities str than the one used in detection. The detection and the accumul...
Definition DetectorOp.h:177
Base class for BirdOp and InsectOp.
Definition FuzzyDetectorOp.h:79
DOC: Add class description.
Definition FuzzyDetectorOp.h:54
Marks bins with low RhoHV value as probable anomalies.
Definition NonMetOp.h:101
virtual drain::Fuzzifier< double > & getFuzzifierRHOHV(LocalFunctorBank &bank) const override
Fuzzifier of RHOHV shows response on values lower than 1.0.
Definition NonMetOp.h:124
Marks bins with low RhoHV value as probable anomalies.
Definition NonMetOp.h:46
virtual void runDetector(const PlainData< PolarSrc > &srcData, PlainData< PolarDst > &dstProb) const
Process as sweep (data in one elevation angle). Disabled; see runDetection() above for the equivalent...
Definition NonMetOp.cpp:42
NonMetOp(const drain::UniTuple< double, 2 > &threshold={0.7, 0.8}, const drain::UniTuple< double, 2 > &medianWindow={0.0, 0.0}, double medianThreshold=0.95)
Default constructor.
Definition NonMetOp.h:58
Definition AltitudeOp.cpp:42