ReFRACtor
observation_level_1b.cc
Go to the documentation of this file.
1 #include "observation_level_1b.h"
3 
4 using namespace FullPhysics;
5 using namespace blitz;
6 
7 #ifdef HAVE_LUA
8 #include "register_lua.h"
13 #endif
14 
16  const boost::shared_ptr<Instrument> &instrument,
17  const boost::shared_ptr<ForwardModelSpectralGrid>& spectral_grids)
18  : l1b(level_1b), inst(instrument), grids(spectral_grids)
19 {
20 }
21 
23 {
24  return grids->number_spectrometer();
25 }
26 
28 {
29  return grids->low_resolution_grid(channel_index);
30 }
31 
32 Spectrum ObservationLevel1b::radiance(int channel_index, bool skip_jacobian) const
33 {
34  range_check(channel_index, 0, num_channels());
35 
36  Spectrum full(inst->pixel_spectral_domain(channel_index), l1b->radiance(channel_index));
37 
38  const std::vector<int>& plist = grids->pixel_list(channel_index);
39  Array<double, 1> res_d((int) plist.size());
40 
41  int num_jac;
42  if (skip_jacobian) {
43  num_jac = 0;
44  } else {
45  num_jac = full.spectral_range().data_ad().number_variable();
46  }
47 
48  ArrayAd<double, 1> res_r((int) plist.size(), num_jac);
49  Array<double, 1> uncer;
50 
51  if(full.spectral_range().uncertainty().rows() > 0) {
52  uncer.resize(res_r.rows());
53  }
54 
55  for(int i = 0; i < res_d.rows(); ++i) {
56  res_d(i) = full.spectral_domain().data()(plist[i]);
57  AutoDerivative<double> t = full.spectral_range().data_ad()(plist[i]);
58  res_r(i) = t;
59 
60  if(uncer.rows() > 0) {
61  uncer(i) = full.spectral_range().uncertainty()(plist[i]);
62  }
63  }
64 
65  return Spectrum(SpectralDomain(res_d, full.spectral_domain().units()),
66  SpectralRange(res_r, full.spectral_range().units(), uncer));
67 }
#define range_check(V, Min, Max)
Range check.
Definition: fp_exception.h:140
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
const SpectralDomain spectral_domain(int channel_index) const
The spectral grid of the radiance values, implemented by inheriting class.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
Apply value function to a blitz array.
void resize(const blitz::TinyVector< int, D > &Shape, int nvar)
Definition: array_ad.h:177
This is a full spectrum, which contains a SpectralRange and SpectralDomain.
Definition: spectrum.h:18
We have a number of different spectrums that appear in different parts of the code.
Spectrum radiance(int channel_index, bool skip_jacobian=false) const
Measured spectrum for the given spectral channel.
int num_channels() const
Number of spectral channels.
ObservationLevel1b(const boost::shared_ptr< Level1b > &level_1b, const boost::shared_ptr< Instrument > &instrument, const boost::shared_ptr< ForwardModelSpectralGrid > &spectral_grids)
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
int rows() const
Definition: array_ad.h:368

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