11 for(
int i = 0; i < channel_index; ++i) {
12 sind += spectral_domain(i).data().rows();
15 int nrow = spectral_domain(channel_index).data().rows();
18 return boost::optional<Range>(Range(sind, sind + nrow - 1));
20 return boost::optional<Range>();
27 std::vector<Spectrum> sall;
28 std::vector<Range> prall;
30 for(
int i = 0; i < num_channels(); ++i) {
31 boost::optional<Range> pr = stacked_pixel_range(i);
34 sall.push_back(radiance(i, skip_jacobian));
39 if(sall.size() == 0) {
40 throw Exception(
"Measured radiance Spectrum empty, pixel ranges must be empty");
45 bool have_uncertainty =
true;
51 have_uncertainty =
false;
57 ud = sall[0].spectral_domain().units();
58 ur = sall[0].spectral_range().units();
62 Array<double, 1> sd(nrow);
63 Array<double, 1> uncer;
65 if(have_uncertainty) {
69 for(
int i = 0; i < (int) sall.size(); ++i) {
70 sd(prall[i]) = sall[i].spectral_domain().data() *
72 sr.
value()(prall[i]) = sall[i].spectral_range().data() *
76 uncer(prall[i]) = sall[i].spectral_range().uncertainty() *
80 sr.
jacobian()(prall[i], Range::all()) =
81 sall[i].spectral_range().data_ad().jacobian() *
#define range_check(V, Min, Max)
Range check.
const Unit s("s", 1.0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
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.
double conversion(const Unit &Dunit_from, const Unit &Dunit_to)
Return conversion factor to go from one unit to another.
const Unit sr("sr", 1.0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0)
const SpectralRange & spectral_range() const
Spectral range (e.g, radiance values)
const blitz::Array< T, D+1 > jacobian() const
Apply value function to a blitz array.
const blitz::Array< T, D > & value() const
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
const blitz::Array< double, 1 > & uncertainty() const
Uncertainty.
virtual const boost::optional< blitz::Range > stacked_pixel_range(int channel_index) const
The range of indicies that corresponds to a particular band in the stacked radiances.
int number_variable() const
We have a number of different spectrums that appear in different parts of the code.
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
virtual Spectrum radiance_all(bool skip_jacobian=false) const
Radiance data all stacked together as one long spectrum (so band 0, followed by band 1...
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.
const SpectralDomain & spectral_domain() const
Spectral domain (i.e., wavenumber or wavelength).
const blitz::Array< double, 1 > & data() const
Return data.