Constants.h
Go to the documentation of this file.
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 RADAR__CONSTANTS
32 #define RADAR__CONSTANTS "radar__constants 1.0, May 27 2006 Markus.Peura@fmi.fi"
33 
34 //
35 #include <math.h>
36 
37 #include "drain/image/CoordinateHandler.h"
38 
39 
43 // 6,370
44 namespace rack {
45 
46 
48 const int EARTH_RADIUSi = 6371000;
50 const double EARTH_RADIUS = static_cast<double>(EARTH_RADIUSi);
51 
53 const double EARTH_RADIUS_43 = EARTH_RADIUS * 4.0 / 3.0;
54 
55 const int earthRadiusMI = 6371000; // WHY THIS AS WELL
56 const int earthRadius43MI = (earthRadiusMI * 4) / 3;
57 const float earthRadius43MF = static_cast<float>(earthRadiusMI) * 4.0 / 3.0;
58 
59 
60 
61 
67 template <class T>
68 inline
69 double dbzToZ(const T &dBZ){
70  //z = ::pow(10.0,dbz*0.10);
71  //return pow(10.0, static_cast<double>(dBZ)/10.0 );
72  return ::pow(10.0,static_cast<double>(dBZ) * 0.1);
73 }
74 
80 template <class T>
81 inline
82 double zToDbz(const T &Z){
83  //static const double coeff = 10.0 / log(10.0);
84  //coeff * log( static_cast<double>(Z) ) ;
85  return 10.0 * ::log10( static_cast<double>(Z) ) ;
86 }
87 
88 
89 } // ::rack
90 
91 
92 #endif
93 
94 // Rack
Definition: DataSelector.cpp:44
const double EARTH_RADIUS
Approximated radius of Earth, integer.
Definition: Constants.h:50
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
double dbzToZ(const T &dBZ)
Definition: Constants.h:69
double zToDbz(const T &Z)
Definition: Constants.h:82
const int EARTH_RADIUSi
Approximated radius of Earth, integer.
Definition: Constants.h:48