ReFRACtor
pressure_output.cc
Go to the documentation of this file.
1 #include "pressure_output.h"
2 
3 using namespace FullPhysics;
4 using namespace blitz;
5 
6 #ifdef HAVE_LUA
7 #include "register_lua.h"
9 .def(luabind::constructor<const boost::shared_ptr<Pressure>&,
12 #endif
13 
15 public:
18  : p(P), sv(Sv) {}
20  {
21  // There is no covariance value loaded so we can not return an uncertainty value
22  // Must be using forward model mode
23  if (sv->state_covariance().rows() == 0 or sv->state_covariance().cols() == 0)
24  return 0;
25 
26  firstIndex i1; secondIndex i2; thirdIndex i3; fourthIndex i4;
27  Array<double, 1> dsurf_dstate = p->surface_pressure().value.gradient();
28  Array<double, 1> t(dsurf_dstate.rows());
29  t = sum(sv->state_covariance()(i1, i2) * dsurf_dstate(i2), i2);
30  double t2 = sum(dsurf_dstate * t);
31  return (t2 > 0 ? sqrt(t2) : 0);
32  }
33  Array<double, 1> pressure_grid_value() const
34  {
35  return p->pressure_grid().convert(units::Pa).value.value();
36  }
37 private:
40 };
41 
42 // See base class for description
43 
45 {
46  // Freeze the pressure state
47  boost::shared_ptr<Pressure> pfreeze = p->clone();
48  out->register_data_source("/RetrievalResults/surface_pressure_apriori_fph",
50 
53  phelp(new PressureOutputHelper(pfreeze, sv_zero));
54  out->register_data_source("/RetrievalResults/vector_pressure_levels_apriori",
56 }
57 
59 {
60  out->register_data_source("/RetrievalResults/surface_pressure_fph",
63  phelp(new PressureOutputHelper(p, sv));
64  out->register_data_source("/RetrievalResults/surface_pressure_uncert_fph",
66  out->register_data_source("/RetrievalResults/vector_pressure_levels",
68  out->register_data_source("/RetrievalResults/num_active_levels",
70 }
71 
virtual void register_output_apriori(const boost::shared_ptr< Output > &out) const
Register apriori portions of class.
const Unit Pa("Pa", N/(m *m))
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
Apply value function to a blitz array.
double surface_pressure_value() const
Return the current surface pressure value, without the gradient.
Definition: pressure.h:48
virtual void register_output(const boost::shared_ptr< Output > &out) const
Register portions of class that will be written to output.
int number_level() const
This is the number of levels.
Definition: pressure.h:71
This registers the portions of the Pressure class that should be written as output.
PressureOutputHelper(const boost::shared_ptr< Pressure > &P, const boost::shared_ptr< StateVector > &Sv)
As described in the Output class, we have a decentralized model of producing output for L2 Full Physi...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
#define REGISTER_LUA_END()
Definition: register_lua.h:134
Array< double, 1 > pressure_grid_value() const
double surface_pressure_uncertainty() const

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