4 #include <boost/foreach.hpp> 13 .def(luabind::constructor<const HdfFile&, const std::string&, bool>())
26 (
const HdfFile& F,
const std::string& Hdf_group,
bool Convert_from_photon)
27 : convert_from_photon(Convert_from_photon),
32 (Hdf_group +
"/wavenumber");
34 (Hdf_group +
"/spectrum");
35 if(!srange.units.is_commensurate(
Unit(
"ph / (s * m * m * micron)")))
36 throw Exception(
"Solar continuum spectrum units need to be commensurate with ph / (s * m * m * micron)");
37 if(sdom.
value.rows() != srange.value.rows())
38 throw Exception(
"wavenumber and spectrum need to be the same size");
39 domain_unit = sdom.
units;
40 range_unit = srange.units;
44 (x.dataFirst(), x.dataFirst() + x.rows(), y.dataFirst());
51 Array<double, 1> wv = spec_domain.
convert_wave(domain_unit);
54 res.
value.resize(wv.shape());
55 res.
units = range_unit;
56 for(
int i = 0; i < res.
value.rows(); ++i)
57 res.
value(i) = table(wv(i));
60 if(convert_from_photon)
67 Os <<
"SolarContinuumTable\n" 68 <<
" Hdf file name: " << hdf_file_name <<
"\n" 69 <<
" Hdf group: " << hdf_group <<
"\n" 70 <<
" Convert from photon: " << (convert_from_photon ?
"true" :
"false")
This class calculates the solar continuum spectrum.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
This is the base of the exception hierarchy for Full Physics code.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
blitz::Array< T, D > value
This class reads and writes a HDF5 file.
Apply value function to a blitz array.
virtual void print(std::ostream &Os) const
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
SolarContinuumTable(const HdfFile &F, const std::string &Hdf_group, bool Convert_from_photon=true)
Constructor.
blitz::Array< double, 1 > convert_wave(const Unit &Units) const
Return data as the supplied the units.
const std::string & file_name() const
File name.
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.
Libraries such as boost::units allow unit handling where we know the units at compile time...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
#define REGISTER_LUA_END()
ArrayWithUnit< T, D > read_field_with_unit(const std::string &Dataname) const
Read a given field, along with metadata describing the units.
This class calculates the solar continuum 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...
virtual Spectrum solar_continuum_spectrum(const SpectralDomain &spec_domain) const
This calculate the solar continuum spectrum.