RainRateOp.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 #ifndef RAINRATEOP_H_
32 #define RAINRATEOP_H_
33 
34 //#include <algorithm>
35 
36 #include "radar/Precipitation.h"
37 
38 #include "PolarProductOp.h"
39 
40 
41 namespace rack
42 {
43 
44 using namespace drain::image;
45 
47 
48 public:
49 
50  FreezingLevel() : BeanLike(__FUNCTION__, "Freezing level modelled simply as its height and thickness."){
51  parameters.link("height", height = NAN, "km");
52  parameters.link("thickness", thickness = 0.1, "km");
53  }
54 
55  virtual
56  ~FreezingLevel(){};
57 
58  double height;
59  double thickness;
60 
61 };
62 
64 
70 class RainRateOp : public PolarProductOp {
71 
72 public:
73 
74  static PrecipZrain precipZrain;
75  static PrecipZsnow precipZsnow;
76  static PrecipKDP precipKDP;
77  static PrecipKDPZDR precipKDPZDR;
78  static PrecipZZDR precipZZDR;
79 
80  static FreezingLevel freezingLevel;
81 
83 
101  // TODO: freezinglevel as a polar pre-prod.
102  RainRateOp(double freezingLevel = 10.0, double freezingLevelThickness = 0.2, double z_ra=200.0, double z_rb=1.6, double z_sa=2000.0, double z_sb=2.0) :
103  //RackOp("RainRate", "Computes rain rate [mm/h] from reflectance [dBZ].") {
104  PolarProductOp(__FUNCTION__, "Estimates precipitation rate [mm/h] from reflectance [dBZ].") {
105 
106  dataSelector.setQuantities("^DBZH$");
107  dataSelector.setMaxCount(1);
108 
109  odim.product = "SURF";
110  odim.quantity = "RATE";
111 
112  // defaultEncoding="S,0.0001,220"
113  // target="S,0.0001,220"
114 
115  odim.type = "S";
116  }
117 
118 
119 protected:
120 
121  virtual
122  void processData(const Data<PolarSrc> & srcData, Data<PolarDst> & dstData) const;
123 
124 };
125 
126 
127 
128 
129 
130 } // ::rack
131 
132 #endif /*RainRate_H_*/
133 
134 // Rack
Something which has a name, a description and possibly some parameters of varying type.
Definition: BeanLike.h:60
Data structure consisting of plain data and an optional quality data.
Definition: Data.h:1144
Definition: RainRateOp.h:46
Base class for flat (2D) products computed in the polar coordinate system. Volume is used as input.
Definition: PolarProductOp.h:61
Definition: Precipitation.h:274
Definition: Precipitation.h:207
Definition: Precipitation.h:239
Definition: Precipitation.h:187
Definition: Precipitation.h:196
Computes rain rate from dBZ.
Definition: RainRateOp.h:70
RainRateOp(double freezingLevel=10.0, double freezingLevelThickness=0.2, double z_ra=200.0, double z_rb=1.6, double z_sa=2000.0, double z_sb=2.0)
Currently type and gain are not handled due to char<=> int mapping problem.
Definition: RainRateOp.h:102
Namespace for images and image processing tools.
Definition: AccumulationArray.cpp:45
Definition: DataSelector.cpp:44