ReFRACtor
radiance_scaling.cc
Go to the documentation of this file.
1 #include "radiance_scaling.h"
2 #include "polynomial_eval.h"
3 #include "ostream_pad.h"
4 
5 using namespace FullPhysics;
6 using namespace blitz;
7 
9 {
10  double band_ref_conv = band_ref.convert_wave(Grid.units()).value;
11  if(Radiance.data_ad().number_variable() == 0) {
12  Poly1d scaling_poly(scaling_coeff.value(), false);
13 
14  for(int i = 0; i < Radiance.data().rows(); ++i) {
15  double scale_factor = scaling_poly(Grid.data()(i) - band_ref_conv);
16  Radiance.data()(i) = Radiance.data()(i) * scale_factor + offset.value();
17  }
18 
19  } else {
20  Poly1d scaling_poly(scaling_coeff, false);
21 
22  for(int i = 0; i < Radiance.data_ad().rows(); ++i) {
23  AutoDerivative<double> scale_factor(scaling_poly(Grid.data_ad()(i) - band_ref_conv));
24  Radiance.data_ad()(i) = Radiance.data_ad()(i) * scale_factor + offset;
25  }
26  }
27 
28 }
29 
30 void RadianceScaling::print(std::ostream& Os) const
31 {
32  Poly1d scaling_poly(scaling_coeff.value(), false);
33  Os << "RadianceScaling:" << std::endl;
34  OstreamPad opad(Os, " ");
35  opad << "Band: " << band_name << std::endl
36  << "Scaling polynomial:" << std::endl
37  << " " << scaling_poly << std::endl
38  << "Offset: " << offset.value() << std::endl;
39  opad.strict_sync();
40 }
virtual void apply_scaling(const SpectralDomain &Grid, SpectralRange &Radiance) const
Apply scaling and offset coefficients to Radiance.
virtual void print(std::ostream &Os) const
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
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.
Apply value function to a blitz array.
A one-dimensional polynomial class.
int number_variable() const
Definition: array_ad.h:376
We have a number of different spectrums that appear in different parts of the code.
const ArrayAd< double, 1 > & data_ad() const
Underlying data, possibly with a Jacobian.
const Unit units() const
Units that go with data()
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
double value(const FullPhysics::AutoDerivative< double > &Ad)
const blitz::Array< double, 1 > & data() const
Underlying data.
const blitz::Array< double, 1 > & data() const
Return data.
int rows() const
Definition: array_ad.h:368

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