ReFRACtor
FullPhysics::ErrorAnalysis Class Reference

This calculates a variety of values to help with the error analysis of a Level 2 Full Physics Run. More...

#include <error_analysis.h>

+ Inheritance diagram for FullPhysics::ErrorAnalysis:
+ Collaboration diagram for FullPhysics::ErrorAnalysis:

Public Member Functions

 ErrorAnalysis (const boost::shared_ptr< ConnorSolver > &Solver, const boost::shared_ptr< AtmosphereOco > &Atm, const boost::shared_ptr< ForwardModel > &Fm, const boost::shared_ptr< Observation > &inst_meas)
 Constructor. More...
 
 ErrorAnalysis (const boost::shared_ptr< MaxAPosteriori > &Max_a_posteriori, const boost::shared_ptr< AtmosphereOco > &Atm, const boost::shared_ptr< ForwardModel > &Fm, const boost::shared_ptr< Observation > &inst_meas)
 Constructor. More...
 
 ErrorAnalysis (const boost::shared_ptr< ConnorSolver > &Solver, const boost::shared_ptr< RtAtmosphere > &Atm, const boost::shared_ptr< ForwardModel > &Fm, const boost::shared_ptr< Observation > &inst_meas)
 This is variation of ErrorAnalysis that takes a general RtAtmosphere. More...
 
 ErrorAnalysis (const boost::shared_ptr< MaxAPosteriori > &Max_a_posteriori, const boost::shared_ptr< RtAtmosphere > &Atm, const boost::shared_ptr< ForwardModel > &Fm, const boost::shared_ptr< Observation > &inst_meas)
 This is variation of ErrorAnalysis that takes a general RtAtmosphere. More...
 
virtual ~ErrorAnalysis ()
 
double chisq_measure_norm (const blitz::Array< double, 1 > &Residual, const blitz::Array< double, 1 > &Residual_cov_diag) const
 return chisq_measure_norm for the given data. More...
 
blitz::Array< double, 2 > co2_averaging_kernel () const
 Portion of averaging kernel that relates the part of the state vector that is used by the CO2 VMR calculation. More...
 
double degrees_of_freedom_full_vector () const
 Calculate the degrees of freedom for the full state vector. More...
 
double degrees_of_freedom_xco2 () const
 Calculate the degrees of freedom for the portion of the state vector used to determine xco2. More...
 
double gamma_last_step () const
 Levenberg-Marquardt parameter for last step we processed. More...
 
blitz::Array< double, 1 > interference_smoothing_uncertainty () const
 Calculate the interference smoothing uncertainty. More...
 
blitz::Array< double, 1 > modeled_radiance () const
 Modeled radiance. More...
 
double noise (int band) const
 Helper class for sort done in noise. More...
 
int num_channels () const
 The number of spectral bands associated with forward model. More...
 
void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 
double reduced_chisq (int Band) const
 Return the reduced chisq for band. More...
 
double relative_residual_mean_sq (int Band) const
 Return the relative residual mean square for the given band. More...
 
double residual_mean_sq (int Band) const
 Return the residual mean square for the O2 band. More...
 
double residual_sum_sq (int Band) const
 Return the sum of the squares of the residual for the given band. More...
 
double signal (int band) const
 Calculate an approximation to the size of the continuum signal where there is no significant atmosphere absorption. More...
 
blitz::Array< double, 1 > xco2_avg_kernel () const
 Calculate the XCO2 averaging kernel. More...
 
blitz::Array< double, 1 > xco2_avg_kernel_full () const
 This the XCO2 averaging kernel for the full state vector. More...
 
blitz::Array< double, 1 > xco2_avg_kernel_norm () const
 Calculate the normalized XCO2 averaging kernel. More...
 
blitz::Array< double, 1 > xco2_correlation_interf () const
 Calculate xco2_correlation_interf. More...
 
blitz::Array< double, 1 > xco2_gain_vector () const
 This calculates xco2_gain_vector. More...
 
