ReFRACtor
instrument_doppler.cc
Go to the documentation of this file.
1 #include "instrument_doppler.h"
2 #include "old_constant.h"
3 
4 using namespace FullPhysics;
5 using namespace blitz;
6 
7 #ifdef HAVE_LUA
8 #include "register_lua.h"
10 .def(luabind::constructor<const DoubleWithUnit&, const bool>())
11 .def(luabind::constructor<const DoubleWithUnit&>())
12 .def(luabind::constructor<const double, const std::string&, const bool>())
13 .def(luabind::constructor<const double, const std::string&>())
15 #endif
16 
18  const bool Used_flag)
19  : vel_units(Relative_velocity.units)
20 {
21  Array<double, 1> c(1);
22  c = Relative_velocity.value;
23  Array<bool, 1> f(1);
24  f = Used_flag;
25  init(c, f);
26 }
27 
28 InstrumentDoppler::InstrumentDoppler(const double Relative_velocity_value,
29  const std::string& Relative_velocity_units,
30  const bool Used_flag)
31  : vel_units(Relative_velocity_units)
32 {
33  Array<double, 1> c(1);
34  c = Relative_velocity_value;
35  Array<bool, 1> f(1);
36  f = Used_flag;
37  init(c, f);
38 }
39 
40 void InstrumentDoppler::apply_effect(Spectrum& Spec, const ForwardModelSpectralGrid& Forward_model_grid) const
41 {
42  // Compute the wavelengths of the object in (2) in the spacecraft frame of reference.
43  // Let v_ei be the relative velocity between earth and the instrument (=spacecraft).
44  //
45  // a) Wavelengths: wl_spacecraft = wl_earth_rest_frame / (1.d0 + v_ei/c)
46  // b) Wavenumbers: wn_spacecraft = wn_earth_rest_frame * (1.d0 + v_ei/c)
47  ArrayAd<double, 1> spec_dom_ad(Spec.spectral_domain().data_ad());
48  if (spec_dom_ad.number_variable() == 0) {
49  spec_dom_ad.resize_number_variable(coefficient().number_variable());
50  }
51  for(int w_idx = 0; w_idx < Spec.spectral_domain().data().rows(); w_idx++) {
53  spec_dom_ad(w_idx) = spec_dom_ad(w_idx)
55  else
56  spec_dom_ad(w_idx) = spec_dom_ad(w_idx)
57  * (1.0 + coefficient()(0) / OldConstant::speed_of_light.value);
58  }
59 }
60 
62 {
64 }
65 
66 void InstrumentDoppler::print(std::ostream& Os) const
67 {
68  Os << "InstrumentDoppler" << std::endl
69  << " Relative velocity: " << coefficient().value() << " " << vel_units << std::endl;
70 }
void resize_number_variable(int nvar)
Definition: array_ad.h:165
virtual void apply_effect(Spectrum &Spec, const ForwardModelSpectralGrid &Forward_model_grid) const
Apply correction to spectrum in place.
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
Corrects Spectrum spectral domain to account for the doppler shift due to the relative velocity betwe...
This is the Forward Model spectral grid.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
virtual boost::shared_ptr< SpectrumEffect > clone() const
Clone a SpectrumEffect object.
Apply value function to a blitz array.
This class models models any effects that need to be applied to high resolution spectra after the rad...
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
InstrumentDoppler(const DoubleWithUnit &Relative_velocity, const bool Used_flag=false)
We frequently have a double with units associated with it.
TypePreference type_preference() const
Indicate if this class prefers wavelength or wavenumber.
blitz::Array< bool, 1 > used_flag
Flag indicating which of the coefficients gets updated by the StateVector.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
void init(const blitz::Array< double, 1 > &Coeff, const blitz::Array< bool, 1 > &Used_flag, const boost::shared_ptr< Pressure > &Press=boost::shared_ptr< Pressure >(), bool Mark_according_to_press=true, int Pdep_start=0)
#define REGISTER_LUA_END()
Definition: register_lua.h:134
const SpectralDomain & spectral_domain() const
Spectral domain (i.e., wavenumber or wavelength).
Definition: spectrum.h:32
virtual void print(std::ostream &Os) const
double value(const FullPhysics::AutoDerivative< double > &Ad)
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.

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08