ReFRACtor
|
This class applies a empirical orthogonal function (EOF) correction to instrument data. More...
#include <empirical_orthogonal_function.h>
Public Member Functions | |
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. More... | |
EmpiricalOrthogonalFunction (double Coeff, bool Used_flag, const Dispersion &Disp, const HdfFile &Hdf_static_input, int Spec_index, int Sounding_number, int Order, const std::string &Band_name, const std::string &Hdf_group="Instrument/EmpiricalOrthogonalFunction") | |
Constructor. More... | |
EmpiricalOrthogonalFunction (double Coeff, bool Used_flag, const HdfFile &Hdf_static_input, int Spec_index, int Sounding_number, int Order, const std::string &Band_name, const std::string &Hdf_group="Instrument/EmpiricalOrthogonalFunction") | |
Constructor. More... | |
EmpiricalOrthogonalFunction (double Coeff, bool Used_flag, const HdfFile &Hdf_static_input, const ArrayWithUnit< double, 1 > &Uncertainty, int Spec_index, int Sounding_number, int Order, const std::string &Band_name, const std::string &Hdf_group="Instrument/EmpiricalOrthogonalFunction", double Scale_to_stddev=1e19) | |
Constructor. More... | |
virtual | ~EmpiricalOrthogonalFunction () |
virtual void | add_observer (Observer< InstrumentCorrection > &Obs) |
Add an observer. More... | |
void | add_observer_and_keep_reference (boost::shared_ptr< Observer< InstrumentCorrection > > &Obs) |
Add an observer and keep a reference to it. More... | |
virtual void | apply_correction (const SpectralDomain &Pixel_grid, const std::vector< int > &Pixel_list, SpectralRange &Radiance) const |
Apply correction to radiance values, in place. More... | |
virtual boost::shared_ptr< InstrumentCorrection > | clone () const |
Clone an InstrumentCorrection object. More... | |
const ArrayAd< double, 1 > & | coefficient () const |
ArrayWithUnit< double, 1 > | eof () const |
Current value of empirical orthogonal function, for each pixel number. More... | |
void | init (const blitz::Array< double, 1 > &Coeff, const blitz::Array< bool, 1 > &Used_flag, const boost::shared_ptr< Pressure > &Press=boost::shared_ptr< Pressure >(), bool Mark_according_to_press=true, int Pdep_start=0) |
virtual void | mark_used (const StateVector &Sv, blitz::Array< bool, 1 > &Used) const |
Mark elements that we are actively using (i.e., that aren't ignored). More... | |
virtual void | mark_used (const StateVector &Sv, blitz::Array< bool, 1 > &Used) const |
Mark elements that we are actively using (i.e., that aren't ignored). More... | |
void | mark_used_sub (blitz::Array< bool, 1 > &Used) const |
Called by mark_used with the subset of the state vector used by this class. More... | |
virtual void | notify_add (StateVector &Observed_object) |
Called when an object is added to an Observable. More... | |
virtual void | notify_add () |
virtual void | notify_add (StateVector &Sv) |
Called when an object is added to an Observable. More... | |
virtual void | notify_remove (StateVector &Observed_object) |
Called when an object is removed from an Observable. More... | |
virtual void | notify_remove () |
virtual void | notify_remove (StateVector &Sv) |
Called when an object is removed from an Observable. More... | |
virtual void | notify_update (const StateVector &Sv) |
Called when the Observed object is updated. More... | |
virtual void | notify_update (const StateVector &Observed_object) |
Called when the Observed object is updated. More... | |
int | order () const |
Order of the empirical orthogonal function (e.g., first order, second order, etc.) More... | |
const boost::shared_ptr< Pressure > & | pressure () const |
virtual void | print (std::ostream &Os) const |
std::string | print_to_string () const |
Print to string. More... | |
virtual void | remove_observer (Observer< InstrumentCorrection > &Obs) |
Remove an observer. More... | |
double | scale () const |
Scale. More... | |
double | scale_uncertainty () const |
Scale uncertainty. More... | |
virtual void | state_vector_name (const StateVector &Sv, blitz::Array< std::string, 1 > &Sv_name) const |
Update any portion of the list of the state vector names that apply to this object. More... | |
virtual void | state_vector_name (const StateVector &Sv, blitz::Array< std::string, 1 > &Sv_name) const |
Update any portion of the list of the state vector names that apply to this object. More... | |
virtual std::string | state_vector_name_i (int i) const |
Return state vector name for ith entry in coeff. More... | |
virtual void | state_vector_name_sub (blitz::Array< std::string, 1 > &Sv_name) const |
Called by state_vector_name with the subset of the Sv_name used by this class. More... | |
int | state_vector_start_index () const |
Starting index of state vector used by this object. More... | |
const blitz::Array< double, 2 > & | statevector_covariance () const |
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 parts with a /. More... | |
int | sub_vector_size () const |
Length of the sub set of the state vector used by this object. More... | |
virtual void | update_sub_state (const ArrayAd< double, 1 > &Sv_sub, const blitz::Array< double, 2 > &Cov) |
Called by update_state with the subset of the state vector used by this class. More... | |
virtual void | update_sub_state_hook () |
Hook for anything a derived class needs to do after coefficient is updated and before notify_update. More... | |
const blitz::Array< bool, 1 > & | used_flag_value () const |
Protected Member Functions | |
void | add_observer_do (Observer< InstrumentCorrection > &Obs, InstrumentCorrection &t) |
Add an observer. More... | |
void | add_observer_do (Observer< InstrumentCorrection > &Obs) |
void | clean_dead_ptr () |
Remove any dead pointers. More... | |
void | notify_update_do (const InstrumentCorrection &Self) |
Function to call to notify Observers of a state change. More... | |
void | remove_observer_do (Observer< InstrumentCorrection > &Obs, InstrumentCorrection &t) |
Remove an observer. More... | |
void | remove_observer_do (Observer< InstrumentCorrection > &Obs) |
void | state_vector_observer_initialize (int Plen) |
Take the given number of state vector parameters. More... | |
Protected Attributes | |
ArrayAd< double, 1 > | coeff |
Coefficients. More... | |
blitz::Array< double, 2 > | cov |
Last covariance matrix updated from the StateVector. More... | |
bool | mark_according_to_press |
Flag indicating if we only mark coefficients >= pdep_start + press->number_level() in mark_used_sub. More... | |
std::list< boost::weak_ptr< Observer< InstrumentCorrection > > > | olist |
int | pdep_start |
Index of first coefficient that depends on the number of pressure levels. More... | |
boost::shared_ptr< Pressure > | press |
Pressure. More... | |
std::vector< boost::shared_ptr< Observer< InstrumentCorrection > > > | ref_list |
blitz::Array< double, 2 > | sv_cov_full |
The last full covariance matrix we have been with, saved for reference by derived class. More... | |
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. More... | |
ArrayAd< double, 1 > | sv_full |
The last full state vector we have been updated with, saved for reference by derived class. More... | |
ArrayAd< double, 1 > | sv_sub |
The subset of sv_full that is "owned" by this class, what was passed through update_sub_state. More... | |
blitz::Array< bool, 1 > | used_flag |
Flag indicating which of the coefficients gets updated by the StateVector. More... | |
This class applies a empirical orthogonal function (EOF) correction to instrument data.
We use a supplied waveform, multiple by a single scale factor given by the state vector, and add this to the radiance calculated in InstrumentIls.
Note that other than what we call this and there various metadata fields, this is the same thing as the ZeroOffsetWaveform.
Definition at line 22 of file empirical_orthogonal_function.h.
|
inline |
Constructor.
Coeff | - Initial value of scale factor |
Used_flag | - If true, we update scale factor by values in StateVector. If false, we hold this fixed and just used the initial value. |
Eof_waveform | - Offset to add for zero level. This is indexed by the instrument pixel. |
Order | - Order of the eigenvector (e.g., first order correction, second order correction, etc.) |
Band_name | - Name of band |
Hdf_group | - HDF group name, if this was read from an HDF file. This is only used in the diagnostic print out of this object, we aren't actually reading from HDF in this particular constructor. If the Eof_waveform does not come from and HDF file, you can just leave this as the default "N/A" value. |
Sounding_number | - The sounding number |
Eof_depend_on_sounding_number | - True if the EOF depends on the sounding number, false otherwise |
Definition at line 47 of file empirical_orthogonal_function.h.
EmpiricalOrthogonalFunction::EmpiricalOrthogonalFunction | ( | double | Coeff, |
bool | Used_flag, | ||
const Dispersion & | Disp, | ||
const HdfFile & | Hdf_static_input, | ||
int | Spec_index, | ||
int | Sounding_number, | ||
int | Order, | ||
const std::string & | Band_name, | ||
const std::string & | Hdf_group = "Instrument/EmpiricalOrthogonalFunction" |
||
) |
Constructor.
Coeff | - Initial value of scale factor |
Used_flag | - If true, we update scale factor by values in StateVector. If false, we hold this fixed and just used the initial value. |
Disp | - Dispersion. |
Hdf_static_input | - File to read data from. |
Spec_index | - Spectral index number to for |
Sounding_number | - The footprint index (e.g., 0 to 7 for OCO). The EOF might be indexed by sounding number, or it might not. If it isn't |
Order | - Order of the eigenvector (e.g., first order correction, second order correction, etc.) |
Band_name | - Name of band |
Hdf_group | - The HDF group to read. |
This read the empirical orthogonal function (EOF) from an HDF file. We read the field Hdf_group + "/EOF" + order + "_waveform" + (spec_index + 1), e.g. "Instrument/EmpiricalOrthogonalFunction/EOF_1_waveform_1".
This table has two columns, the first is the wavenumber and the second is the eof at that wavenumber. We then do a linear interpolation between wavenumbers to get the full waveform.
Note that we require the Units attribute to be set. This gives the units that the table is in, which may not be the normal SI units we use in the Instrument.
Definition at line 71 of file empirical_orthogonal_function.cc.
EmpiricalOrthogonalFunction::EmpiricalOrthogonalFunction | ( | double | Coeff, |
bool | Used_flag, | ||
const HdfFile & | Hdf_static_input, | ||
int | Spec_index, | ||
int | Sounding_number, | ||
int | Order, | ||
const std::string & | Band_name, | ||
const std::string & | Hdf_group = "Instrument/EmpiricalOrthogonalFunction" |
||
) |
Constructor.
This is similar to the other constructor, except we are reading data where the EOF is not indexed by wavenumber. Instead, we have the EOF supplied for every sample_index.
Coeff | - Initial value of scale factor |
Used_flag | - If true, we update scale factor by values in StateVector. If false, we hold this fixed and just used the initial value. |
Hdf_static_input | - File to read data from. |
Spec_index | - Spectral index number to for |
Sounding_number | - The footprint index (e.g., 0 to 7 for OCO). The EOF might be indexed by sounding number, or it might not. If it isn't |
Order | - Order of the eigenvector (e.g., first order correction, second order correction, etc.) |
Band_name | - Name of band |
Hdf_group | - The HDF group to read. |
This read the empirical orthogonal function (EOF) from an HDF file. We read the field Hdf_group + "/EOF" + order + "_waveform" + (spec_index + 1), e.g. "Instrument/EmpiricalOrthogonalFunction/EOF_1_waveform_1".
This table has one columns, giving the eof at each pixel. Or, the table has 2 columns where the second one is the sounding_number (so it depends on the footprint).
Note that we require the Units attribute to be set. This gives the units that the table is in, which may not be the normal SI units we use in the Instrument.
Definition at line 163 of file empirical_orthogonal_function.cc.
EmpiricalOrthogonalFunction::EmpiricalOrthogonalFunction | ( | double | Coeff, |
bool | Used_flag, | ||
const HdfFile & | Hdf_static_input, | ||
const ArrayWithUnit< double, 1 > & | Uncertainty, | ||
int | Spec_index, | ||
int | Sounding_number, | ||
int | Order, | ||
const std::string & | Band_name, | ||
const std::string & | Hdf_group = "Instrument/EmpiricalOrthogonalFunction" , |
||
double | Scale_to_stddev = 1e19 |
||
) |
Constructor.
This is similar to the other constructor, except we are reading data where the EOF is not indexed by wavenumber. Instead, we have the EOF supplied for every sample_index.
This variation scales the EOF waveform by the supplied uncertainty, and then scales the resulting waveform so the standard deviation is Sigma_scale. This more closely matches what L2 actually fits for.
In this case, the EOF in the HDF file is unitless, and we get the units from the uncertainty.
Coeff | - Initial value of scale factor |
Used_flag | - If true, we update scale factor by values in StateVector. If false, we hold this fixed and just used the initial value. |
Hdf_static_input | - File to read data from. |
Uncertainty | - The uncertainty to scale EOF by. This contains units. |
Spec_index | - Spectral index number to for |
Sounding_number | - The footprint index (e.g., 0 to 7 for OCO). The EOF might be indexed by sounding number, or it might not. If it isn't |
Order | - Order of the eigenvector (e.g., first order correction, second order correction, etc.) |
Band_name | - Name of band |
Hdf_group | - The HDF group to read. |
Scale_to_stddev | - Number to scale to standard deviation of EOF is this value. |
This read the empirical orthogonal function (EOF) from an HDF file. We read the field Hdf_group + "/EOF" + order + "_waveform" + (spec_index + 1), e.g. "Instrument/EmpiricalOrthogonalFunction/EOF_1_waveform_1". This is then multiplied by the supplied Uncertainty, and then scaled so the standard deviation is Scale_to_stddev.
This table has one columns, giving the eof at each pixel. Or, the table has 2 columns where the second one is the sounding_number (so it depends on the footprint).
Definition at line 244 of file empirical_orthogonal_function.cc.
|
inlinevirtual |
Definition at line 94 of file empirical_orthogonal_function.h.
|
inlinevirtualinherited |
Add an observer.
Implements FullPhysics::Observable< InstrumentCorrection >.
Definition at line 20 of file instrument_correction.h.
|
inlineinherited |
Add an observer and keep a reference to it.
See the discussion in the Observer class description for details.
Definition at line 107 of file observer.h.
|
inlineprotectedinherited |
Add an observer.
Definition at line 148 of file observer.h.
|
inlineprotectedinherited |
Definition at line 159 of file observer.h.
|
virtual |
Apply correction to radiance values, in place.
If Radiance includes a Jacobian, then we include the Jacobian calculation. Otherwise we don't include the Jacobian in the calculation.
Pixel_grid | - The grid point of each pixel. We only use a subset of these points, but the full list is passed in for use by the class. |
Pixel_list | - List of pixels that actually appear in Radiance, in the order that they appear. |
Radiance | - Radiance values, that will be corrected in place. |
Implements FullPhysics::InstrumentCorrection.
Definition at line 299 of file empirical_orthogonal_function.cc.
|
inlineprotectedinherited |
Remove any dead pointers.
Definition at line 196 of file observer.h.
|
virtual |
Clone an InstrumentCorrection object.
Note that the cloned version will not be attached to and StateVector or Observer<InstrumentCorrection>, although you can of course attach them after receiving the cloned object.
Because this isn't attached to the StateVector, one use of the clone operator is to create a "frozen" InstrumentCorrection object.
Implements FullPhysics::InstrumentCorrection.
Definition at line 288 of file empirical_orthogonal_function.cc.
|
inlineinherited |
Definition at line 171 of file sub_state_vector_array.h.
|
inline |
Current value of empirical orthogonal function, for each pixel number.
Definition at line 112 of file empirical_orthogonal_function.h.
|
inlineinherited |
Definition at line 59 of file sub_state_vector_array.h.
|
virtualinherited |
Mark elements that we are actively using (i.e., that aren't ignored).
You only need to mark the ones that are used as true, everything is already initialized as false. Default is to do nothing.
Reimplemented from FullPhysics::StateVectorObserver.
Definition at line 35 of file sub_state_vector_observer.cc.
|
inlinevirtualinherited |
Mark elements that we are actively using (i.e., that aren't ignored).
You only need to mark the ones that are used as true, everything is already initialized as false. Default is to do nothing.
Reimplemented in FullPhysics::SubStateVectorObserver.
Definition at line 26 of file state_vector_observer.h.
|
inlinevirtualinherited |
Called by mark_used with the subset of the state vector used by this class.
The default marks everything as used, but derived classes can override this.
Reimplemented from FullPhysics::SubStateVectorObserver.
Definition at line 91 of file sub_state_vector_array.h.
|
inlinevirtualinherited |
Called when an object is added to an Observable.
Default is to do nothing.
Reimplemented in FullPhysics::AtmosphereOco, and FullPhysics::SubStateVectorObserver.
Definition at line 47 of file observer.h.
|
inlinevirtualinherited |
Definition at line 48 of file observer.h.
|
inlinevirtualinherited |
Called when an object is added to an Observable.
Default is to do nothing.
Reimplemented from FullPhysics::Observer< StateVector >.
Definition at line 60 of file sub_state_vector_observer.h.
|
inlinevirtualinherited |
Called when an object is removed from an Observable.
Default is to do nothing.
Reimplemented in FullPhysics::AtmosphereOco, and FullPhysics::SubStateVectorObserver.
Definition at line 55 of file observer.h.
|
inlinevirtualinherited |
Definition at line 56 of file observer.h.
|
inlinevirtualinherited |
Called when an object is removed from an Observable.
Default is to do nothing.
Reimplemented from FullPhysics::Observer< StateVector >.
Definition at line 68 of file sub_state_vector_observer.h.
|
virtualinherited |
Called when the Observed object is updated.
Reimplemented from FullPhysics::Observer< StateVector >.
Reimplemented in FullPhysics::RadianceScalingSvFit.
Definition at line 6 of file sub_state_vector_observer.cc.
|
inlinevirtualinherited |
Called when the Observed object is updated.
Reimplemented in FullPhysics::AtmosphereOco, FullPhysics::RadianceScalingSvFit, FullPhysics::AbsorberAbsco, FullPhysics::AerosolOptical, and FullPhysics::SubStateVectorObserver.
Definition at line 40 of file observer.h.
|
inlineprotectedinherited |
Function to call to notify Observers of a state change.
The object should pass itself to this function, so it can be passed to the Observers.
Definition at line 121 of file observer.h.
|
inline |
Order of the empirical orthogonal function (e.g., first order, second order, etc.)
Definition at line 124 of file empirical_orthogonal_function.h.
|
inlineinherited |
Definition at line 186 of file sub_state_vector_array.h.
|
virtual |
Reimplemented from FullPhysics::SubStateVectorObserver.
Definition at line 318 of file empirical_orthogonal_function.cc.
|
inlineinherited |
Print to string.
This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.
Definition at line 31 of file printable.h.
|
inlinevirtualinherited |
Remove an observer.
Implements FullPhysics::Observable< InstrumentCorrection >.
Definition at line 22 of file instrument_correction.h.
|
inlineprotectedinherited |
Remove an observer.
Definition at line 173 of file observer.h.
|
inlineprotectedinherited |
Definition at line 181 of file observer.h.
|
inline |
Scale.
This is just coeff(0), but we wrap this for use by EofOutput
Definition at line 130 of file empirical_orthogonal_function.h.
|
inline |
Scale uncertainty.
This is just sqrt(Cov(0,0)), but we wrap this for use by EofOutput
Definition at line 137 of file empirical_orthogonal_function.h.
|
virtualinherited |
Update any portion of the list of the state vector names that apply to this object.
Default is to do nothing.
Reimplemented from FullPhysics::StateVectorObserver.
Definition at line 52 of file sub_state_vector_observer.cc.
|
inlinevirtualinherited |
Update any portion of the list of the state vector names that apply to this object.
Default is to do nothing.
Reimplemented in FullPhysics::SubStateVectorObserver.
Definition at line 34 of file state_vector_observer.h.
|
inlinevirtual |
Return state vector name for ith entry in coeff.
Reimplemented from FullPhysics::SubStateVectorArray< InstrumentCorrection >.
Definition at line 98 of file empirical_orthogonal_function.h.
|
inlinevirtualinherited |
Called by state_vector_name with the subset of the Sv_name used by this class.
The default function doesn't change anything, but derived classes can ovveride this.
Reimplemented from FullPhysics::SubStateVectorObserver.
Definition at line 134 of file sub_state_vector_array.h.
|
protectedinherited |
Take the given number of state vector parameters.
We determine where the starting point to use is when we attach to the state vector.
Note that it is perfectly legal for Plen to be 0, that just means we don't have any parameters. This is a useful edge case that we support.
Definition at line 80 of file sub_state_vector_observer.cc.
|
inlineinherited |
Starting index of state vector used by this object.
Definition at line 25 of file sub_state_vector_observer.h.
|
inlineinherited |
Definition at line 181 of file sub_state_vector_array.h.
|
inlinevirtual |
Return a string to identify this part of the state, this name should be all lower case and seperate parts with a /.
For example, an aerosol named strat would be named as: aerosol/strat. A gas named CO2 would be named like this: absorber/co2 The name is intended to be used for looking up retrieval values for a configuration system. Classes that have the same type of inputs should have the same name.
Reimplemented from FullPhysics::SubStateVectorArray< InstrumentCorrection >.
Definition at line 96 of file empirical_orthogonal_function.h.
|
inlineinherited |
Length of the sub set of the state vector used by this object.
Definition at line 31 of file sub_state_vector_observer.h.
|
inlinevirtualinherited |
Called by update_state with the subset of the state vector used by this class.
Implements FullPhysics::SubStateVectorObserver.
Definition at line 145 of file sub_state_vector_array.h.
|
inlinevirtualinherited |
Hook for anything a derived class needs to do after coefficient is updated and before notify_update.
Default is nothing.
Definition at line 167 of file sub_state_vector_array.h.
|
inlineinherited |
Definition at line 176 of file sub_state_vector_array.h.
|
protectedinherited |
Coefficients.
Definition at line 196 of file sub_state_vector_array.h.
|
protectedinherited |
Last covariance matrix updated from the StateVector.
If we haven't updated yet, this will be a 0x0 array.
Definition at line 216 of file sub_state_vector_array.h.
|
protectedinherited |
Flag indicating if we only mark coefficients >= pdep_start + press->number_level() in mark_used_sub.
This may seem a bit arcane, but this matches some of the classes that derive from this one (e.g., TemperatureFixedLevel).
Definition at line 225 of file sub_state_vector_array.h.
|
protectedinherited |
Definition at line 200 of file observer.h.
|
protectedinherited |
Index of first coefficient that depends on the number of pressure levels.
This is only used if mark_according_to_press to true, otherwise we don't do anything with this value.
Definition at line 233 of file sub_state_vector_array.h.
|
protectedinherited |
This may be a null pointer, which just means this particular class doesn't store the Pressure object.
Definition at line 203 of file sub_state_vector_array.h.
|
protectedinherited |
Definition at line 201 of file observer.h.
|
protectedinherited |
The last full covariance matrix we have been with, saved for reference by derived class.
Definition at line 108 of file sub_state_vector_observer.h.
|
protectedinherited |
The subset of cov_full that is "owned" by this class, what was passed through update_sub_state.
Saved for reference by derived class.
Definition at line 122 of file sub_state_vector_observer.h.
|
protectedinherited |
The last full state vector we have been updated with, saved for reference by derived class.
Definition at line 102 of file sub_state_vector_observer.h.
|
protectedinherited |
The subset of sv_full that is "owned" by this class, what was passed through update_sub_state.
Saved for reference by derived class.
Definition at line 115 of file sub_state_vector_observer.h.
|
protectedinherited |
Flag indicating which of the coefficients gets updated by the StateVector.
Definition at line 210 of file sub_state_vector_array.h.