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
59 //NonMetOp(double threshold=0.4, double thresholdWidth=0.2, double windowWidth=0.0, double windowHeight=0.0, double medianPos=0.95) :
60 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) :
61 DetectorOp(__FUNCTION__,"Detects clutter. Based on dual-pol parameter RhoHV . Optional post processing: morphological closing. Universal.", "nonmet"){
62
63 dataSelector.setQuantities("RHOHV");
65 UNIVERSAL = true;
66
67 parameters.link("threshold", this->threshold.tuple() = threshold, "0...1[:0...1]");
68 parameters.link("medianWindow", this->medianWindow.tuple() = medianWindow, "metres,degrees");
69 parameters.link("medianPos", this->medianPos = medianPos, "0...1"); //parameters.link("area", this->area, area);
70 };
71
72 /*
73 inline
74 NonMetOp(const NonMetOp & op) : DetectorOp(op){
75 UNIVERSAL = true;
76 std::cerr << __FUNCTION__ << " copy const \n";
77 }
78 */
79
80 //double threshold;
81 //double thresholdWidth;
82 drain::Range<double> threshold;
83 drain::Frame2D<double> medianWindow;
84 // double windowWidth;
85 // double windowHeight;
86 double medianPos;
87
88
89protected:
90
91 virtual
92 void runDetector(const PlainData<PolarSrc> & srcData, PlainData<PolarDst> & dstProb) const;
93
94
95
96};
97
98
100
104
105public:
106
108
118 //NonMetOp(double threshold=0.4, double thresholdWidth=0.2, double windowWidth=0.0, double windowHeight=0.0, double medianPos=0.95) :
119 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);
120
121 //double threshold;
122 //double thresholdWidth;
123 drain::Range<double> threshold;
124 drain::Frame2D<double> medianWindow;
125 // double windowWidth;
126 // double windowHeight;
127 double medianPos;
128
130 virtual inline
132 typedef drain::FuzzyStep<double> ftor_t;
133 ftor_t & functor = bank.clone<ftor_t>();
134 // Ensure INVERSE (decreasing step function)
135 if (rhoHVthreshold.min > rhoHVthreshold.max){
136 functor.set(rhoHVthreshold);
137 }
138 else if (rhoHVthreshold.min < rhoHVthreshold.max){
139 functor.set(rhoHVthreshold.max, rhoHVthreshold.min); // invert
140 }
141 else {
142 functor.set(rhoHVthreshold.max, 0.8 * rhoHVthreshold.max);
143 }
144 return functor;
145 }
146
147protected:
148
149 //virtual
150 //void runDetector(const PlainData<PolarSrc> & srcData, PlainData<PolarDst> & dstProb) const;
151
152 virtual
153 void init(const drain::UniTuple<double,2> & threshold, const drain::UniTuple<double,2> & medianWindow, double medianThreshold);
154
155 /*
156 virtual inline
157 void computeFuzzyDBZ(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const {};
158
159 virtual inline
160 void computeFuzzyVRAD(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const {};
161
162 virtual
163 void computeFuzzyZDR(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
164
165 virtual
166 void computeFuzzyRHOHV(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
167 */
168};
169
170
171
173
174public:
175
176 // BIRD: double dbzPeak = -5.0, double vradDevMin = 5.0, double rhoHVmax = 0.7, double zdrAbsMin = 2.0, double windowWidth = 2500, double windowHeight = 5.0
177
188 ChaffOp(double dbzPeak = 10.0, double vradDevMax = +5.0, double rhoHVmax = 0.50, double zdrAbsMin = 0.5, double windowWidth = 2500, double windowHeight = 5.0) :
189 FuzzyDetectorOp(__FUNCTION__, "Estimates chaff probability from DBZH, VRAD, RhoHV and ZDR.", "nonmet.chaff"){
190 init(dbzPeak, vradDevMax, rhoHVmax, zdrAbsMin, windowWidth, windowHeight);
191 };
192
193 ChaffOp(const ChaffOp & op) : FuzzyDetectorOp(op) {
194 this->parameters.copyStruct(op.getParameters(), op, *this);
195 }
196
197 virtual
198 void init(double dbzPeak, double vradDevMax, double rhoHVmax, double zdrDevMin, double windowWidth, double windowHeight);
199
200 /*
201 virtual
202 void computeFuzzyDBZ(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
203
204 virtual
205 void computeFuzzyVRAD(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
206
207 virtual
208 void computeFuzzyZDR(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
209
210 virtual
211 void computeFuzzyRHOHV(const PlainData<PolarSrc> & src, PlainData<PolarDst> & dstData, DataSet<PolarDst> & dstProduct) const;
212 */
213
214 /*
215 virtual inline
216 const drain::Fuzzifier<double> & getDBZFuzzifier() const override {
217 // dbzFuzzifier.set(dbzParam);
218 return dbzFuzzifier;
219 }
220 */
221
222 /*
223 virtual inline
224 RadarFunctorBaseOp & getDBZFuzzifier() const override {
225 dbzFuzzifier.functor.set(dbzParam);
226 return dbzFuzzifier;
227 }
228 */
229
230private:
231
232 //mutable
233 // RadarFunctorOp<drain::FuzzyStep<double> > dbzFuzzifier;
234 // RadarDataFunctor<drain::FuzzyStep<double> > dbzFuzzifier;
235
236};
237
238
239
240} // rack::
241
242#endif /* NONMET_OP_H_ */
Something that has width and height.
Definition Frame.h:53
A base class for fuzzy functions; also an unary functor.
Definition Fuzzy.h:55
A basic, linear transition from 0 to scale between (start) and (end) .
Definition Fuzzy.h:154
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:407
Tuple of N elements of type T.
Definition UniTuple.h:65
Definition NonMetOp.h:172
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:188
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:282
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:216
bool UNIVERSAL
If true, applies also to quantities str than the one used in detection. The detection and the accumul...
Definition DetectorOp.h:181
Base class for BirdOp and InsectOp.
Definition FuzzyDetectorOp.h:90
Definition FuzzyDetectorOp.h:65
Marks bins with low RhoHV value as probable anomalies.
Definition NonMetOp.h:103
virtual drain::Fuzzifier< double > & getFuzzifierRHOHV(LocalFunctorBank &bank) const override
Fuzzifier of RHOHV shows response on values lower than 1.0.
Definition NonMetOp.h:131
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)
Definition NonMetOp.cpp:46
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:60
Definition DataSelector.cpp:44