ReFRACtor
refractive_index.h
Go to the documentation of this file.
1 #ifndef REFR_INDEX_H
2 #define REFR_INDEX_H
3 
4 #include <blitz/array.h>
5 #include "auto_derivative.h"
6 
7 namespace FullPhysics {
8 
9  AutoDerivative<double> refr_index_rs(double bwpar, const AutoDerivative<double>& press, const AutoDerivative<double>& temp);
10  AutoDerivative<double> refr_index_vn(double wl, const AutoDerivative<double>& p, const AutoDerivative<double>& T, const AutoDerivative<double>& xc, const AutoDerivative<double>& xw);
11 
12  AutoDerivative<double> calc_Dair(const AutoDerivative<double>& p, const AutoDerivative<double>& tc);
13  double calc_nw(double wlm2);
14  AutoDerivative<double> calc_Z(const AutoDerivative<double>& p, const AutoDerivative<double>& T, const AutoDerivative<double>& tc, const AutoDerivative<double>& xw);
15  AutoDerivative<double> calc_rho(const AutoDerivative<double>& p, const AutoDerivative<double>& x, const AutoDerivative<double>& M, const AutoDerivative<double>& Z, const AutoDerivative<double>& T);
16 
17 /****************************************************************/
23 
24 public:
25 
26  virtual ~AtmRefractiveIndex() { }
27  //-----------------------------------------------------------------------
29  //-----------------------------------------------------------------------
30  virtual int number_level() const = 0;
31 
32  //-----------------------------------------------------------------------
34  //-----------------------------------------------------------------------
35  virtual int number_layer() const { return number_level() - 1; }
36 
37  //-----------------------------------------------------------------------
39  //-----------------------------------------------------------------------
40  virtual AutoDerivative<double> at_level(int level_index) const = 0;
41 
42  //-----------------------------------------------------------------------
44  //-----------------------------------------------------------------------
45  virtual blitz::Array<AutoDerivative<double>, 1> level_values() const {
46  blitz::Array<AutoDerivative<double>, 1> res(number_level());
47  for(int li = 0; li < number_level(); li++)
48  res(li) = at_level(li);
49  return res;
50  }
51 
52  //-----------------------------------------------------------------------
55  //-----------------------------------------------------------------------
56  virtual AutoDerivative<double> at_layer(int layer_index, const AutoDerivative<double>& interp_val) const = 0;
57 
58  //-----------------------------------------------------------------------
61  //-----------------------------------------------------------------------
62  virtual blitz::Array<AutoDerivative<double>, 1> layer_values(const blitz::Array<AutoDerivative<double>, 1>& interp_vals) const {
63  range_max_check(interp_vals.rows(), number_layer()+1);
64  blitz::Array<AutoDerivative<double>, 1> res(number_layer());
65  for(int li = 0; li < number_layer(); li++)
66  res(li) = at_layer(li, interp_vals(li));
67  return res;
68  }
69 
70  //-----------------------------------------------------------------------
73  //-----------------------------------------------------------------------
74  virtual AutoDerivative<double> at_layer_midpoint(int layer_index) const {
75  return at_layer(layer_index, 0.5);
76  }
77 
78  //-----------------------------------------------------------------------
80  //-----------------------------------------------------------------------
81  virtual blitz::Array<AutoDerivative<double>, 1> layer_midpoint_values() const {
82  blitz::Array<AutoDerivative<double>, 1> interp_vals(number_layer());
83  interp_vals = 0.5;
84  return layer_values(interp_vals);
85  }
86 
87 };
88 
89 /****************************************************************/
95 
96 public:
98  SimpleRefractiveIndex(double bwpar,
99  const blitz::Array<AutoDerivative<double>, 1>& press,
100  const blitz::Array<AutoDerivative<double>, 1>& temp);
101 
102  virtual int number_level() const { return press_.rows(); }
103  virtual AutoDerivative<double> at_level(int level_index) const;
104  virtual AutoDerivative<double> at_layer(int layer_index, const AutoDerivative<double>& interp_val) const;
105 
106 private:
107  double bwpar_;
108  blitz::Array<AutoDerivative<double>, 1> press_;
109  blitz::Array<AutoDerivative<double>, 1> temp_;
110 
111 };
112 
113 /****************************************************************/
122 
123 public:
124 
131  OcoRefractiveIndex(double reference_wavelength,
132  const blitz::Array<AutoDerivative<double>, 1>& press,
133  const blitz::Array<AutoDerivative<double>, 1>& temp,
134  const blitz::Array<AutoDerivative<double>, 1>& co2_vmr,
135  const blitz::Array<AutoDerivative<double>, 1>& h2o_vmr);
136  virtual ~OcoRefractiveIndex() {}
137  virtual int number_level() const { return press_.rows(); }
138  virtual AutoDerivative<double> at_level(int level_index) const;
139  virtual AutoDerivative<double> at_layer(int layer_index, const AutoDerivative<double>& interp_val) const;
140 
143  static bool wavelength_in_bounds(double wavelength);
144 
145 private:
146  double ref_wvl_;
147  blitz::Array<AutoDerivative<double>, 1> press_;
148  blitz::Array<AutoDerivative<double>, 1> temp_;
149  blitz::Array<AutoDerivative<double>, 1> co2_vmr_;
150  blitz::Array<AutoDerivative<double>, 1> h2o_vmr_;
151 };
152 
153 
154 }
155 
156 #endif
AutoDerivative< double > calc_Z(const AutoDerivative< double > &p, const AutoDerivative< double > &T, const AutoDerivative< double > &tc, const AutoDerivative< double > &xw)
#define range_max_check(V, Max)
Range check.
Definition: fp_exception.h:194
virtual blitz::Array< AutoDerivative< double >, 1 > level_values() const
Returns refractive index at all levels.
virtual AutoDerivative< double > at_layer_midpoint(int layer_index) const
Convenience routine to returns refractive index ay layer index where layer data is taken as mean of b...
Computes refractive index per level/layer using a simple approximation using pressure and temperature...
virtual blitz::Array< AutoDerivative< double >, 1 > layer_values(const blitz::Array< AutoDerivative< double >, 1 > &interp_vals) const
Returns refractive index at all layers according to a mapping of where each layer value should be cal...
virtual AutoDerivative< double > at_layer(int layer_index, const AutoDerivative< double > &interp_val) const =0
Returns refractive index at a layer index interpolated between bounding levels using a linear interpo...
AutoDerivative< double > refr_index_vn(double wl, const AutoDerivative< double > &p, const AutoDerivative< double > &T, const AutoDerivative< double > &xc, const AutoDerivative< double > &xw)
AutoDerivative< double > calc_rho(const AutoDerivative< double > &p, const AutoDerivative< double > &x, const AutoDerivative< double > &M, const AutoDerivative< double > &Z, const AutoDerivative< double > &T)
virtual int number_level() const
Number of levels of atmospheric data represented.
AutoDerivative< double > calc_Dair(const AutoDerivative< double > &p, const AutoDerivative< double > &tc)
AutoDerivative< double > refr_index_rs(double bwpar, const AutoDerivative< double > &press, const AutoDerivative< double > &temp)
virtual int number_level() const
Number of levels of atmospheric data represented.
virtual int number_level() const =0
Number of levels of atmospheric data represented.
virtual blitz::Array< AutoDerivative< double >, 1 > layer_midpoint_values() const
Returns refractive index at the middle of each layer.
This class provides an interface for classes that compute a refractive index for an atmosphere at a g...
virtual int number_layer() const
Number of layers of atmospheric data represented.
Computes refractive index per level/layer using a method that takes into account knowledge of OCO spe...
virtual AutoDerivative< double > at_level(int level_index) const =0
Returns refractive index at a level index.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
double calc_nw(double wlm2)

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10