ReFRACtor
stokes_coefficient_fraction.cc
Go to the documentation of this file.
2 #include "ostream_pad.h"
3 
4 using namespace FullPhysics;
5 #ifdef HAVE_LUA
6 #include "register_lua.h"
8 .def(luabind::constructor<const blitz::Array<double, 2>&,
9  const blitz::Array<double, 1>&, const blitz::Array<bool, 1>&>())
11 #endif
12 
13 //-----------------------------------------------------------------------
15 //-----------------------------------------------------------------------
17 (const blitz::Array<double, 2>& Stokes_coeff_parallel,
18  const blitz::Array<double, 1>& Coeffs,
19  const blitz::Array<bool, 1>& Flag)
20 : stokes_coeff_parallel(Stokes_coeff_parallel.copy())
21 {
22  if(stokes_coeff_parallel.rows() != Coeffs.rows() ||
23  stokes_coeff_parallel.rows() != Flag.rows())
24  throw Exception("Stokes_coeff_parallel, Coeff, and Flag all need to have the same number of rows");
25  stokes_coeff.resize(stokes_coeff_parallel.shape(), 0);
26  stokes_coeff.value() = stokes_coeff_parallel;
27  for(int i = 0; i < stokes_coeff.rows(); ++i) {
28  stokes_coeff.value()(i, 1) *= (1 - 2 * Coeffs(i));
29  stokes_coeff.value()(i, 2) *= (1 - 2 * Coeffs(i));
30  }
31  init(Coeffs, Flag);
32 }
33 
34 void StokesCoefficientFraction::print(std::ostream& Os) const
35 {
36  OstreamPad opad(Os, " ");
37  Os << "StokesCoefficientFraction:\n";
38  Os << " Initial parallel stokes coefficients:\n";
39  opad << stokes_coeff_parallel << "\n";
40  opad.strict_sync();
41  Os << " Coefficient:\n";
42  opad << coeff.value() << "\n";
43  opad.strict_sync();
44  Os << " Retrieval flag:\n";
45  opad << used_flag << "\n";
46  opad.strict_sync();
47  Os << " Stokes coefficient:\n";
48  opad << stokes_coefficient().value();
49  opad.strict_sync();
50 }
51 
53 {
55  (new StokesCoefficientFraction(stokes_coeff_parallel,
56  coeff.value(),
57  used_flag));
58 }
59 
61 {
62  stokes_coeff.value() = stokes_coeff_parallel;
63  stokes_coeff.jacobian() = 0;
64  for(int i = 0; i < stokes_coeff.rows(); ++i) {
65  stokes_coeff(i, 1) = stokes_coeff(i, 1) * (1 - 2 * coeff(i));
66  stokes_coeff(i, 2) = stokes_coeff(i, 2) * (1 - 2 * coeff(i));
67  }
68 }
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
This class maintains the stokes coefficient portion of the state.
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
ArrayAd< double, 2 > stokes_coeff
The cached stokes coefficient.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
const blitz::Array< T, D+1 > jacobian() const
Definition: array_ad.h:307
virtual boost::shared_ptr< StokesCoefficient > clone() const
Clone a StokesCoefficient object.
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
This class maintains the stokes coefficient portion of the state.
virtual void calc_stokes_coeff() const
Derived classes should provide a function to fill in pgrid when this is called.
blitz::Array< bool, 1 > used_flag
Flag indicating which of the coefficients gets updated by the StateVector.
StokesCoefficientFraction(const blitz::Array< double, 2 > &Stokes_coeff_parallel, const blitz::Array< double, 1 > &Coeffs, const blitz::Array< bool, 1 > &Flag)
Constructor.
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
virtual void print(std::ostream &Os) const
Print to stream.
virtual ArrayAd< double, 2 > stokes_coefficient() const
Return Stokes coefficients used to go from Stokes vector to scalar reflectance.
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:10