ReFRACtor
empirical_orthogonal_function.h
Go to the documentation of this file.
1 #ifndef EMPIRICAL_ORTHOGONAL_FUNCTION_H
2 #define EMPIRICAL_ORTHOGONAL_FUNCTION_H
3 
4 #include "dispersion.h"
6 #include "hdf_file.h"
8 #include "array_with_unit.h"
9 #include <boost/lexical_cast.hpp>
10 
11 namespace FullPhysics {
12 /****************************************************************/
23 public SubStateVectorArray<InstrumentCorrection> {
24 public:
25 //-----------------------------------------------------------------------
45 //-----------------------------------------------------------------------
46 
48  bool Used_flag,
49  const ArrayWithUnit<double, 1>& Eof_waveform,
50  int Order,
51  const std::string& Band_name,
52  const std::string& Hdf_group = "N/A",
53  int Sounding_number = 0,
54  bool Eof_depend_on_sounding_number = false)
55  : SubStateVectorArray<InstrumentCorrection>(Coeff, Used_flag),
56  band_name(Band_name),
57  hdf_group(Hdf_group),
58  order_(Order),
59  sounding_number_(Sounding_number),
60  eof_depend_on_sounding_number_(Eof_depend_on_sounding_number),
61  eof_(Eof_waveform)
62  { }
63 
64  EmpiricalOrthogonalFunction(double Coeff,
65  bool Used_flag,
66  const Dispersion& Disp,
67  const HdfFile& Hdf_static_input,
68  int Spec_index,
69  int Sounding_number,
70  int Order,
71  const std::string& Band_name,
72  const std::string& Hdf_group =
73  "Instrument/EmpiricalOrthogonalFunction");
74  EmpiricalOrthogonalFunction(double Coeff,
75  bool Used_flag,
76  const HdfFile& Hdf_static_input,
77  int Spec_index,
78  int Sounding_number,
79  int Order,
80  const std::string& Band_name,
81  const std::string& Hdf_group =
82  "Instrument/EmpiricalOrthogonalFunction");
83  EmpiricalOrthogonalFunction(double Coeff,
84  bool Used_flag,
85  const HdfFile& Hdf_static_input,
86  const ArrayWithUnit<double, 1>& Uncertainty,
87  int Spec_index,
88  int Sounding_number,
89  int Order,
90  const std::string& Band_name,
91  const std::string& Hdf_group =
92  "Instrument/EmpiricalOrthogonalFunction",
93  double Scale_to_stddev = 1e19);
95 
96  virtual std::string sub_state_identifier() const { return "eof/" + band_name; }
97 
98  virtual std::string state_vector_name_i(int i) const
99  { return "EOF order " + boost::lexical_cast<std::string>(order_) +
100  " scale factor " + band_name; }
101 
103  virtual void apply_correction
104  (const SpectralDomain& Pixel_grid,
105  const std::vector<int>& Pixel_list,
106  SpectralRange& Radiance) const;
107  virtual void print(std::ostream& Os) const;
108 
109 //-----------------------------------------------------------------------
111 //-----------------------------------------------------------------------
113  {
115  (blitz::Array<double, 1>(coeff(0).value() * eof_.value),
116  eof_.units);
117  }
118 
119 //-----------------------------------------------------------------------
122 //-----------------------------------------------------------------------
123 
124  int order() const {return order_;}
125 //-----------------------------------------------------------------------
128 //-----------------------------------------------------------------------
129 
130  double scale() const { return coeff.value()(0); }
131 
132 //-----------------------------------------------------------------------
135 //-----------------------------------------------------------------------
136 
137  double scale_uncertainty() const
138  {
139  if(sv_cov_sub.rows() < 1)
140  return 0;
141  double t = sv_cov_sub(0,0);
142  return (t < 0 ? 0 : sqrt(t));
143  }
144 
145 private:
146  std::string band_name;
147  std::string hdf_group;
148  int order_;
149  int sounding_number_;
150  bool eof_depend_on_sounding_number_;
151  bool eof_scale_uncertainty_;
152  double scale_to_stddev_;
154 };
155 }
156 #endif
virtual std::string sub_state_identifier() const
Return a string to identify this part of the state, this name should be all lower case and seperate p...
EmpiricalOrthogonalFunction(double Coeff, bool Used_flag, const ArrayWithUnit< double, 1 > &Eof_waveform, int Order, const std::string &Band_name, const std::string &Hdf_group="N/A", int Sounding_number=0, bool Eof_depend_on_sounding_number=false)
Constructor.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
blitz::Array< double, 2 > sv_cov_sub
The subset of cov_full that is "owned" by this class, what was passed through update_sub_state.
This class applies a empirical orthogonal function (EOF) correction to instrument data...
blitz::Array< T, D > value
This class reads and writes a HDF5 file.
Definition: hdf_file.h:39
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
double scale_uncertainty() const
Scale uncertainty.
We have a number of different spectrums that appear in different parts of the code.
ArrayWithUnit< double, 1 > eof() const
Current value of empirical orthogonal function, for each pixel number.
This class calculates the wavenumber for each pixel in a single band of an Instrument.
Definition: dispersion.h:12
int order() const
Order of the empirical orthogonal function (e.g., first order, second order, etc.) ...
It is common to have a class that is an Observable with a set of coefficients, a subset of which are ...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual boost::shared_ptr< InstrumentCorrection > clone() const
Clone an InstrumentCorrection object.
virtual std::string state_vector_name_i(int i) const
Return state vector name for ith entry in coeff.
This class models an Instrument correction.
virtual void apply_correction(const SpectralDomain &Pixel_grid, const std::vector< int > &Pixel_list, SpectralRange &Radiance) const
Apply correction to radiance values, in place.

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