ReFRACtor
absorber_absco_output.cc
Go to the documentation of this file.
4 #include "fill_value.h"
5 
6 using namespace FullPhysics;
7 using namespace blitz;
8 
9 #ifdef HAVE_LUA
10 #include "register_lua.h"
11 // Lua doesn't know to cast a pointer type of base class to a derived class.
12 // Add a conversion routine.
15  const SpectralBound& Sb)
16 {
19  (boost::dynamic_pointer_cast<AbsorberAbsco>(A), Sb));
20 }
22 .scope
23 [
24  luabind::def("create", &abs_absco_create)
25 ]
27 #endif
28 
29 // Helper class that gets Absco scaling information
31 public:
33  Ab,
34  const SpectralBound& Sb)
35  : absco(Ab),
36  sb(Sb)
37  {}
38  blitz::Array<double, 1> absco_scale() const
39  { blitz::Array<double, 1> res(sb.number_spectrometer());
40  for(int i = 0; i < res.rows(); ++i) {
41  // Only convert non zero values, other wise we will get floating point errors
42  // in single band mode
43  if(abs(sb.upper_bound(i).value - sb.lower_bound(i).value) > 0) {
44  DoubleWithUnit wn = sb.center(i, Unit("cm^-1"));
45  res(i) = absco->table_scale(wn.value);
46  } else {
47  res(i) = 0.0;
48  }
49  }
50  return res;
51  }
52 private:
54  SpectralBound sb;
55 };
56 
57 // Helper class that gets XCO2 value
59 public:
61  : abs(Abs) {}
62  double xco2_value() const { return abs->xgas("CO2").value(); }
63  double total_column_thickness_o2_value() const { return abs->gas_total_column_thickness("O2").convert(Unit("m^-2")).value.value(); }
64  double total_column_thickness_co2_value() const { return abs->gas_total_column_thickness("CO2").convert(Unit("m^-2")).value.value(); }
65  double total_column_thickness_h2o_value() const { return abs->gas_total_column_thickness("H2O").convert(Unit("m^-2")).value.value(); }
66  blitz::Array<double, 1>layer_column_thickness_h2o_value() const { return abs->gas_column_thickness_layer("H2O").convert(Unit("m^-2")).value.value(); }
67  double average_vmr_o2_value() const { return abs->average_vmr("O2").value(); }
68  blitz::Array<double, 1> pressure_weighting_function_grid_value() const
69  { return abs->pressure_weighting_function_grid().value(); }
70  blitz::Array<double, 1> dry_air_column_thickness_value() const
71  { return abs->dry_air_column_thickness_layer().convert(Unit("m^-2")).value.value(); }
72  blitz::Array<double, 1> wet_air_column_thickness_value() const
73  { return abs->wet_air_column_thickness_layer().convert(Unit("m^-2")).value.value(); }
74 private:
76 };
77 
78 
79 // See base class for description
80 
82 {
83  // Freeze the pressure state
85  boost::dynamic_pointer_cast<AbsorberAbsco>(a->clone());
87  if(afreeze->gas_index("CO2") != -1)
88  out->register_data_source("/RetrievalResults/xco2_apriori",
90 
91  if(afreeze->gas_index("O2") != -1)
92  out->register_data_source("/RetrievalResults/apriori_o2_column",
94 
95 }
96 
98 {
100  if(a->gas_index("CO2") != -1) {
101  out->register_data_source("/RetrievalResults/xco2",
103  out->register_data_source_pad
104  ("/RetrievalResults/xco2_pressure_weighting_function",
106  num_level, fill_value<double>());
107 
108  out->register_data_source("/RetrievalResults/retrieved_co2_column",
110  }
111 
112  if(a->gas_index("O2") != -1) {
113  out->register_data_source("/RetrievalResults/retrieved_o2_column",
115 
116  out->register_data_source("/Metadata/VMRO2",
118  }
119 
120  if(a->gas_index("H2O") != -1) {
121  out->register_data_source("/RetrievalResults/retrieved_h2o_column",
123 
124  out->register_data_source_pad("/RetrievalResults/retrieved_h2o_column_layer_thickness",
125  &AbsorberAbscoOutputHelper::layer_column_thickness_h2o_value, h, num_level - 1 , fill_value<double>());
126  }
127 
128  // Wet and dry air mass, H2O used in calculation of results
129  out->register_data_source_pad("/RetrievalResults/retrieved_dry_air_column_layer_thickness",
130  &AbsorberAbscoOutputHelper::dry_air_column_thickness_value, h, num_level - 1 , fill_value<double>());
131 
132  out->register_data_source_pad("/RetrievalResults/retrieved_wet_air_column_layer_thickness",
133  &AbsorberAbscoOutputHelper::wet_air_column_thickness_value, h, num_level - 1, fill_value<double>());
134  for(int i = 0; i < a->number_species(); ++i) {
135  std::string gas_name = a->gas_name(i);
137  boost::dynamic_pointer_cast<Absco>(a->gas_absorption_ptr(gas_name));
138  if(ab) {
140  h2(new GasAbscoOutputHelper(ab, sb));
141  out->register_data_source("/Metadata/Absco" + gas_name + "Scale",
143  }
144  }
145 }
This class is used to read the absco tables.
Definition: absco.h:56
blitz::Array< double, 1 > absco_scale() const
This class maintains the absorber portion of the state.
virtual void register_output_apriori(const boost::shared_ptr< Output > &out) const
Register apriori portions of class.
blitz::Array< double, 1 > layer_column_thickness_h2o_value() const
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
virtual void register_output(const boost::shared_ptr< Output > &out) const
Register portions of class that will be written to output.
This registers the portions of the Absorber class that should be written as output.
Apply value function to a blitz array.
const Unit A("A", 1.0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
This gives the upper and lower bounds of the SpectralWindow.
blitz::Array< double, 1 > dry_air_column_thickness_value() const
We frequently have a double with units associated with it.
double total_column_thickness_co2_value() const
blitz::Array< double, 1 > pressure_weighting_function_grid_value() const
As described in the Output class, we have a decentralized model of producing output for L2 Full Physi...
double total_column_thickness_o2_value() const
Libraries such as boost::units allow unit handling where we know the units at compile time...
Definition: unit.h:25
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
def(luabind::constructor< int >()) .def("rows"
blitz::Array< double, 1 > wet_air_column_thickness_value() const
AbsorberAbscoOutputHelper(const boost::shared_ptr< AbsorberAbsco > &Abs)
double total_column_thickness_h2o_value() const
GasAbscoOutputHelper(const boost::shared_ptr< Absco > &Ab, const SpectralBound &Sb)

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