ReFRACtor
solar_continuum_polynomial.cc
Go to the documentation of this file.
2 #include "fp_exception.h"
3 #include "ostream_pad.h"
4 #include <boost/foreach.hpp>
5 
6 using namespace FullPhysics;
7 using namespace blitz;
8 
9 #ifdef HAVE_LUA
10 #include "register_lua.h"
11 
13 .def(luabind::constructor<ArrayWithUnit<double, 1>, bool>())
15 #endif
16 
17 //-----------------------------------------------------------------------
23 //-----------------------------------------------------------------------
24 
26 const ArrayWithUnit<double, 1>& Param,
27 bool Convert_from_photon)
28 : param(Param), convert_from_photon(Convert_from_photon)
29 {
30  using namespace units;
31  range_min_check((int) Param.value.size(), 1);
32  Param.units.is_commensurate(ph / (s * m * m * micron));
33 }
34 
35 //-----------------------------------------------------------------------
37 //-----------------------------------------------------------------------
38 
39 void SolarContinuumPolynomial::print(std::ostream& Os) const
40 {
41  OstreamPad opad(Os, " ");
42  Os << "SolarContinuumPolynomial:\n"
43  << " Parameters:\n";
44  opad << param.value;
45  opad.strict_sync();
46  Os << "\n Parameter units: \n";
47  opad << param.units;
48  opad.strict_sync();
49 }
50 
51 // See base class for description.
53  const SpectralDomain& spec_domain) const
54 {
55  // The polynomial is in terms of the wavelength in microns.
56  Array<double, 1> wl = spec_domain.wavelength();
57 
58  // Calculate polynomial in wl
60  res.value.resize(wl.shape());
61  res.units = param.units;
62  res.value = param.value(param.value.size() - 1);
63  for(int i = ((int) param.value.size()) - 2; i >= 0; i--) {
64  res.value *= wl;
65  res.value += param.value(i);
66  }
67 
68  // Convert from ph/s/m^2/micron to W/m^2/cm^-1 if requested
69  if(convert_from_photon)
70  res *= spec_domain.photon_to_radiance_factor();
71  return Spectrum(spec_domain, SpectralRange(res.value, res.units));
72 }
const Unit s("s", 1.0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
This class calculates the solar continuum spectrum.
virtual void print(std::ostream &Os) const
Print description of object.
virtual Spectrum solar_continuum_spectrum(const SpectralDomain &spec_domain) const
This calculate the solar continuum spectrum.
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
blitz::Array< double, 1 > wavelength(const Unit &Units=units::micron) const
Return data as wavelengths You can optionally supply the units to use.
const Unit micron("micron", 1e-6 *m)
blitz::Array< T, D > value
Apply value function to a blitz array.
This class calculates the solar continuum spectrum.
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
const Unit m("m", 1.0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
We have a number of different spectrums that appear in different parts of the code.
ArrayWithUnit< double, 1 > photon_to_radiance_factor() const
We may want to convert from photon number per second to radiance units.
bool is_commensurate(const Unit &Units) const
Test if this set of units is commensurate with another set.
Definition: unit.h:68
SolarContinuumPolynomial(const ArrayWithUnit< double, 1 > &Param, bool Convert_from_photon=true)
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
#define range_min_check(V, Min)
Range check.
Definition: fp_exception.h:167
const Unit ph("ph", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0)

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