Loading...
Searching...
No Matches
ConvOp.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 POLARCB_H_
33#define POLARCB_H_
34
35#include <algorithm>
36#include "radar/Geometry.h"
37
38//#include "RackOp.h"
39#include "PolarProductOp.h"
40
41namespace rack
42{
43
44using namespace drain::image;
45
46
47
49
52class ConvOp : public PolarProductOp {
53
54public:
55
57
65 /* EI KÄYTÖSSÄ \subsection alg_Cb
66 *
67 * Radar measurement is sparse; the dBZ threshold lies seldom at the beam but more often between two beams or outside all the beams.
68 * In computing the
69 *
70 * - (a) Between lower and higher dBZ: the height is interpolated
71 * - (b) Under \c undetect and above higher dBZ: the height is interpolated, assuming reference measurement \f$ (z_{r},h_{r}) \f$
72 * - (c) Above two highest beams, which have higher, decreasing dBZ values : the height is extrapolated
73 * - (d) Above two highest beams, which have higher, increasing dBZ values : the height is extrapolated; lower quality is assigned
74 * - (e) Above higher dBZ and \undetect measurement : the height is extrapolated; lower quality is assigned
75 *
76 * \image html Cb-principle.png "The location of the dBZ threshold with respect to measurements on the beam."
77 * \image latex Cb-principle.png "The location of the dBZ threshold with respect to measurements on the beam."
78 *
79 */
81
113 //
114 ConvOp(double maxEchoThreshold = 25.0, double cellDiameter = 3.0, double echoTopThreshold = 2.0, double echoTopDBZ = 20.0, double smoothRad = 0.0, double smoothAzm = 0.0) :
115 PolarProductOp(__FUNCTION__, "Computes the probability of convection based on fuzzy cell intensity, area and height."), top(true) {
116
117 parameters.link("maxEchoThreshold", this->maxEchoThreshold = maxEchoThreshold, "dBZ");
118 parameters.link("cellDiameter", this->cellDiameter = cellDiameter, "km");
119 parameters.link("echoTopThreshold", this->echoTopThreshold = echoTopThreshold, "km");
120 parameters.link("echoTopDBZ", this->echoTopDBZ = echoTopDBZ, "dBZ");
121
122 parameters.link("smoothAzm", this->smoothAzm = smoothAzm, "deg");
123 parameters.link("smoothRad", this->smoothRad = smoothRad, "km");
124
125 allowedEncoding.link("nbins", odim.area.width = 0l);
126 allowedEncoding.link("rscale", odim.rscale = 0.0);
127
128
129 allowedEncoding.link("undetect", odim.undetect = 0.0);
130 allowedEncoding.link("nodata", odim.nodata = 0.0);
131
132 dataSelector.setQuantities("^DBZH$");
133
134 odim.product = "CONVECTION";
135 odim.quantity = "PROB";
136 //odim.scaling.scale = 1.0/250.0;
137 //odim.scaling.offset = 0;
138 };
139
140
141
142
143 double maxEchoThreshold;
144 double echoTopDBZ;
145 double cellDiameter;
146 double echoTopThreshold;
147
148 double smoothAzm;
149 double smoothRad;
150
151 const bool top;
152
153protected:
154
155 void computeSingleProduct(const DataSetMap<PolarSrc> & srcSweeps, DataSet<PolarDst> & dstProduct) const;
156 // virtual
157 // void filter(const Hi5Tree & src, const std::map<double,std::string> & srcPaths, Hi5Tree &dst) const;
158
159
160};
161
162
163
164
165
166} // ::rack
167
168#endif /*POLARCbTOP_H_*/
169
170// Rack
Computes Cb s or bottoms in kilometers for a given dBZ threshold, typically 20, 40 or 45 dBZ.
Definition ConvOp.h:52
ConvOp(double maxEchoThreshold=25.0, double cellDiameter=3.0, double echoTopThreshold=2.0, double echoTopDBZ=20.0, double smoothRad=0.0, double smoothAzm=0.0)
Currently type and gain are not handled due to char<=> int mapping problem.
Definition ConvOp.h:114
void computeSingleProduct(const DataSetMap< PolarSrc > &srcSweeps, DataSet< PolarDst > &dstProduct) const
Definition ConvOp.cpp:66
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:282
Definition Data.h:1370
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1215
Base class for flat (2D) products computed in the polar coordinate system. Volume is used as input.
Definition PolarProductOp.h:59
drain::ReferenceMap allowedEncoding
Defines which encoding parameters can be changed by the user from command line.
Definition ProductBase.h:205
MD odim
The default data parameters for encoding output (the product).
Definition RadarProductOp.h:101
Namespace for images and image processing tools.
Definition AccumulationArray.cpp:45
Definition DataSelector.cpp:44