ReFRACtor
|
This calculates a variety of values to help with the error analysis of a Level 2 Full Physics Run. More...
#include <error_analysis.h>
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... | |
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.
Definition at line 35 of file error_analysis.h.
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::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::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::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.
|
inlinevirtual |
Definition at line 53 of file error_analysis.h.
|
inline |
return chisq_measure_norm for the given data.
Definition at line 140 of file error_analysis.h.
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.
|
inline |
Calculate the degrees of freedom for the full state vector.
This is just the trace of the averaging kernel.
Definition at line 202 of file error_analysis.h.
|
inline |
Calculate the degrees of freedom for the portion of the state vector used to determine xco2.
Definition at line 215 of file error_analysis.h.
|
inline |
Levenberg-Marquardt parameter for last step we processed.
Definition at line 162 of file error_analysis.h.
Array< double, 1 > ErrorAnalysis::interference_smoothing_uncertainty | ( | ) | const |
Calculate the interference smoothing uncertainty.
Definition at line 381 of file error_analysis.cc.
|
inline |
Modeled radiance.
Definition at line 65 of file error_analysis.h.
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.
|
inline |
The number of spectral bands associated with forward model.
Definition at line 59 of file error_analysis.h.
|
inline |
Definition at line 229 of file error_analysis.h.
|
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.
|
inline |
Return the reduced chisq for band.
Definition at line 104 of file error_analysis.h.
|
inline |
Return the relative residual mean square for the given band.
Definition at line 126 of file error_analysis.h.
|
inline |
Return the residual mean square for the O2 band.
Definition at line 92 of file error_analysis.h.
|
inline |
Return the sum of the squares of the residual for the given band.
Definition at line 77 of file error_analysis.h.
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.
Array< double, 1 > ErrorAnalysis::xco2_avg_kernel | ( | ) | const |
Calculate the XCO2 averaging kernel.
Definition at line 327 of file error_analysis.cc.
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.
Array< double, 1 > ErrorAnalysis::xco2_avg_kernel_norm | ( | ) | const |
Calculate the normalized XCO2 averaging kernel.
Definition at line 359 of file error_analysis.cc.
Array< double, 1 > ErrorAnalysis::xco2_correlation_interf | ( | ) | const |
Calculate xco2_correlation_interf.
Definition at line 309 of file error_analysis.cc.
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.
double ErrorAnalysis::xco2_interference_error | ( | ) | const |
Calculate XCO2 interference error.
This is equation 3-108 in the ATB
Definition at line 148 of file error_analysis.cc.
double ErrorAnalysis::xco2_measurement_error | ( | ) | const |
Calculate XCO2 measurement error.
This is equation 3-106 in the ATB
Definition at line 106 of file error_analysis.cc.
double ErrorAnalysis::xco2_smoothing_error | ( | ) | const |
Calculate XCO2 smoothing error.
This is equation 3-107 in the ATB
Definition at line 122 of file error_analysis.cc.
|
inline |
Calculate xco2_uncert_interf.
Definition at line 189 of file error_analysis.h.
|
inline |
Calculate xco2_uncert_noise.
Definition at line 169 of file error_analysis.h.
|
inline |
Calculate xco2_uncert_smooth.
Definition at line 179 of file error_analysis.h.
double ErrorAnalysis::xco2_uncertainty | ( | ) | const |
XCO2 uncertainty.
Definition at line 465 of file error_analysis.cc.