4 #include <boost/foreach.hpp> 5 #include <boost/lexical_cast.hpp> 12 typedef void (
SpectralWindowRange::*cfunc)(
const std::vector<boost::shared_ptr<Dispersion> >&);
39 : range_(Microwindow_ranges)
41 if(range_.value.depth() != 2) {
43 e <<
"Microwindow_ranges needs to have a depth of 2\n" 44 <<
"(for lower and upper bound). Found depth of " << range_.value.depth();
60 const Array<T, 2>& Bad_sample_mask)
61 : range_(Microwindow_ranges)
63 if(range_.
value.depth() != 2) {
65 e <<
"Microwindow_ranges needs to have a depth of 2\n" 66 <<
"(for lower and upper bound). Found depth of " << range_.
value.depth();
71 bad_sample_mask_.resize(Bad_sample_mask.shape());
73 for(
int i = 0; i < bad_sample_mask_.rows(); ++i) {
74 bad_sample_mask_(i, Range::all()) = where(Bad_sample_mask(i, Range::all()),
true,
false);
81 Range ra = Range::all();
82 std::vector<DoubleWithUnit> lbound, ubound;
105 lbound.push_back(lv);
106 ubound.push_back(uv);
117 std::vector<int> res;
128 for(
int i = 0; i < g.rows(); ++i) {
133 if(bad_sample_mask_.rows() == 0 || !bad_sample_mask_(Spec_index, i)) {
134 for(
int j = 0; j < range_.
value.cols(); ++j) {
135 if(
g(i) >= range_.
value(Spec_index, j, 0) &&
136 g(i) < range_.
value(Spec_index, j, 1)) {
156 Os <<
"SpectralWindowRange:\n" 157 <<
" Units: " << range_.
units;
159 for(
int i = 0; i < range_.
value.rows(); ++i) {
160 Os <<
" Spec[" << i <<
"]:\n";
162 for(
int j = 0; j < range_.
value.cols(); ++j)
163 Os <<
" Microwindow[" << j <<
"]: (" 164 << range_.
value(i, j, 0) <<
", " << range_.
value(i, j, 1) <<
")\n";
#define range_check(V, Min, Max)
Range check.
DoubleWithUnit convert_wave(const Unit &R) const
We often need to handle conversion from wavenumber to/from wavelength.
void print(std::ostream &Os) const
Print to a stream.
SpectralWindowRange(const ArrayWithUnit< double, 3 > &Microwindow_ranges)
Construct a new window from the supplied information.
virtual SpectralBound spectral_bound() const
Bounds of spectral window.
const ArrayWithUnit< double, 3 > & range_array() const
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< double, 1 > wavelength(const Unit &Units=units::micron) const
Return data as wavelengths You can optionally supply the units to use.
blitz::Array< T, D > value
const Unit sample_index("sample_index", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
Apply value function to a blitz array.
virtual std::vector< int > grid_indexes(const SpectralDomain &Grid, int Spec_index) const
Given a list of wavenumbers, this returns the indices that fall within the window.
const Unit inv_cm("cm^-1", pow(cm, -1))
This is an implementation of a SpectralWindow that covers a fixed window.
This gives the upper and lower bounds of the SpectralWindow.
We frequently have a double with units associated with it.
This class represents a the spectral window.
virtual int number_spectrometer() const
Number of spectrometers.
const blitz::Array< int, 1 > & sample_index() const
Return sample index.
const Unit g("g", 1e-3 *kg)
blitz::Array< double, 1 > wavenumber(const Unit &Units=units::inv_cm) const
Return data as wavenumbers.
const Unit units() const
Units that go with data()
bool is_commensurate(const Unit &Units) const
Test if this set of units is commensurate with another set.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
#define REGISTER_LUA_END()
const blitz::Array< double, 1 > & data() const
Return data.
const std::vector< boost::shared_ptr< Dispersion > > & dispersion() const
The Dispersion is optional.