Geometry.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 GEOMETRY_RADAR_H_
32 #define GEOMETRY_RADAR_H_
33 
34 
35 #include <sstream>
36 #include <vector>
37 //#include "drain/util/Proj4.h"
38 #include "drain/image/GeoFrame.h"
39 
40 // // using namespace std;
41 
42 namespace rack
43 {
44 
45 
46 // See also RadarProj @ Coordinates?
47 
48 
85 class Geometry
86 {
87 public:
88  Geometry();
89  virtual ~Geometry();
90 
92  static
93  double heightFromEtaBeam(double eta, double b);
94 
96  static
97  double heightFromEtaBeta(double eta, double beta);
98 
100  static
101  double heightFromEtaGround(double eta, double g);
102 
103  static inline
104  double betaFromGround(double g){ return g / EARTH_RADIUS_43; }; // SHOULD BE EARTH_RADIUS
105 
106  static
107  double beamFromBetaH(double beta,double h);
108 
109  static
110  double beamFromEtaH(double eta,double h);
111 
112  static
113  double beamFromEtaBeta(double eta,double beta);
114 
115  static
116  double beamFromEtaGround(float eta,float g);
117 
118  //inline unsigned int binFromEtaBeta(double eta,double beta){
119  // return static_cast<unsigned int>(binDepth/2 + binDepth*beamFromEtaBeta(beta,eta));};
120 
121  static double groundFromEtaBeam(double eta, double beam);
122  static double gammaFromEtaH(double eta, double height);
123 
124  static inline
125  double groundFromEtaH(double eta,double h){ return EARTH_RADIUS_43*gammaFromEtaH(eta,h); }; //EARTH_RADIUS
126 
127  static
128  double etaFromBetaH(double beta,double h);
129 
130  double bFromGH(double g,double h);
131 
132  static
133  double etaFromGH(double g,double h);
134 
135 
136  double normalizedBeamPower(double angle);
137 
138  void findClosestElevations(const float &elevationAngle,
139  int &elevationIndexLower,float &elevationAngleLower,int &elevationIndexUpper, float &elevationAngleUpper);
140 
141  float beamWidth;
142 
143  // new
144  //static int EARTH_RADIUSi;
145  //static double EARTH_RADIUS;
146  static double EARTH_RADIUS_43;
147 
148 
150  std::vector<float> elevationAngles;
151  std::vector<unsigned int> bins;
152 };
153 
154 } // rack::
155 
156 
157 #endif /*GEOMETRY_H_*/
158 
159 // Rack
Definition: Geometry.h:145
Geometry(size_t width=0, size_t height=0, size_t channels=1, size_t alphas=0)
Constructor with dimensions. Channel count is one by default, allowing construction with width and he...
Definition: Geometry.h:159
static double heightFromEtaBeta(double eta, double beta)
Altitude, given elevation [rad] and ground angle [rad].
Definition: Geometry.cpp:143
static double beamFromEtaH(double eta, double h)
The on-beam distance at (elevation) and (altitude).
Definition: Geometry.cpp:186
static double beamFromBetaH(double beta, double h)
Definition: Geometry.cpp:171
static double etaFromBetaH(double beta, double h)
Given ground angle beta and altitude h, returns the elevation angle.
Definition: Geometry.cpp:286
static double beamFromEtaBeta(double eta, double beta)
The on-beam distance at (elevation) and ground angle (beta).
Definition: Geometry.cpp:204
static double beamFromEtaGround(float eta, float g)
The on-beam distance at (elevation) and ground distance (groundDist).
Definition: Geometry.cpp:219
static double gammaFromEtaH(double eta, double height)
Given elevation angle eta and altitude h, returns the ground angle.
Definition: Geometry.cpp:257
static double etaFromGH(double g, double h)
Given ground distance g and altitude h, returns elevation angle.
Definition: Geometry.cpp:309
std::vector< float > elevationAngles
Note: radians!
Definition: Geometry.h:150
static double groundFromEtaBeam(double eta, double beam)
Given elevation in radians and on-beam distance, returns the distance from radar to the ground point ...
Definition: Geometry.cpp:237
static double heightFromEtaGround(double eta, double g)
Altitude, given elevation [rad] and ground distance [m].
Definition: Geometry.cpp:155
static double heightFromEtaBeam(double eta, double b)
Altitude, given elevation [rad] and bin distance [m].
Definition: Geometry.cpp:111
Definition: DataSelector.cpp:44
const double EARTH_RADIUS_43
The standard 4/3 radius applied in radar to compensate the decreasing density of the atmosphere.
Definition: Constants.h:53