ReFRACtor
absorber_vmr_level.h
Go to the documentation of this file.
1 #ifndef ABSORBER_VMR_LEVEL_H
2 #define ABSORBER_VMR_LEVEL_H
3 
5 #include <boost/lexical_cast.hpp>
6 
7 namespace FullPhysics {
8 /****************************************************************/
16 public:
18  const blitz::Array<double, 1>& Vmr,
19  const blitz::Array<bool, 1>& Vmr_flag,
20  const std::string& Gas_name);
21  virtual ~AbsorberVmrLevel() {}
22  virtual void print(std::ostream& Os) const;
23  virtual std::string sub_state_identifier() const { return "absorber_levels/" + gas_name(); }
24  virtual std::string state_vector_name_i(int i) const
25  { return gas_name() + " VMR for Press Lvl " +
26  boost::lexical_cast<std::string>(i + 1); }
28  { return clone(boost::shared_ptr<Pressure>()); }
30  clone(const boost::shared_ptr<Pressure>& Press) const;
31 
32 //-----------------------------------------------------------------------
35 //-----------------------------------------------------------------------
36  blitz::Array<double, 1> vmr_profile() const
37  { return coeff.value(); }
38 
39 //-----------------------------------------------------------------------
41 //-----------------------------------------------------------------------
42 
43  blitz::Array<double, 2> vmr_covariance() const
44  {
45  using namespace blitz;
46  firstIndex i1; secondIndex i2; thirdIndex i3; fourthIndex i4;
48  Array<double, 2> res(vmrv.rows(), vmrv.rows());
49  if(vmrv.is_constant())
50  res = 0; // Normal only encounter this in
51  // testing, when we haven't yet set up
52  // a covariance matrix and state vector.
53  else {
54 
55  Array<double, 2> dvmr_dstate(vmrv.jacobian());
56  Array<double, 2> t(dvmr_dstate.rows(), sv_cov_full.cols()) ;
57  t = sum(dvmr_dstate(i1, i3) * sv_cov_full(i3, i2), i3);
58  res = sum(t(i1, i3) * dvmr_dstate(i2, i3), i3);
59  }
60  return res;
61  }
62 
63 //-----------------------------------------------------------------------
65 //-----------------------------------------------------------------------
66 
67  blitz::Array<double, 1> vmr_uncertainty() const
68  {
69  blitz::Array<double, 2> vmrcov(vmr_covariance());
70  blitz::Array<double, 1> res(vmrcov.rows());
71  for(int i = 0; i < res.rows(); ++i)
72  res(i) = (vmrcov(i, i) > 0 ? sqrt(vmrcov(i, i)) : 0.0);
73  return res;
74  }
75 protected:
76  virtual void calc_vmr() const;
77 };
78 }
79 #endif
bool is_constant() const
Definition: array_ad.h:371
virtual std::string state_vector_name_i(int i) const
Return state vector name for ith entry in coeff.
AbsorberVmrLevel(const boost::shared_ptr< Pressure > &Press, const blitz::Array< double, 1 > &Vmr, const blitz::Array< bool, 1 > &Vmr_flag, const std::string &Gas_name)
Constructor.
const blitz::Array< T, D+1 > jacobian() const
Definition: array_ad.h:307
As a design principle, we have each base class with the absolutely minimum interface needed for use f...
virtual boost::shared_ptr< AbsorberVmr > clone() const
Clone a AbsorberVmr object.
Apply value function to a blitz array.
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
This class maps the state vector to the absorber VMR on each level.
blitz::Array< double, 1 > vmr_uncertainty() const
Uncertainty of VMR.
virtual void calc_vmr() const
Derived classes should provide a function to fill in vmr when this is called.
blitz::Array< double, 2 > vmr_covariance() const
Covariance of vmr profile.
blitz::Array< double, 1 > vmr_profile() const
VMR on the pressure grid.
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...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
blitz::Array< double, 2 > sv_cov_full
The last full covariance matrix we have been with, saved for reference by derived class...
virtual void print(std::ostream &Os) const
Print to stream.
virtual std::string gas_name() const
This indicates the name of this particular Absorber.
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