ReFRACtor
spectral_domain.h
Go to the documentation of this file.
1 #ifndef SPECTRAL_DOMAIN_H
2 #define SPECTRAL_DOMAIN_H
3 #include "printable.h"
4 #include "unit.h"
5 #include "array_ad.h"
6 #include "array_with_unit.h"
7 #include <blitz/array.h>
8 
9 namespace FullPhysics {
10 /****************************************************************/
31 class SpectralDomain: public Printable<SpectralDomain> {
32 public:
34 
36  const Unit& U);
37  SpectralDomain(const blitz::Array<double, 1>& Data,
38  const Unit& Units = units::inv_cm);
41  const blitz::Array<int, 1>& Sindex,
42  const Unit& U);
43  SpectralDomain(const blitz::Array<double, 1>& Data,
44  const blitz::Array<int, 1>& Sindex,
45  const Unit& Units = units::inv_cm);
47  const blitz::Array<int, 1>& Sindex);
48 
49 //-----------------------------------------------------------------------
57 //-----------------------------------------------------------------------
58 
59  const blitz::Array<double, 1>& data() const { return data_.value();}
60 
61 //-----------------------------------------------------------------------
64 //-----------------------------------------------------------------------
65 
66  const ArrayAd<double, 1>& data_ad() const {return data_; }
67 
68 //-----------------------------------------------------------------------
75 //-----------------------------------------------------------------------
76 
77  const blitz::Array<int, 1>& sample_index() const { return sindex_; }
78 
79 //-----------------------------------------------------------------------
81 //-----------------------------------------------------------------------
82 
83  const Unit units() const {return units_;}
84 
85 //-----------------------------------------------------------------------
87 //-----------------------------------------------------------------------
88 
89  const SpectralDomain clone() const { return SpectralDomain(data_.copy(), units_); }
90 
91 //-----------------------------------------------------------------------
94 //-----------------------------------------------------------------------
95 
97  {
98  return (units_.is_commensurate(units::inv_cm) ?
100  }
101 
102  blitz::Array<double, 1> convert_wave(const Unit& Units) const;
103  blitz::Array<double, 1> wavenumber(const Unit& Units = units::inv_cm) const;
104  blitz::Array<double, 1> wavelength(const Unit& Units = units::micron) const;
106  void print(std::ostream& Os) const { Os << "SpectralDomain";}
107 
109  //-----------------------------------------------------------------------
110  // TODO: Add robustness by converting to common unit instead of require ==
111  inline bool operator==(const SpectralDomain& A) const
112  { return (A.data_ == this->data_) && (A.units_ == this->units_) ; }
113  inline bool operator!= (const SpectralDomain& A) const
114  { return !(A == *this); }
115 
116 
119 
120 private:
121  ArrayAd<double, 1> data_;
122  blitz::Array<int, 1> sindex_;
123  Unit units_;
124 };
125 }
126 #endif
bool operator==(const SpectralDomain &A) const
We can define != in terms of this operator.
bool operator!=(const SpectralDomain &A) const
SpectralDomain()
Default constructor needed for SWIG.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
const SpectralDomain clone() const
Clones object into a new copy.
blitz::Array< double, 1 > wavelength(const Unit &Units=units::micron) const
Return data as wavelengths You can optionally supply the units to use.
This is a Mixin for classes that can be printed.
Definition: printable.h:24
const Unit micron("micron", 1e-6 *m)
const Unit A("A", 1.0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
const Unit inv_cm("cm^-1", pow(cm, -1))
blitz::Array< double, 1 > convert_wave(const Unit &Units) const
Return data as the supplied the units.
ArrayAd< T, D > copy() const
Definition: array_ad.h:374
const blitz::Array< int, 1 > & sample_index() const
Return sample index.
TypePreference type_preference() const
Indicate if this class prefers wavelength or wavenumber.
ArrayWithUnit< double, 1 > photon_to_radiance_factor() const
We may want to convert from photon number per second to radiance units.
Libraries such as boost::units allow unit handling where we know the units at compile time...
Definition: unit.h:25
blitz::Array< double, 1 > wavenumber(const Unit &Units=units::inv_cm) const
Return data as wavenumbers.
const Unit units() const
Units that go with data()
bool is_commensurate(const Unit &Units) const
Test if this set of units is commensurate with another set.
Definition: unit.h:68
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
const blitz::Array< double, 1 > & data() const
Return data.
void print(std::ostream &Os) const

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