Loading...
Searching...
No Matches
DopplerOp.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 DOPPLER_OP_H_
33#define DOPPLER_OP_H_
34
35#include "PolarProductOp.h"
36
37//#include "radar/Doppler.h"
38#include "radar/PolarSector.h"
39
40
41namespace rack {
42
43
45
49class DopplerOp : public PolarProductOp {
50
51public:
52
53
54 /*
55 DopplerOp() : PolarProductOp(__FUNCTION__, "Projects Doppler speeds to unit circle. Window corners as (azm,range) or (ray,bin)") {
56 parameters.append(w.getParameters());
57 dataSelector.quantity = "^(VRAD|VRADH)$";
58 dataSelector.setMaxCount(1);
59 };
60 */
61
62 virtual inline ~DopplerOp(){};
63
64 //mutable PolarSector w;
65
67 // raise
68 static inline
69 double project(double azmR, double u, double v) {
70 // double speed = sqrt(u*u + v*v);
71 return u*sin(azmR) + v*cos(azmR);
72 }
73
74
75 // Re-alias
76 // x - 2*Vm*math.floor((Vm+x)/2.0/Vm)
77 static inline
78 double alias(double v, double vNyq) {
79 return v - (2.0*vNyq)*floor((vNyq + v)/(2.0*vNyq)); // consider vNyq2
80 }
81
82 static
83 const drain::RegExp regExpVRAD;
84
85protected:
86
87 DopplerOp(const std::string & name, const std::string &description) : PolarProductOp(name, description){
88 //dataSelector.quantity = "VRADH?";
89 dataSelector.setQuantities("^VRADH?$"); // avoid VRADDH
90 dataSelector.setMaxCount(1);
91 // dataSelector.selectPRF = DataSelector::Prf::DOUBLE;
92 }
93
94 //virtual void processDataSet(const DataSet<PolarSrc> & srcSweep, DataSet<PolarDst> & dstProduct) const ;
95
96
97};
98
99
101
104class DopplerDiffOp : public DopplerOp { // DopplerWindow unused!
105public:
106
107
109
112 DopplerDiffOp(double dMaz = 100.0) : DopplerOp(__FUNCTION__, "Azimuthal difference of VRAD") { //, widthM, heightD) {
113 //parameters.link("width", this->widthM = widthM, "metres");
114 parameters.link("dMax", this->dMax = dMax, "m/s");
115
116 dataSelector.setQuantities("VRAD.*");
117
118 dataSelector.setMaxCount(1);
119
120 odim.type = "S";
121 odim.quantity = "VRAD_DIFF";
122
123 };
124
125 virtual inline
126 ~DopplerDiffOp(){};
127
128 double dMax;
129
130 virtual
131 void processData(const Data<PolarSrc> & vradSrc, Data<PolarDst> & dstData) const;
132
133protected:
134
135
136};
137
138
139// for Testing
141public:
142
143 inline
144 DopplerReprojectOp() : DopplerOp(__FUNCTION__, "Creates virtual ") {
145
146 parameters.link("nyquist", odim.NI = 100.0, "max-unamb-velocity");
147 parameters.link("match", matchOriginal=0, "flag(aliased=1,nodata=2)"); // ALIASED=1, NODATA=2
148 parameters.link("quantity", odim.quantity = "VRAD", "output-quantity");
149
150 dataSelector.setMaxCount(1);
151 dataSelector.setQuantities("^(AMVU|AMVV|VRAD)$");
152
153 //odim.quantity; // VRAD_C
154 odim.type = "S";
155 }
156
157 // void processData(const Data<PolarSrc> & srcData, Data<PolarDst> & dstData) const;
158 virtual
159 void processDataSet(const DataSet<PolarSrc> & srcSweep, DataSet<PolarDst> & dstProduct) const;
160
161
162 int matchOriginal = 0;
163
164
165};
166
167
168// for Testing
170public:
171
172 inline
173 DopplerCrawlerOp() : DopplerOp(__FUNCTION__, "Creates virtual ") {
174
175 parameters.link("nyquist", odim.NI = 100.0, "max-unamb-velocity");
176 parameters.link("threshold", relative_NI_threshold=0.9, "relative speed");
177 //parameters.link("quantity", odim.quantity = "VRAD", "output-quantity");
178
179 dataSelector.setMaxCount(1);
180 dataSelector.setQuantities("^VRAD");
181
182 odim.quantity = "VRAD";
183 odim.type = "S";
184 }
185
186 virtual
187 void processData(const Data<src_t > & srcData, Data<dst_t > & dstData) const;
188
189 double relative_NI_threshold;
190
191
192};
193
194
195} // namespace rack
196
197
198#endif /* RACKOP_H_ */
199
200// Rack
Definition RegExp.h:58
void setQuantities(const std::string &s)
Sets basic quantities and quality quantities. These sets are separated by '/'.
Definition DataSelector.cpp:282
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1215
Data structure consisting of plain data and an optional quality data.
Definition Data.h:1146
Definition DopplerOp.h:169
Experimental.
Definition DopplerOp.h:104
DopplerDiffOp(double dMaz=100.0)
Constructor.
Definition DopplerOp.h:112
Base class for computing products using Doppler speed [VRAD] data.
Definition DopplerOp.h:49
static double project(double azmR, double u, double v)
Projects wind (u,v) to beam direction (rad). Unit (typically m/s) is preserved.
Definition DopplerOp.h:69
Definition DopplerOp.h:140
virtual void processDataSet(const DataSet< PolarSrc > &srcSweep, DataSet< PolarDst > &dstProduct) const
Definition DopplerOp.cpp:116
Base class for flat (2D) products computed in the polar coordinate system. Volume is used as input.
Definition PolarProductOp.h:59
MD odim
The default data parameters for encoding output (the product).
Definition RadarProductOp.h:101
Definition DataSelector.cpp:44