ReFRACtor
spectral_window.cc
Go to the documentation of this file.
1 #include "spectral_window.h"
2 
3 using namespace FullPhysics;
4 using namespace blitz;
5 
6 #ifdef HAVE_LUA
7 #include "register_lua.h"
9 .def("number_spectrometer", &SpectralWindow::number_spectrometer)
10 .def("spectral_bound", &SpectralWindow::spectral_bound)
11 .def("grid_indexes", &SpectralWindow::grid_indexes)
13 #endif
14 
15 //-----------------------------------------------------------------------
18 //-----------------------------------------------------------------------
19 
21  int Spec_index) const
22 {
23  std::vector<int> gi = grid_indexes(Grid, Spec_index);
24  Array<double, 1> res((int) gi.size());
25  Array<int, 1> sind;
26  if(Grid.sample_index().rows() > 0)
27  sind.resize((int) gi.size());
28  for(int i = 0; i < res.rows(); ++i) {
29  res(i) = Grid.data()(gi[i]);
30  if(sind.rows() > 0)
31  sind(i) = Grid.sample_index()(gi[i]);
32  }
33  return SpectralDomain(res, sind, Grid.units());
34 }
35 
36 //-----------------------------------------------------------------------
39 //-----------------------------------------------------------------------
40 
42  int Spec_index) const
43 {
44  std::vector<int> gi = grid_indexes(Spec.spectral_domain(), Spec_index);
45  Array<double, 1> res_d((int) gi.size());
46  ArrayAd<double, 1> res_r((int) gi.size(),
48  Array<double, 1> uncer;
49  if(Spec.spectral_range().uncertainty().rows() > 0)
50  uncer.resize(res_r.rows());
51  Array<int, 1> sind;
52  if(Spec.spectral_domain().sample_index().rows() > 0)
53  sind.resize((int) gi.size());
54  for(int i = 0; i < res_d.rows(); ++i) {
55  res_d(i) = Spec.spectral_domain().data()(gi[i]);
56  res_r(i) = Spec.spectral_range().data_ad()(gi[i]);
57  if(uncer.rows() > 0)
58  uncer(i) = Spec.spectral_range().uncertainty()(gi[i]);
59  if(sind.rows() > 0)
60  sind(i) = Spec.spectral_domain().sample_index()(gi[i]);
61  }
62  return Spectrum(SpectralDomain(res_d, sind, Spec.spectral_domain().units()),
63  SpectralRange(res_r, Spec.spectral_range().units(),
64  uncer));
65 }
66 
virtual SpectralBound spectral_bound() const =0
Bounds of spectral window.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
const SpectralRange & spectral_range() const
Spectral range (e.g, radiance values)
Definition: spectrum.h:39
virtual std::vector< int > grid_indexes(const SpectralDomain &Grid, int Spec_index) const =0
Given a list of wavenumbers, this returns the indices that fall within the window.
#define REGISTER_LUA_CLASS(X)
Definition: register_lua.h:116
Apply value function to a blitz array.
void resize(const blitz::TinyVector< int, D > &Shape, int nvar)
Definition: array_ad.h:177
const Unit & units() const
Units of data.
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
const blitz::Array< double, 1 > & uncertainty() const
Uncertainty.
virtual int number_spectrometer() const =0
Number of spectrometers.
This class represents a the spectral window.
int number_variable() const
Definition: array_ad.h:376
We have a number of different spectrums that appear in different parts of the code.
const blitz::Array< int, 1 > & sample_index() const
Return sample index.
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
const Unit units() const
Units that go with data()
SpectralDomain apply(const SpectralDomain &Grid, int Spec_index) const
Apply a spectral window to a SpectralDomain, returning the possibly empty part of the domain that pas...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
#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
const blitz::Array< double, 1 > & data() const
Return data.

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