double xco2_interference_error () const
 Calculate XCO2 interference error. More...
 
double xco2_measurement_error () const
 Calculate XCO2 measurement error. More...
 
double xco2_smoothing_error () const
 Calculate XCO2 smoothing error. More...
 
double xco2_uncert_interf () const
 Calculate xco2_uncert_interf. More...
 
double xco2_uncert_noise () const
 Calculate xco2_uncert_noise. More...
 
double xco2_uncert_smooth () const
 Calculate xco2_uncert_smooth. More...
 
double xco2_uncertainty () const
 XCO2 uncertainty. More...
 

Detailed Description

This calculates a variety of values to help with the error analysis of a Level 2 Full Physics Run.

We currently support both a ConnorSolver or the more general MaxAPosteriori. The error analysis is almost identical, we just get parameters from one or the other source.

Note that the current implementation of this class repeatedly calculates certain values (e.g., hmat is calculated each time it is used). We could cache values if needed, with code handling the clearing of the cache when absorber or solver changes. But right now the error analysis is only done a hand full of times (in a normal run, just at the end. With iteration output, at each iteration). Performance is perfectly acceptable, even with duplicate calculations. We can revisit this if performance ever becomes an issue.

Todo:
The various component calculation in section 3.6.5 and 3.6.6 in the ATB assume that the state vector contains the mixing ratio of the CO2 on levels. What needs to change in these calculations if it doesn't? (e.g., a scale, a shape)

Definition at line 35 of file error_analysis.h.

Constructor & Destructor Documentation

◆ ErrorAnalysis() [1/4]

ErrorAnalysis::ErrorAnalysis ( const boost::shared_ptr< ConnorSolver > &  Solver,
const boost::shared_ptr< AtmosphereOco > &  Atm,
const boost::shared_ptr< ForwardModel > &  Fm,
const boost::shared_ptr< Observation > &  inst_meas 
)

Constructor.

Definition at line 25 of file error_analysis.cc.

◆ ErrorAnalysis() [2/4]

ErrorAnalysis::ErrorAnalysis ( const boost::shared_ptr< MaxAPosteriori > &  Max_a_posteriori,
const boost::shared_ptr< AtmosphereOco > &  Atm,
const boost::shared_ptr< ForwardModel > &  Fm,
const boost::shared_ptr< Observation > &  inst_meas 
)

Constructor.

Definition at line 37 of file error_analysis.cc.

◆ ErrorAnalysis() [3/4]

ErrorAnalysis::ErrorAnalysis ( const boost::shared_ptr< ConnorSolver > &  Solver,
const boost::shared_ptr< RtAtmosphere > &  Atm,
const boost::shared_ptr< ForwardModel > &  Fm,
const boost::shared_ptr< Observation > &  inst_meas 
)

This is variation of ErrorAnalysis that takes a general RtAtmosphere.

This will fail for anything other than a AtmosphereOco, however it is convenient to have this for use with Lua (which has much more limited knowledge of the class structure).

Definition at line 52 of file error_analysis.cc.

◆ ErrorAnalysis() [4/4]

ErrorAnalysis::ErrorAnalysis ( const boost::shared_ptr< MaxAPosteriori > &  Max_a_posteriori,
const boost::shared_ptr< RtAtmosphere > &  Atm,
const boost::shared_ptr< ForwardModel > &  Fm,
const boost::shared_ptr< Observation > &  inst_meas 
)

This is variation of ErrorAnalysis that takes a general RtAtmosphere.

This will fail for anything other than a AtmosphereOco, however it is convenient to have this for use with Lua (which has much more limited knowledge of the class structure).

Definition at line 68 of file error_analysis.cc.

◆ ~ErrorAnalysis()

virtual FullPhysics::ErrorAnalysis::~ErrorAnalysis ( )
inlinevirtual

Definition at line 53 of file error_analysis.h.

Member Function Documentation

◆ chisq_measure_norm()

