CumulativeProductOp.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 
32 #ifndef CumulativePolarProduct_OP_H_
33 #define CumulativePolarProduct_OP_H_
34 
35 #include <drain/Log.h>
36 #include "drain/util/Fuzzy.h"
37 #include "drain/image/Accumulator.h"
38 
39 #include "radar/Geometry.h"
40 #include "radar/Constants.h"
41 #include "radar/RadarAccumulator.h"
42 #include "data/Data.h"
43 
44 #include "PolarProductOp.h"
45 // temporary?
46 
47 
48 namespace rack {
49 
50 using namespace drain::image;
51 
52 
54 
60 
61 public:
62 
64  virtual inline
65  const std::string & getOutputQuantity(const std::string & inputQuantity = "") const {
66  if (!inputQuantity.empty())
67  return inputQuantity; //outputQuantity;
68  else
69  return odim.quantity;
70  }
71 
72  // Public for ConvOp
73  virtual
74  void computeSingleProduct(const DataSetMap<PolarSrc> & srcSweeps, DataSet<PolarDst> & dstProduct) const;
75 
76 
77 
78 protected:
79 
80  inline
81  CumulativeProductOp(const std::string & name = __FUNCTION__,
82  const std::string &description = "", const std::string & accumulationMethod = "LATEST") :
83  PolarProductOp(name, description), accumulationMethod(accumulationMethod){
84  // , undetectValue(-40), relativeUndetectWeight(0.95) { // , method(method), p(p), q(q)
85  // dataSelector.path = "^.*/data[0-9]+$";
86 
87  // Empty values imply automagic
88  odim.type = "";
89  odim.scaling.scale = 0.0;
90  odim.area.height = 0;
91  odim.area.width = 0;
92  odim.rscale = 0.0;
93 
94  };
95 
96  inline
97  CumulativeProductOp(const CumulativeProductOp & op) : PolarProductOp(op){};
98 
99  std::string accumulationMethod;
100 
101  virtual
102  inline
103  void setGeometry(const PolarODIM & srcODIM, PlainData<PolarDst> & dstData) const {
104  drain::Logger mout(__FILE__, __FUNCTION__); //REPL name+"(CumulativeProductOp)", __FUNCTION__);
105  mout.warn("setGeometry??" );
106  copyPolarGeometry(dstData.odim, dstData);
107  }
108 
109 
110  virtual
111  void processData(const Data<PolarSrc> & src, RadarAccumulator<Accumulator,PolarODIM> & cumulator) const = 0;
112 
113 
114 };
115 
116 
117 } // rack::
118 
119 #endif
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Base class for flat (2D) products computed in the polar coordinate system.
Definition: CumulativeProductOp.h:59
virtual const std::string & getOutputQuantity(const std::string &inputQuantity="") const
Returns the primary output quantity (ODIM what:quantity , like DBZH)
Definition: CumulativeProductOp.h:65
Definition: Data.h:1368
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition: Data.h:1213
Base class for flat (2D) products computed in the polar coordinate system. Volume is used as input.
Definition: PolarProductOp.h:61
Namespace for images and image processing tools.
Definition: AccumulationArray.cpp:45
Definition: DataSelector.cpp:44