ReFRACtor
aerosol_aod_output.cc
Go to the documentation of this file.
1 #include <boost/algorithm/string.hpp>
2 #include <boost/lexical_cast.hpp>
3 #include "aerosol_aod_output.h"
4 
5 using namespace FullPhysics;
6 
7 #ifdef HAVE_LUA
8 #include "register_lua.h"
10 .def(luabind::constructor<const boost::shared_ptr<Aerosol>&>())
11 .def(luabind::constructor<const boost::shared_ptr<Aerosol>&, bool>())
13 #endif
14 
16 const double AerosolAodOutput::low_boundary = 800e2;
17 
19 const double AerosolAodOutput::high_boundary = 500e2;
20 
22  bool Number_instead_of_name)
23 : number_instead_of_name(Number_instead_of_name)
24 {
25  // Right now we only work with AerosolOptical. Not sure if this is
26  // a *real* requirement, or just that our Aerosol base class should
27  // have the additional functions AerosolOptical supplies. But for
28  // now just fail miserably if we are using a different kind of
29  // Aerosol.
30  a = boost::dynamic_pointer_cast<AerosolOptical>(A);
31  if(!a)
32  throw Exception("Currently only support AerosolOptical");
33 }
34 
35 // See base class for description
36 
38 {
39  typedef boost::function<blitz::Array<double, 1> ()> ftype;
40  double minv = std::numeric_limits<double>::min();
41  double maxv = std::numeric_limits<double>::max();
42 
43  out->register_data_source("/Metadata/AerosolTypes", &AerosolOptical::aerosol_name_arr, a);
44 
45  typedef boost::function<double ()> func_type;
46  std::vector<std::string> aerosol_names = a->aerosol_name();
47  for(int aer_idx = 0; aer_idx < a->number_particle(); aer_idx++) {
48  std::string aer_name;
49  if(number_instead_of_name) {
50  aer_name = boost::lexical_cast<std::string>(aer_idx + 1);
51  } else {
52  aer_name = aerosol_names[aer_idx];
53  boost::algorithm::to_lower(aer_name);
54  }
55 
56  func_type func_all =
57  boost::bind(&AerosolOptical::aerosol_optical_depth, a, aer_idx, minv, maxv);
58  out->register_data_source("/RetrievalResults/aerosol_" + aer_name + "_aod", func_all);
59 
60  func_type func_low =
61  boost::bind(&AerosolOptical::aerosol_optical_depth, a, aer_idx, low_boundary, maxv);
62  out->register_data_source
63  ("/RetrievalResults/aerosol_" + aer_name + "_aod_low", func_low);
64 
65  func_type func_mid =
67  out->register_data_source
68  ("/RetrievalResults/aerosol_" + aer_name + "_aod_mid", func_mid);
69 
70  func_type func_high =
71  boost::bind(&AerosolOptical::aerosol_optical_depth, a, aer_idx, minv, high_boundary);
72  out->register_data_source
73  ("/RetrievalResults/aerosol_" + aer_name + "_aod_high", func_high);
74  }
75 
76  func_type func_tot_all =
77  boost::bind(&AerosolOptical::aerosol_optical_depth_total, a, minv, maxv);
78  out->register_data_source("/RetrievalResults/aerosol_total_aod", func_tot_all);
79 
80  func_type func_tot_low =
82  out->register_data_source
83  ("/RetrievalResults/aerosol_total_aod_low", func_tot_low);
84 
85  func_type func_tot_mid =
87  out->register_data_source
88  ("/RetrievalResults/aerosol_total_aod_mid", func_tot_mid);
89 
90  func_type func_tot_high =
92  out->register_data_source
93  ("/RetrievalResults/aerosol_total_aod_high", func_tot_high);
94 
95 }
96 
blitz::Array< std::string, 1 > aerosol_name_arr() const
Aerosol names, plus the string "total" as the 1st entry.
static const double high_boundary
The boundary for calculating retrieved_aerosol_aod_by_type_high.
virtual void register_output(const boost::shared_ptr< Output > &out) const
Register portions of class that will be written to output.
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
double aerosol_optical_depth_total(double pmin=std::numeric_limits< double >::min(), double pmax=std::numeric_limits< double >::max()) const
This gives the total optical depth for each particle, plus adds the total optical depth for all parti...
double aerosol_optical_depth(int aer_idx, double pmin=std::numeric_limits< double >::min(), double pmax=std::numeric_limits< double >::max()) const
This gives the total aerosol optical depth for a given particle.
const Unit A("A", 1.0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
This registers the portions of the Aerosol class that should be written as output.
static const double low_boundary
The boundary for calculating retrieved_aerosol_aod_by_type_low.
Implementation of Aerosol.
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
AerosolAodOutput(const boost::shared_ptr< Aerosol > &A, bool Number_instead_of_name=false)
Constructor.

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