double FullPhysics::ErrorAnalysis::chisq_measure_norm ( const blitz::Array< double, 1 > &  Residual,
const blitz::Array< double, 1 > &  Residual_cov_diag 
) const
inline

return chisq_measure_norm for the given data.

Definition at line 140 of file error_analysis.h.

◆ co2_averaging_kernel()

Array< double, 2 > ErrorAnalysis::co2_averaging_kernel ( ) const

Portion of averaging kernel that relates the part of the state vector that is used by the CO2 VMR calculation.

Definition at line 482 of file error_analysis.cc.

◆ degrees_of_freedom_full_vector()

double FullPhysics::ErrorAnalysis::degrees_of_freedom_full_vector ( ) const
inline

Calculate the degrees of freedom for the full state vector.

This is just the trace of the averaging kernel.

Todo:
ATB reference?

Definition at line 202 of file error_analysis.h.

◆ degrees_of_freedom_xco2()

double FullPhysics::ErrorAnalysis::degrees_of_freedom_xco2 ( ) const
inline

Calculate the degrees of freedom for the portion of the state vector used to determine xco2.

Todo:
ATB reference?

Definition at line 215 of file error_analysis.h.

◆ gamma_last_step()

double FullPhysics::ErrorAnalysis::gamma_last_step ( ) const
inline

Levenberg-Marquardt parameter for last step we processed.

Definition at line 162 of file error_analysis.h.

◆ interference_smoothing_uncertainty()

Array< double, 1 > ErrorAnalysis::interference_smoothing_uncertainty ( ) const

Calculate the interference smoothing uncertainty.

Todo:
ATB reference?

Definition at line 381 of file error_analysis.cc.

◆ modeled_radiance()

blitz::Array<double, 1> FullPhysics::ErrorAnalysis::modeled_radiance ( ) const
inline

Modeled radiance.

Definition at line 65 of file error_analysis.h.

◆ noise()

double ErrorAnalysis::noise ( int  band) const

Helper class for sort done in noise.

Calculate an approximation to the size noise of the continuum signal where there is no significant atmosphere absorption. We approximate this by finding the 10 highest radiance values and averaging their noise.

Definition at line 442 of file error_analysis.cc.

◆ num_channels()

int FullPhysics::ErrorAnalysis::num_channels ( ) const
inline

The number of spectral bands associated with forward model.

Definition at line 59 of file error_analysis.h.

◆ print()

void FullPhysics::ErrorAnalysis::print ( std::ostream &  Os) const
inline

Definition at line 229 of file error_analysis.h.

◆ print_to_string()

std::string FullPhysics::Printable< ErrorAnalysis >::print_to_string ( ) const
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.

◆ reduced_chisq()

double FullPhysics::ErrorAnalysis::reduced_chisq ( int  Band) const
inline

Return the reduced chisq for band.

Definition at line 104 of file error_analysis.h.

◆ relative_residual_mean_sq()

double FullPhysics::ErrorAnalysis::relative_residual_mean_sq ( int  Band) const
inline

Return the relative residual mean square for the given band.

Definition at line 126 of file error_analysis.h.

◆ residual_mean_sq()

double FullPhysics::ErrorAnalysis::residual_mean_sq ( int  Band) const
inline

Return the residual mean square for the O2 band.

Definition at line 92 of file error_analysis.h.

◆ residual_sum_sq()

double FullPhysics::ErrorAnalysis::residual_sum_sq ( int  Band) const
inline

Return the sum of the squares of the residual for the given band.

Definition at line 77 of file error_analysis.h.

◆ signal()

double ErrorAnalysis::signal ( int  band) const

Calculate an approximation to the size of the continuum signal where there is no significant atmosphere absorption.

We approximate this by finding the 10 highest radiance values and averaging them.

Definition at line 401 of file error_analysis.cc.

◆ xco2_avg_kernel()

Array< double, 1 > ErrorAnalysis::xco2_avg_kernel ( ) const

