32 #include <drain/RegExp.h>
34 #include "drain/util/BeanLike.h"
36 #ifndef RACK_PRECIPITATION
37 #define RACK_PRECIPITATION
46 Precip(
const std::string & name =
"",
const std::string & description =
"") :
drain::BeanLike(name, description) {
95 std::map<std::string,std::string>
presets;
109 double rainRate(
double p)
const = 0;
114 SingleParamPrecip(
const std::string & name =
"",
const std::string & description =
""):
115 Precip(name,description) {
127 double rainRate(
double p1,
double p2)
const = 0;
132 DoubleParamPrecip(
const std::string & name =
"",
const std::string & description =
""):
133 Precip(name,description) {
146 PrecipZ(
const std::string & name=__FUNCTION__,
double a=200.0,
double b=1.6) :
148 parameters.link(
"a", this->a = a);
149 parameters.link(
"b", this->b = b);
155 parameters.
copyStruct(p.getParameters(), p, *
this);
170 double rainRate(
double dbz)
const {
171 return pow(aInv * pow(10.0, dbz*0.10), bInv);
192 presets[
"Marshall-Palmer"] =
"200,1.6";
214 parameters.link(
"a", a);
215 parameters.link(
"b", b);
216 presets[
"Leinonen2012"] =
"21,0.72";
220 parameters.
copyStruct(p.getParameters(), p, *
this);
227 double rainRate(
double kdp)
const {
229 r = a * ::pow(kdp, b);
243 PrecipZZDR(
double a=0.0122,
double b=0.820,
double c=-2.28) :
244 DoubleParamPrecip(__FUNCTION__,
"Precipitation rate from Z and ZDR"), a(a), b(b), c(c) {
245 parameters.link(
"a", this->a);
246 parameters.link(
"b", this->b);
247 parameters.link(
"c", this->c);
253 parameters.
copyStruct(p.getParameters(), p, *
this);
261 double rainRate(
double dbz,
double zdr)
const {
263 r = a * ::pow(dbz, b) * pow(zdr, c);
279 PrecipKDPZDR(
double a=29.7,
double b=0.890,
double c=-0.927) :
280 DoubleParamPrecip(__FUNCTION__,
"Precipitation rate from KDP and ZDR"), a(a), b(b), c(c) {
281 parameters.link(
"a", a);
282 parameters.link(
"b", b);
283 parameters.link(
"c", c);
288 parameters.
copyStruct(p.getParameters(), p, *
this);
293 double rainRate(
double kdp,
double zdr)
const {
295 r = a * ::pow(kdp, b) * ::pow(zdr, c);
Something which has a name, a description and possibly some parameters of varying type.
Definition: BeanLike.h:60
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:399
char separator
Default character used for splitting input and output. See setValues.
Definition: SmartMap.h:85
Definition: Precipitation.h:122
Definition: Precipitation.h:274
Definition: Precipitation.h:207
Definition: Precipitation.h:239
Definition: Precipitation.h:141
virtual void updateBean() const override
Called after setParameters()
Definition: Precipitation.h:161
Definition: Precipitation.h:187
Definition: Precipitation.h:196
Definition: Precipitation.h:41
std::map< std::string, std::string > presets
Redefined such that if argument is a preset, reinvoke with its arguments.
Definition: Precipitation.h:53
Definition: Precipitation.h:104
Definition: DataSelector.cpp:44