ReFRACtor
standard_forward_model.h
Go to the documentation of this file.
1 #ifndef STANDARD_FORWARD_MODEL_H
2 #define STANDARD_FORWARD_MODEL_H
3 
4 #include "forward_model.h"
6 #include "radiative_transfer.h"
7 #include "spectrum_effect.h"
8 #include "named_spectrum.h"
9 #include "spectral_window.h"
10 #include "instrument.h"
11 #include "spectrum_sampling.h"
12 #include "observer.h"
13 #include <vector>
14 
15 namespace FullPhysics {
16 
17 /****************************************************************/
23 class StandardForwardModel : public ForwardModel, public Observable<boost::shared_ptr<NamedSpectrum> > {
24 public:
27  const boost::shared_ptr<SpectralWindow>& Spectral_window,
29  const boost::shared_ptr<SpectrumSampling>& Spectrum_sampling,
30  const std::vector<std::vector<boost::shared_ptr<SpectrumEffect> > >& Spectrum_effect =
31  std::vector<std::vector<boost::shared_ptr<SpectrumEffect> > >());
32 
33  virtual ~StandardForwardModel() {}
34 
35  virtual void setup_grid()
36  {
37  g.reset(new ForwardModelSpectralGrid(inst, swin, spectrum_sampling_));
38  }
39 
40  virtual int num_channels() const
41  {
42  return swin->number_spectrometer();
43  }
44 
45  virtual const SpectralDomain spectral_domain(int channel_index) const
46  {
47  if(!g) {
48  throw Exception ("setup_grid needs to be called before calling spectral_domain");
49  }
50 
51  return g->low_resolution_grid(channel_index);
52  }
53 
55  {
56  return inst->pixel_spectral_domain(0).type_preference();
57  }
58 
59  virtual Spectrum radiance(int channel_index, bool Skip_jacobian = false) const;
60 
61  virtual void print(std::ostream& Os) const;
62 
63  // These are useful for python, so make available here.
64  const std::vector<std::vector<boost::shared_ptr<SpectrumEffect> > >& spectrum_effect() const
65  {
66  return spec_effect;
67  }
68 
70  {
71  return inst;
72  }
73 
75  {
76  inst = V;
77  }
78 
80  {
81  return swin;
82  }
83 
85  {
86  swin = V;
87  }
88 
90  {
91  return rt;
92  }
94  {
95  rt = V;
96  }
97 
99  {
100  return spectrum_sampling_;
101  }
102 
104  {
105  spectrum_sampling_ = V;
106  }
107 
108  Spectrum apply_spectrum_corrections(const Spectrum& highres_spec, int channel_index) const;
109 
111  {
112  return g;
113  }
114 
117  {
118  add_observer_do(Obs);
119  }
120 
122  {
123  remove_observer_do(Obs);
124  }
125 
126  void notify_spectrum_update(const Spectrum& updated_spec, const std::string& spec_name, int channel_index) const;
127 
128 private:
129  std::vector<std::vector<boost::shared_ptr<SpectrumEffect> > > spec_effect;
133  boost::shared_ptr<SpectrumSampling> spectrum_sampling_;
135 };
136 }
137 #endif
virtual void setup_grid()
This notifies the forward model that it should setup the grid.
virtual int num_channels() const
The number of spectral channels associated with forward model.
void radiative_transfer(const boost::shared_ptr< RadiativeTransfer > &V)
virtual Spectrum radiance(int channel_index, bool Skip_jacobian=false) const
Spectrum for the given spectral band.
const boost::shared_ptr< SpectralWindow > & spectral_window() const
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
This is the Forward Model spectral grid.
void add_observer_do(Observer< boost::shared_ptr< NamedSpectrum > > &Obs, boost::shared_ptr< NamedSpectrum > &t)
Add an observer.
Definition: observer.h:148
virtual SpectralDomain::TypePreference spectral_domain_type_preference() const
Type preference for spectral domain.
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
virtual void print(std::ostream &Os) const
const boost::shared_ptr< RadiativeTransfer > & radiative_transfer() const
void spectrum_sampling(const boost::shared_ptr< SpectrumSampling > &V)
const boost::shared_ptr< SpectrumSampling > & spectrum_sampling() const
virtual void remove_observer(Observer< boost::shared_ptr< NamedSpectrum > > &Obs)
Remove an observer.
void remove_observer_do(Observer< boost::shared_ptr< NamedSpectrum > > &Obs, boost::shared_ptr< NamedSpectrum > &t)
Remove an observer.
Definition: observer.h:173
StandardForwardModel(const boost::shared_ptr< Instrument > &Inst, const boost::shared_ptr< SpectralWindow > &Spectral_window, const boost::shared_ptr< RadiativeTransfer > &Rt, const boost::shared_ptr< SpectrumSampling > &Spectrum_sampling, const std::vector< std::vector< boost::shared_ptr< SpectrumEffect > > > &Spectrum_effect=std::vector< std::vector< boost::shared_ptr< SpectrumEffect > > >())
Constructor.
This is the forward model used form GOSAT/OCO.
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
Mixin for a class that allows other classes to observe it state.
Definition: observer.h:12
void spectral_window(const boost::shared_ptr< SpectralWindow > &V)
The forward model represents the encapsulation of modeling spectra from an atmospheric state then app...
Definition: forward_model.h:14
virtual void add_observer(Observer< boost::shared_ptr< NamedSpectrum > > &Obs)
Required observable functions.
const std::vector< std::vector< boost::shared_ptr< SpectrumEffect > > > & spectrum_effect() const
virtual const SpectralDomain spectral_domain(int channel_index) const
Spectral domain for the given spectral band.
const boost::shared_ptr< Instrument > & instrument() const
Spectrum apply_spectrum_corrections(const Spectrum &highres_spec, int channel_index) const
Applies corrections and modeling to modeled spectrum:
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
void notify_spectrum_update(const Spectrum &updated_spec, const std::string &spec_name, int channel_index) const
void instrument(const boost::shared_ptr< Instrument > &V)
const boost::shared_ptr< ForwardModelSpectralGrid > & spectral_grid() const
Simple Mixin to be and Observer of another object of class T.
Definition: observer.h:29

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