ReFRACtor
absorber_vmr_met.cc
Go to the documentation of this file.
1 #include <boost/algorithm/string.hpp>
2 
3 #include "absorber_vmr_met.h"
4 #include "ostream_pad.h"
5 #include "old_constant.h"
6 
7 using namespace FullPhysics;
8 using namespace blitz;
9 
10 #ifdef HAVE_LUA
11 #include "register_lua.h"
13 .def(luabind::constructor<const boost::shared_ptr<Meteorology>&,
15  double,
16  bool,
17  const std::string&>())
19 #endif
20 
21 //-----------------------------------------------------------------------
23 //-----------------------------------------------------------------------
24 
27  const boost::shared_ptr<Pressure>& Press,
28  double Scale,
29  bool Scale_flag,
30  const std::string& Gas_name)
31 : AbsorberVmrScaled(Press, Scale, Scale_flag, Gas_name), met(Met_file)
32 {
33  std::string gname = gas_name();
34  boost::to_upper(gname);
35  if (gname != "H2O" &&
36  gname != "O3") {
37  std::stringstream err_msg;
38  err_msg << "Only H2O and O3 is supported by AbsorberVmrMet, unknown absorber: "
39  << gas_name();
40  throw Exception(err_msg.str());
41  }
42 }
43 
44 blitz::Array<double, 1> AbsorberVmrMet::specific_humidity() const
45 {
46  return met->specific_humidity();
47 }
48 
49 blitz::Array<double, 1> AbsorberVmrMet::vmr_profile() const
50 {
51  return met->vmr(gas_name());
52 }
53 
54 blitz::Array<double, 1> AbsorberVmrMet::pressure_profile() const
55 {
56  return met->pressure_levels();
57 }
58 
60 (const boost::shared_ptr<Pressure>& Press) const
61 {
63  (new AbsorberVmrMet(met, Press, coeff(0).value(),used_flag(0),
64  gas_name()));
65 }
66 
67 void AbsorberVmrMet::print(std::ostream& Os) const
68 {
69  OstreamPad opad(Os, " ");
70  Os << "AbsorberVmrMet:\n"
71  << " Gas name: " << gas_name() << "\n"
72  << " Scale: " << scale_factor() << "\n"
73  << " Retrieval flag: " << (used_flag_value()(0) ?
74  "True\n" : "False\n")
75  << " Meteorology:\n";
76  opad << *met << "\n";
77  opad.strict_sync();
78 }
blitz::Array< double, 1 > specific_humidity() const
Humidity from MET, used to write to output file.
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
virtual boost::shared_ptr< AbsorberVmr > clone() const
Clone a AbsorberVmr object.
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
AbsorberVmrMet(const boost::shared_ptr< Meteorology > &Met_file, const boost::shared_ptr< Pressure > &Press, double Scale, bool Scale_flag, const std::string &Gas_name)
Constructor.
virtual void print(std::ostream &Os) const
Print to stream.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
Apply value function to a blitz array.
virtual blitz::Array< double, 1 > vmr_profile() const
VMR values converted from specific humidity.
This class maps the state vector to the absorber VMR on each level.
This gives the Gas Absorber Volumn mixing ratio for a single gas.
Definition: absorber_vmr.h:17
virtual blitz::Array< double, 1 > pressure_profile() const
Pressure levels that humidity is on from MET, used to write to output file.
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
This class maps the state vector to the absorber VMR on each level.
double value(const FullPhysics::AutoDerivative< double > &Ad)

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