2 #include <boost/foreach.hpp> 17 return l1b[0]->number_spectrometer();
24 sum += f->relative_velocity(Spec_index);
25 return sum / ((int) l1b.size());
30 return l1b[0]->time(Spec_index);
36 return l1b[0]->sample_grid(Spec_index);
43 sum += f->latitude(i);
44 return sum / ((int) l1b.size());
51 sum += f->longitude(i);
52 return sum / ((int) l1b.size());
59 sum += f->sounding_zenith(i);
60 return sum / ((int) l1b.size());
67 sum += f->sounding_azimuth(i);
68 return sum / ((int) l1b.size());
73 Array<double, 1> res(l1b[0]->stokes_coefficient(i).rows());
76 res += f->stokes_coefficient(i);
77 res /= (int) l1b.size();
85 sum += f->solar_zenith(i);
86 return sum / ((int) l1b.size());
93 sum += f->solar_azimuth(i);
94 return sum / ((int) l1b.size());
101 sum += f->altitude(i);
102 return sum / ((int) l1b.size());
108 Array<double, 1>
rad(t.
data());
109 Array<double, 1> sum(
rad.shape());
111 bool have_uncertainty = (t.
uncertainty().rows() > 0);
114 for(
int i = 1; i < (int) l1b.size(); ++i) {
120 rad /= ((int) l1b.size());
121 Array<double, 1> uncer;
123 uncer.reference(Array<double,1>(sqrt(sum) / (
int) l1b.size()));
127 template <
typename T>
128 bool Level1bAverage::check_field_equal(T && check_field)
const {
129 auto first_result = std::bind(check_field, l1b[0])();
131 if (std::bind(check_field, f)() != first_result) {
138 template <
typename T>
139 bool Level1bAverage::check_field_equal(T && check_field,
int arg1)
const {
140 auto first_result = std::bind(check_field, l1b[0], arg1)();
142 if (std::bind(check_field, f, arg1)() != first_result) {
150 template <
typename T>
151 void Level1bAverage::assert_field_equal(T && check_field)
const {
152 bool field_equal = check_field_equal(check_field);
155 e <<
"All instances of checked field not equal.\n";
161 template <
typename T>
162 void Level1bAverage::assert_field_equal(T && check_field,
int arg1)
const {
163 bool field_equal = check_field_equal(check_field, arg1);
166 e <<
"All instances of checked field not equal.\n";
174 Os <<
"Level1bAverage";
virtual DoubleWithUnit sounding_zenith(int i) const
Sounding zenith.
virtual DoubleWithUnit solar_azimuth(int i) const
Solar azimuth.
virtual int number_spectrometer() const
Number of spectrometers.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
virtual SpectralDomain sample_grid(int Spec_index) const =0
Returns the sample grid (ie wavenumber, wavelength, etc) for the corresponding radiance values...
virtual SpectralDomain sample_grid(int Spec_index) const
Returns the sample grid (ie wavenumber, wavelength, etc) for the corresponding radiance values...
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.
virtual SpectralRange radiance(int Spec_index) const
Radiance, for given spectral band.
virtual DoubleWithUnit longitude(int i) const
Longitude.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
This is used to read a Level 1B file.
virtual DoubleWithUnit solar_zenith(int i) const
Solar zenith.
Apply value function to a blitz array.
virtual blitz::Array< double, 1 > stokes_coefficient(int i) const
Return stokes coefficients.
const Unit & units() const
Units of data.
virtual DoubleWithUnit latitude(int i) const
Latitude.
const blitz::Array< double, 1 > & uncertainty() const
Uncertainty.
We frequently have a double with units associated with it.
We have a number of different spectrums that appear in different parts of the code.
This is a simple time class.
virtual void print(std::ostream &Os) const
Print description of object.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
#define REGISTER_LUA_END()
virtual DoubleWithUnit sounding_azimuth(int i) const
Sounding azimuth.
This reads averages a set of Level1b classes to get the various values.
virtual Time time(int Spec_index) const
Time of sounding.
virtual DoubleWithUnit altitude(int i) const
Altitude.
const Unit rad("rad", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)
const blitz::Array< double, 1 > & data() const
Underlying data.
virtual DoubleWithUnit relative_velocity(int Spec_index) const
Relative velocity.
virtual int number_spectrometer() const =0
Number of spectrometers.