ReFRACtor
solar_absorption_table.cc
Go to the documentation of this file.
2 #include "fp_exception.h"
3 #include "linear_algebra.h"
4 using namespace FullPhysics;
5 using namespace blitz;
6 
7 #ifdef HAVE_LUA
8 #include "register_lua.h"
9 
11 .def(luabind::constructor<const HdfFile&,
12  const std::string&>())
14 #endif
15 
16 //-----------------------------------------------------------------------
18 //-----------------------------------------------------------------------
19 
21 const HdfFile& F,
22 const std::string& Hdf_group)
23 : hdf_file_name(F.file_name()),
24  hdf_group(Hdf_group)
25 {
27  (Hdf_group + "/wavenumber");
29  (Hdf_group + "/spectrum");
30  if(!srange.units.is_commensurate(Unit("dimensionless")))
31  throw Exception("Solar absorption spectrum units need to be dimensionless");
32  if(sdom.value.rows() != srange.value.rows())
33  throw Exception("wavenumber and spectrum need to be the same size");
34  domain_unit = sdom.units;
35  Array<double, 1> x = to_c_order(sdom.value);
36  Array<double, 1> y = to_c_order(srange.value);
38  (x.dataFirst(), x.dataFirst() + x.rows(), y.dataFirst());
39 }
40 
41 // See base class for description.
43 const SpectralDomain& spec_domain) const
44 {
45  Array<double, 1> wv = spec_domain.convert_wave(domain_unit);
46 
47  Array<double, 1> res;
48  res.resize(wv.shape());
49  for(int i = 0; i < res.rows(); ++i)
50  res(i) = table(wv(i));
51  return Spectrum(spec_domain, SpectralRange(res, Unit("dimensionless")));
52 }
53 
54 void SolarAbsorptionTable::print(std::ostream& Os) const
55 {
56  Os << "SolarAbsorptionTable\n"
57  << " Hdf file name: " << hdf_file_name << "\n"
58  << " Hdf group: " << hdf_group << "\n";
59 }
virtual void print(std::ostream &Os) const
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
virtual Spectrum solar_absorption_spectrum(const SpectralDomain &spec_domain) const
This calculates the solar absorption spectrum.
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 calculates the solar absorption spectrum.
SolarAbsorptionTable(const HdfFile &Hdf_static_input, const std::string &Hdf_group)
Read the given file for the solar absorption spectrum.
blitz::Array< T, D > value
This class reads and writes a HDF5 file.
Definition: hdf_file.h:39
Apply value function to a blitz array.
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
blitz::Array< double, 1 > convert_wave(const Unit &Units) const
Return data as the supplied the units.
We have a number of different spectrums that appear in different parts of the code.
Libraries such as boost::units allow unit handling where we know the units at compile time...
Definition: unit.h:25
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
ArrayWithUnit< T, D > read_field_with_unit(const std::string &Dataname) const
Read a given field, along with metadata describing the units.
Definition: hdf_file.h:575
This class calculates the solar absorption spectrum.
blitz::Array< T, D > to_c_order(const blitz::Array< T, D > &In)
Ensure that a given blitz::Array is contiguous, not reversed, and in C RowMajorArray format...

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