ReFRACtor
ground_lambertian_output.cc
Go to the documentation of this file.
2 
3 using namespace FullPhysics;
4 using namespace blitz;
5 
6 #ifdef HAVE_LUA
7 #include "register_lua.h"
8 
9 boost::shared_ptr<RegisterOutputBase> ground_lamb_output_create(const boost::shared_ptr<Ground>& ground, const std::vector<std::string>& hdf_band_names)
10 {
12  (new GroundLambertianOutput(boost::dynamic_pointer_cast<GroundLambertian>(ground), hdf_band_names));
13 }
14 
16 .def(luabind::constructor<const boost::shared_ptr<GroundLambertian>&, const std::vector<std::string>&>())
17 .scope
18 [
19  luabind::def("create", &ground_lamb_output_create)
20 ]
22 #endif
23 
24 double albedo(boost::shared_ptr<GroundLambertian>& Lambertian, int spec_idx)
25 {
26  return Lambertian->albedo_coefficients(spec_idx).value()(0);
27 }
28 
29 double albedo_slope(boost::shared_ptr<GroundLambertian>& Lambertian, int spec_idx)
30 {
31  return Lambertian->albedo_coefficients(spec_idx).value()(1);
32 }
33 
34 double albedo_uncert(boost::shared_ptr<GroundLambertian>& Lambertian, int spec_idx)
35 {
36  Array<double, 2> cov = Lambertian->albedo_covariance(spec_idx);
37  if(cov.rows() > 0 and cov.cols() > 0) {
38  return (cov(0, 0) < 0 ? 0.0 : sqrt(cov(0, 0)));
39  } else {
40  return 0.0;
41  }
42 }
43 
45 {
46  Array<double, 2> cov = Lambertian->albedo_covariance(spec_idx);
47  if (cov.rows() > 1 and cov.cols() > 1) {
48  return (cov(1, 1) < 0 ? 0.0 : sqrt(cov(1, 1)));
49  } else {
50  return 0.0;
51  }
52 }
53 
55 {
57  boost::dynamic_pointer_cast<GroundLambertian>(lambertian->clone());
58 
59  for(int spec_idx = 0; spec_idx < lambertian->number_spectrometer(); spec_idx++) {
60  std::string band_name = hdf_band_names[spec_idx];
61 
62  { boost::function<double ()> f = boost::bind(&albedo, lamb_freeze, spec_idx);
63  out->register_data_source("/RetrievalResults/albedo_apriori_" + band_name + "_fph", f); }
64 
65  { boost::function<double ()> f = boost::bind(&albedo_slope, lamb_freeze, spec_idx);
66  out->register_data_source("/RetrievalResults/albedo_slope_apriori_" + band_name, f); }
67  }
68 }
69 
71 {
72  for(int spec_idx = 0; spec_idx < lambertian->number_spectrometer(); spec_idx++) {
73  std::string band_name = hdf_band_names[spec_idx];
74 
75  { boost::function<double ()> f = boost::bind(&albedo, lambertian, spec_idx);
76  out->register_data_source("/RetrievalResults/albedo_" + band_name + "_fph", f); }
77 
78  { boost::function<double ()> f = boost::bind(&albedo_slope, lambertian, spec_idx);
79  out->register_data_source("/RetrievalResults/albedo_slope_" + band_name, f); }
80 
81  { boost::function<double ()> f = boost::bind(&albedo_uncert, lambertian, spec_idx);
82  out->register_data_source("/RetrievalResults/albedo_uncert_" + band_name + "_fph", f); }
83 
84  { boost::function<double ()> f = boost::bind(&albedo_slope_uncert, lambertian, spec_idx);
85  out->register_data_source("/RetrievalResults/albedo_slope_uncert_" + band_name, f); }
86  }
87 
88  out->register_data_source("/RetrievalResults/surface_type", surface_type.c_str());
89 
90 }
double albedo(boost::shared_ptr< GroundLambertian > &Lambertian, int spec_idx)
This class implements a Lambertian albedo as a ground type.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
double albedo_slope(boost::shared_ptr< GroundLambertian > &Lambertian, int spec_idx)
This registers the portions of the GroundLambertian class that should be written as output...
double albedo_uncert(boost::shared_ptr< GroundLambertian > &Lambertian, int spec_idx)
Apply value function to a blitz array.
double albedo_slope_uncert(boost::shared_ptr< GroundLambertian > &Lambertian, int spec_idx)
virtual void register_output_apriori(const boost::shared_ptr< Output > &out) const
Register apriori portions of class.
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
def(luabind::constructor< int >()) .def("rows"
virtual void register_output(const boost::shared_ptr< Output > &out) const
Register portions of class that will be written to output.

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