ReFRACtor
temperature_offset.cc
Go to the documentation of this file.
1 #include <boost/bind.hpp>
2 #include "temperature_offset.h"
3 #include "linear_interpolate.h"
4 
5 using namespace FullPhysics;
6 using namespace blitz;
7 
8 #ifdef HAVE_LUA
9 #include "register_lua.h"
12 #endif
13 
14 //-----------------------------------------------------------------------
16 //-----------------------------------------------------------------------
17 
19  double Temp_offset,
20  bool Temp_flag)
21 {
22  Array<bool, 1> flag(1);
23  Array<double, 1> val(flag.shape());
24  flag(0) = Temp_flag;
25  val(0) = Temp_offset;
26  init(val, flag, Press, false);
27 }
28 
29 //-----------------------------------------------------------------------
31 //-----------------------------------------------------------------------
32 
34 {
35  blitz::Array<double, 1> temp_profile( temperature_profile() );
36  blitz::Array<double, 1> press_profile( pressure_profile() );
37 
38  std::vector<AutoDerivative<double> > plist;
39  std::vector<AutoDerivative<double> > tlist;
40  if (press_profile.rows() != temp_profile.rows()) {
41  std::stringstream err_msg;
42  err_msg << "Size of pressure grid: "
43  << press_profile.rows()
44  << " != size of temperature levels: "
45  << temp_profile.rows();
46  throw Exception(err_msg.str());
47  }
48  for(int i = 0; i < press_profile.rows(); ++i) {
49  AutoDerivative<double> t2 = temp_profile(i) + coefficient()(0);
50  tlist.push_back(t2);
51  plist.push_back(press_profile(i));
52  }
54  lin_type;
56  (new lin_type(plist.begin(), plist.end(), tlist.begin()));
57  tgrid = boost::bind(&lin_type::operator(), lin, _1);
58 }
59 
60 // See base class for description of this function.
62 {
63  return "Temperature Offset (Kelvin)";
64 }
65 
66 //-----------------------------------------------------------------------
68 //-----------------------------------------------------------------------
69 
71 {
72  if(!used_flag_value()(0) ||
73  cov.rows() == 0 ||
74  cov(0,0) < 0)
75  return 0.0;
76  return sqrt(cov(0,0));
77 }
78 
79 void TemperatureOffset::print(std::ostream& Os) const
80 {
81  Os << "TemperatureOffset\n";
82 }
double temperature_offset_uncertainty() const
Uncertainty of temperature offset.
virtual void print(std::ostream &Os) const
Print to stream.
TemperatureOffset(const boost::shared_ptr< Pressure > &Press, double Temp_offset, bool Temp_flag)
Create an Temperature Offset.
This class takes a set of points and values, and linearly interpolates between those values...
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
This class maintains the temperature portion of the state.
Apply value function to a blitz array.
virtual std::string state_vector_name_i(int i) const
Return state vector name for ith entry in coeff.
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 maintains the temperature portion of the state.
Definition: temperature.h:22
void calc_temperature_grid() const
This calculates temperature grid to use for layer retrieval.

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