ReFRACtor
pressure_fixed_level.h
Go to the documentation of this file.
1 #ifndef PRESSURE_FIXED_LEVEL_H
2 #define PRESSURE_FIXED_LEVEL_H
3 #include "state_vector.h"
4 #include "observer.h"
5 #include "fp_exception.h"
6 #include "pressure_level_input.h"
7 #include "pressure_imp_base.h"
8 
9 namespace FullPhysics {
10 /****************************************************************/
18 public:
19  PressureFixedLevel(bool Pressure_flag,
20  const boost::shared_ptr<PressureLevelInput>& Press_level,
21  double Surface_pressure)
22  : press_level(Press_level)
23  {
24  blitz::Array<double, 1> coeff(1);
25  blitz::Array<bool, 1> used(1);
26  coeff(0) = Surface_pressure;
27  used(0) = Pressure_flag;
28  init(coeff, used);
29  cov.resize(1, 1);
30  cov(0,0) = 1;
31  }
32  virtual ~PressureFixedLevel() {}
33 
34 //-----------------------------------------------------------------------
36 //-----------------------------------------------------------------------
37 
39  {return (cov(0, 0) < 0 ? 0.0 : sqrt(cov(0, 0))); }
40 
41 //-----------------------------------------------------------------------
43 //-----------------------------------------------------------------------
44 
45  void set_surface_pressure(const AutoDerivative<double>& Surface_pressure)
46  {
47  coeff(0) = Surface_pressure;
48  cache_stale = true;
49  const blitz::Array<double, 1>& plev = press_level->pressure_level();
50  range_check(Surface_pressure.value(), plev(0),
51  plev(plev.rows() - 1));
53  }
54 
55 //-----------------------------------------------------------------------
58 //-----------------------------------------------------------------------
59 
60  int number_active_level() const
61  { return pressure_grid().value.rows(); }
62 
63 //-----------------------------------------------------------------------
66 //-----------------------------------------------------------------------
67 
68  int number_active_layer() const { return number_active_level() - 1; }
69 
70  static const double new_level_fractional_size;
71 
72 //-----------------------------------------------------------------------
74 //-----------------------------------------------------------------------
75 
76  int max_number_level() const {return press_level->pressure_level().rows();}
77 
78 //-----------------------------------------------------------------------
84 //-----------------------------------------------------------------------
85 
86  blitz::Array<double, 1> pressure_active_levels() const
87  { return press_level->pressure_level()
88  (blitz::Range(0, number_active_level() - 1)); }
89 
90  virtual void print(std::ostream& Os) const;
91 
92  virtual boost::shared_ptr<Pressure> clone() const;
93 
94  virtual std::string sub_state_identifier() const { return "surface_pressure"; }
95 
96  virtual std::string state_vector_name_i(int i) const
97  { return "Surface Pressure (Pascals)"; }
98 protected:
99  virtual void calc_pressure_grid() const;
100 private:
102 };
103 }
104 #endif
#define range_check(V, Min, Max)
Range check.
Definition: fp_exception.h:140
blitz::Array< double, 2 > cov
Last covariance matrix updated from the StateVector.
static const double new_level_fractional_size
Size a new level must be in porportion to the layer above it when resizing pressure grid due to moved...
void set_surface_pressure(const AutoDerivative< double > &Surface_pressure)
Set the surface pressure. This is in Pascals.
virtual ArrayAdWithUnit< double, 1 > pressure_grid() const
This returns the pressure grid to use for layer retrieval, along with the gradient of each of the pre...
virtual boost::shared_ptr< Pressure > clone() const
Clone a PressureFixedLevel object.
virtual std::string state_vector_name_i(int i) const
Return state vector name for ith entry in coeff.
int max_number_level() const
Maximum number of levels that we can have.
double surface_pressure_uncertainty() const
Return the current surface pressure uncertainty. This is in Pascals.
PressureFixedLevel(bool Pressure_flag, const boost::shared_ptr< PressureLevelInput > &Press_level, double Surface_pressure)
As a design principle, we have each base class with the absolutely minimum interface needed for use f...
void notify_update_do(const T &Self)
Function to call to notify Observers of a state change.
Definition: observer.h:121
virtual std::string sub_state_identifier() const
Return a string to identify this part of the state, this name should be all lower case and seperate p...
virtual void print(std::ostream &Os) const
Print to stream.
bool cache_stale
If this is true, the recalculate the pressure_grid the next time we need it.
virtual void calc_pressure_grid() const
Calculate the new pressure grid.
int number_active_layer() const
Number of active layers.
blitz::Array< double, 1 > pressure_active_levels() const
Return the pressure on the fixed levels, but only include the "active" portion.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
void init(const blitz::Array< double, 1 > &Coeff, const blitz::Array< bool, 1 > &Used_flag, const boost::shared_ptr< Pressure > &Press=boost::shared_ptr< Pressure >(), bool Mark_according_to_press=true, int Pdep_start=0)
const T & value() const
Convert to type T.
This class maintains the pressure portion of the state.
int number_active_level() const
Number of active levels, this is just the size of pressure_grid for the current surface pressure...
int rows() const
Definition: array_ad.h:368

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