AntarcticAtmosphere.h
1 #ifndef _ANTARCTIC_ATMOSPHERE_H
2 #define _ANTARCTIC_ATMOSPHERE_H
3 
4 /* Various routines for atmospheric modeling
5  *
6  * Some things depend on GeographicLib
7  *
8  **/
9 
10 #include "TGraph.h"
11 #include "TF1.h"
12 #include <set>
13 #include <utility>
14 
15 
16 class Adu5Pat;
17 namespace AntarcticAtmosphere
18 {
19 
23  enum Geoid
24  {
25  EGM96_5,
26  EGM2008_1
27  };
28 
30  double MSLtoWGS84( double h, double lat, double lon, Geoid g = EGM96_5) ;
31 
33  double WGS84toMSL( const Adu5Pat * pat, Geoid g = EGM96_5) ;
34  double WGS84toMSL( double lat, double lon, double alt, Geoid g = EGM96_5) ;
35 
36 
39  struct Pars
40  {
41  double rho; //kg / m^3
42  double P; //mb
43  double T; //Kelvin
44  double N; //refractivity in units of (n-1) * 1e6
45  };
46 
47  enum Par
48  {
49  DENSITY,
50  PRESSURE,
51  TEMPERATURE,
52  REFRACTIVITY
53  };
54 
55 
56 
58  {
59  public:
60  //h in m (msl), phi in radians (for position-dependent models. most models this has no effect)
61  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const= 0;
62  virtual double get(double h, Par p, double phi = 0) const;
63  TGraph * makeGraph(double hmin, double hmax, int nh, Par P, bool alt_on_x=true, double phi = 0) const;
64  virtual ~AtmosphericModel() { ; }
65  virtual const char * name() const { return "atmospheric model"; }
66  };
67 
68 
69 
71  {
72 
73  public:
75  void addModel(const AtmosphericModel * m, double phi) { atms.insert(std::pair<double,const AtmosphericModel *>(phi,m));}
76  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const;
77  private:
78  std::set<std::pair<double, const AtmosphericModel *> > atms;
79  };
80 
81 
83  {
84  public:
85 
87  SPRadiosonde(int year, int month, int day, bool early = true);
88 
89  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const;
90 
91  double max_unextrapolated_height() const { return N.GetX()[N.GetN()-1]; }
92  double min_height() const { return N.GetX()[0]; }
93  bool ok() const { return loaded; }
94  virtual const char * name() const { return my_name.Data(); }
95 
96  const TGraph * raw_N() const { return &N ; }
97 
98  private:
99  bool loaded;
100  TGraph P;
101  TGraph T;
102  TGraph N;
103  TGraph rho;
104  TString my_name;
105  TF1 Nfit;
106  TF1 Pfit;
107  TF1 Tfit;
108  TF1 rhofit;
109  };
110 
111 
112 
113 
114 
115 
117  {
118  public:
119  StandardUS(double sea_level_T_kelvin = 265, double sea_level_P_mbar = 970)
120  {
121  sea_level_T = sea_level_T_kelvin;
122  sea_level_P = sea_level_P_mbar;
123  }
124  virtual ~StandardUS() { ;}
125 
126  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const;
127  virtual const char * name() const { return "Standard US"; }
128  protected:
129  double sea_level_T;
130  double sea_level_P;
131  };
132 
135  {
136  public:
137  ExponentialRefractivity(double a = 315, double b = 0.1361e-3) : StandardUS() {k_A = a ; k_B =b; my_name.Form("exponential refractivity, a = %g, b =%g", k_A, k_B); }
138 
139  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const;
140  virtual double get(double h, Par p, double phi = 0) const;
141  virtual ~ExponentialRefractivity() {; }
142  virtual const char * name() const { return my_name.Data(); }
143 
144  protected:
145  double k_A, k_B;
146  TString my_name;
147 
148  };
149 
150  const ExponentialRefractivity & ITURefractivity();
151 
152 
153 
154 
156  {
157  public:
158  ArtificialInversion(const AtmosphericModel & base, double max_height, double max_ampl)
159  : m(base), hmax(max_height), Amax(max_ampl) {; }
160  virtual int computeAtmosphere(double h, Pars * p, double phi = 0) const;
161  virtual double get(double h, Par p, double phi = 0) const;
162  private:
163  const AtmosphericModel & m;
164  double hmax;
165  double Amax;
166  double correction(double h) const;
167  };
168 }
169 
170 
171 
172 #endif
Adu5Pat – The ADU5 Position and Attitude Data.
Definition: Adu5Pat.h:26
SPRadiosonde(int year, int month, int day, bool early=true)