General Purpose Geodetic Library
SgMeteoData.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #include <iostream>
24 #include <stdlib.h>
25 
26 
27 #include <SgMeteoData.h>
28 #include <SgLogger.h>
29 #include <SgVlbiStationInfo.h>
30 
31 
32 
33 /*=======================================================================================================
34 *
35 * METHODS:
36 *
37 *======================================================================================================*/
38 //
39 // static first:
40 double SgMeteoData::dewPt2Rho(double temperature, double dewPtTemperature)
41 {
42  const double a = 17.271; //pwxcb: 17.269
43  const double b = 237.7; //pwxcb: 237.3
44  // These values are taken by Ronnie from Wikipedia:
45  // "http://en.wikipedia.org/wiki/Dew_point"
46 
47  return exp(a*dewPtTemperature/(b + dewPtTemperature) - a*temperature/(b + temperature));
48 };
49 
50 
51 
52 //
53 double SgMeteoData::temperature(double height, const SgVlbiStationInfo* stnInfo) const
54 {
55  double t(temperature_);
56  if (t<-70.0 || t>50.0 ||
61  {
62  //
63  // /mk5/libs/cutil/metfix.f:
64  // TEMP=293.15D0-(6.5D-3)*ALT-273.16D0
65  //
66  t = 293.15 - 6.5e-3*height - 273.16;
67  };
68 
69  return t;
70 };
71 
72 
73 
74 //
75 double SgMeteoData::pressure(double height, const SgVlbiStationInfo* stnInfo) const
76 {
77  double p(pressure_);
78  if (p<600.0 || p>1100.0 ||
83  {
84  // p = 1013.0*exp(-0.03412476651981319179/(273.15 + 10.0)*height);
85  //
86  // /mk5/libs/cutil/metfix.f:
87  // X=1.D0-(6.5D-3)*ALT/293.15D0
88  // ATMPR=1013.25D0*(X**5.26D0)
89  //
90  p = 1013.25*pow(1.0 - 6.5e-3*height/293.15, 5.26);
91  };
92 
93  return p;
94 };
95 
96 
97 
98 //
99 double SgMeteoData::relativeHumidity(double /*height*/, const SgVlbiStationInfo* stnInfo) const
100 {
101  double rho(relativeHumidity_);
102  if (rho < 0.0)
103  rho = 0.0;
104  if (1.0 < rho)
105  rho = 1.0;
109  rho = 0.5;
110 
111  return rho;
112 };
113 /*=====================================================================================================*/
114 //
115 // FRIENDS:
116 //
117 /*=====================================================================================================*/
118 //
119 
120 /*=====================================================================================================*/
121 //
122 // aux functions:
123 //
124 
125 /*=====================================================================================================*/
126 //
127 // constants:
128 //
129 
130 
131 
132 
133 /*=====================================================================================================*/
bool isAttr(uint a) const
Definition: SgAttribute.h:226
double temperature(double height, const SgVlbiStationInfo *stnInfo) const
Definition: SgMeteoData.cpp:53
double relativeHumidity_
Definition: SgMeteoData.h:158
double relativeHumidity(double height, const SgVlbiStationInfo *stnInfo) const
Definition: SgMeteoData.cpp:99
double temperature_
Definition: SgMeteoData.h:156
double pressure_
Definition: SgMeteoData.h:157
static double dewPt2Rho(double temperature, double dewPtTemperature)
Definition: SgMeteoData.cpp:40
@ Attr_ARTIFICIAL_DATA
data are artificial (mean values or some model);
Definition: SgMeteoData.h:52
@ Attr_BAD_DATA
data readings are wrong;
Definition: SgMeteoData.h:51
double pressure(double height, const SgVlbiStationInfo *stnInfo) const
Definition: SgMeteoData.cpp:75
@ Attr_ART_METEO
indicates that the station has artificial meteo parameters;
@ Attr_BAD_METEO
indicates that the station has bad meteo parameters;