Calculate the XCO2 averaging kernel.

Todo:
ATB reference?

Definition at line 327 of file error_analysis.cc.

◆ xco2_avg_kernel_full()

Array< double, 1 > ErrorAnalysis::xco2_avg_kernel_full ( ) const

This the XCO2 averaging kernel for the full state vector.

Definition at line 344 of file error_analysis.cc.

◆ xco2_avg_kernel_norm()

Array< double, 1 > ErrorAnalysis::xco2_avg_kernel_norm ( ) const

Calculate the normalized XCO2 averaging kernel.

Todo:
ATB reference?

Definition at line 359 of file error_analysis.cc.

◆ xco2_correlation_interf()

Array< double, 1 > ErrorAnalysis::xco2_correlation_interf ( ) const

Calculate xco2_correlation_interf.

Todo:
ATB reference?

Definition at line 309 of file error_analysis.cc.

◆ xco2_gain_vector()

Array< double, 1 > ErrorAnalysis::xco2_gain_vector ( ) const

This calculates xco2_gain_vector.

It is formally the partial derivative of retrieved XCO2 with respect to input radiance. It has the same size & shape as SpectralParameters/measured_radiance. That is, one entry per sounding, and each sounding has a vector of length m, which is the total # of channels across the 3 bands.

It can be calculated nearly exactly by using the posterior error covariance matrix S, the jacobian matrix K, the prior error covariance matrix Sy, and the pressure weighting function h. It is given by

(h^t, 0^t) S K^t Sy^-1

Where ^-1 denotes inverse, ^t denotes matrix transpose. The thing on the front in parentheses is a row vector of length n, where n is the number of state vector elements; it has h for its first 20 elements, and 0 after that. Is is formally the object that transforms the retrieved state vector into XCO2. Sy^-1 is calculated internally in the code, but it is also easy to construct. It is a diagonal (m,m) matrix with 1/sigma^2 down the diagonal, where sigma is the 1-sigma prior radiance uncertainty for each channel. K is the (n,m) matrix of jacobians, and S is the (n,n) posterior error covariance matrix.

Definition at line 186 of file error_analysis.cc.

◆ xco2_interference_error()

double ErrorAnalysis::xco2_interference_error ( ) const

Calculate XCO2 interference error.

This is equation 3-108 in the ATB

Todo:
ATB reference is from draft version, make sure it is still the right reference.

Definition at line 148 of file error_analysis.cc.

◆ xco2_measurement_error()

double ErrorAnalysis::xco2_measurement_error ( ) const

Calculate XCO2 measurement error.

This is equation 3-106 in the ATB

Todo:
ATB reference is from draft version, make sure it is still the right reference.

Definition at line 106 of file error_analysis.cc.

◆ xco2_smoothing_error()

double ErrorAnalysis::xco2_smoothing_error ( ) const

Calculate XCO2 smoothing error.

This is equation 3-107 in the ATB

Todo:
ATB reference is from draft version, make sure it is still the right reference.

Definition at line 122 of file error_analysis.cc.

◆ xco2_uncert_interf()

double FullPhysics::ErrorAnalysis::xco2_uncert_interf ( ) const
inline

Calculate xco2_uncert_interf.

Definition at line 189 of file error_analysis.h.

◆ xco2_uncert_noise()

double FullPhysics::ErrorAnalysis::xco2_uncert_noise ( ) const
inline

Calculate xco2_uncert_noise.

Definition at line 169 of file error_analysis.h.

◆ xco2_uncert_smooth()

double FullPhysics::ErrorAnalysis::xco2_uncert_smooth ( ) const
inline

Calculate xco2_uncert_smooth.

Definition at line 179 of file error_analysis.h.

◆ xco2_uncertainty()

double ErrorAnalysis::xco2_uncertainty ( ) const

XCO2 uncertainty.

Definition at line 465 of file error_analysis.cc.


The documentation for this class was generated from the following files:

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