11 using namespace units;
12 using namespace blitz;
45 template <
class Type,
class Vector>
46 Type
Poly(
size_t k,
const Vector &a,
const Type &z)
48 size_t d = a.size() - 1;
61 for(i = 2; i < k; i++)
66 for(i = k; i <= d; i++)
69 b[i - k] = a[i] * tmp;
70 factor /= (i - k + 1);
108 bool apply_doppler_shift)
109 : apply_doppler_shift_(apply_doppler_shift),
110 calculated_doppler_shift(
true)
115 calc_solar_distance(constant, t);
123 double r1 = 1.0 / sqrt(1 - (2*f - f * f) * slat * slat);
126 doppler_rot_earth_sun_ =
129 doppler_shift_ = (total_velocity() /
152 (
double Doppler_shift,
155 bool apply_doppler_shift)
156 : doppler_shift_(Doppler_shift),
157 apply_doppler_shift_(apply_doppler_shift),
158 calculated_doppler_shift(
false)
160 calc_solar_distance(constant, t);
167 void SolarDopplerShiftPolynomial::calc_solar_distance
171 std::vector<double> solar_distance_param_v(sdp.begin(), sdp.end());
175 double doy = pt.date().day_of_year() +
176 ((double) pt.time_of_day().total_nanoseconds()) /
177 (
hours(24).total_nanoseconds()) + 0.5;
181 solar_distance_.value =
Poly(0, solar_distance_param_v, doy);
194 Os <<
"SolarDopplerShiftPolynomial\n" 195 <<
" Solar distance: " << solar_distance_ <<
"\n" 196 <<
" Doppler shift: " << doppler_shift_ <<
"\n" 197 <<
" Doppler shift " << (calculated_doppler_shift ?
"was calculated" :
198 "was read in") <<
"\n" 199 <<
" Apply Doppler: " << (apply_doppler_shift_ ?
"true" :
"false");
206 if(apply_doppler_shift_) {
211 (1 + doppler_shift_)),
212 Spec_domain.
units());
215 (1 + doppler_shift_)),
216 Spec_domain.
units());
#define range_check(V, Min, Max)
Range check.
This class handles the solar Doppler stretch to calculate the shift of the solar lines with respect t...
virtual Time time(int Spec_index) const =0
Time of sounding.
const DoubleWithUnit earth_rot_speed(360/86164.09054, units::deg/units::s)
Earth angular rotation frequency (1/sec)
virtual DoubleWithUnit solar_azimuth(int i) const =0
Solar azimuth.
Type Poly(size_t k, const Vector &a, const Type &z)
This is the only place that uses the library CppAD.
virtual DoubleWithUnit altitude(int i) const =0
Altitude.
virtual SpectralDomain doppler_stretch(const SpectralDomain &Spec_domain) const
Shift wavenumbers to account for doppler stretch.
SolarDopplerShiftPolynomial(const Time &t, const DoubleWithUnit &lat, const DoubleWithUnit &sol_zen, const DoubleWithUnit &sol_az, const DoubleWithUnit &elevation, const Constant &constant=DefaultConstant(), bool apply_doppler_shift=true)
Create a SolarDopplerShiftPolynomial.
This class is an implementation of Constant that uses hard coded values suitable for Earth...
const DoubleWithUnit wgs84_a(6378137.0000, units::m)
Equatorial radius.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
virtual void print(std::ostream &Os) const
Print description of object.
const Unit dimensionless("dimensionless", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
This is used to read a Level 1B file.
Apply value function to a blitz array.
virtual DoubleWithUnit latitude(int i) const =0
Latitude.
This class contains various constants.
This class handles the solar Doppler stretch to calculate the shift of the solar lines with respect t...
const DoubleWithUnit wgs84_b(6356752.3142450, units::m)
Polar radius in meters.
virtual boost::array< double, 7 > solar_distance_param() const =0
The polynomial used to find the distance to the sun.
We frequently have a double with units associated with it.
DoubleWithUnit convert(const Unit &R) const
Convert to the given units.
TypePreference type_preference() const
Indicate if this class prefers wavelength or wavenumber.
const Unit day("day", 24 *60 *60 *s)
This is a simple time class.
const Unit units() const
Units that go with data()
Contains classes to abstract away details in various Spurr Radiative Transfer software.
const T & value() const
Convert to type T.
#define REGISTER_LUA_END()
def(luabind::constructor< int >()) .def("rows"
const Unit AU("AU", 1.49597870691e11 *units::m)
1 AU in meters.
virtual DoubleWithUnit solar_zenith(int i) const =0
Solar zenith.
const Unit rad("rad", 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)
const blitz::Array< double, 1 > & data() const
Return data.
const DoubleWithUnit speed_of_light(299792458, units::m/units::s)
Speed of light, in m/s.
const Unit deg("deg", pi/180.0 *rad)