ReFRACtor
pca_binning.cc
Go to the documentation of this file.
1 #include "pca_binning.h"
2 
3 #include <boost/progress.hpp>
4 
5 using namespace FullPhysics;
6 using namespace blitz;
7 
8 extern "C" {
9  void create_bin_uvvswir_v1(int *E_nlayers, int *E_ndat, int *E_maxbins, int *ndat, int *nlay, int *nbin, double *binlims, double *gasdat, double *omega, int *ncnt, int *index);
10 }
11 
12 void PCABinning::compute_bins(const SpectralDomain& spec_domain, int channel_index)
13 {
14  Range all = Range::all();
15 
16  Array<double, 1> wavenumber(spec_domain.wavenumber());
17  boost::shared_ptr<boost::progress_display> progress(new boost::progress_display(wavenumber.rows(), *Logger::stream()));
18 
19  Array<double, 2> optical_depth(atmosphere->number_layer(), wavenumber.rows(), blitz::ColumnMajorArray<2>());
20  Array<double, 2> single_scattering_albedo(optical_depth.shape(), blitz::ColumnMajorArray<2>());
21 
22  // Gather optical depth and single scattering albedo for binning routines
23  for(int wn_idx = 0; wn_idx < wavenumber.rows(); ++wn_idx) {
24  optical_depth(all, wn_idx) = atmosphere->optical_depth_wrt_iv(wavenumber(wn_idx), channel_index).value();
25  single_scattering_albedo(all, wn_idx) = atmosphere->single_scattering_albedo_wrt_iv(wavenumber(wn_idx), channel_index).value();
26 
27  if (progress) *progress += 1;
28  }
29 
30  // Call selected binning routine
31  int nlayer = atmosphere->number_layer();
32  int ndat = wavenumber.rows();
33  int nbin = 11;
34 
35  binlims_.reference(Array<double, 1>(nbin, blitz::ColumnMajorArray<1>()));
36  ncnt_.reference(Array<int, 1>(nbin, blitz::ColumnMajorArray<1>()));
37  index_.reference(Array<int, 1>(wavenumber.rows(), blitz::ColumnMajorArray<1>()));
38 
39  create_bin_uvvswir_v1(&nlayer, &ndat, &nbin, &ndat, &nlayer, &nbin, binlims_.dataFirst(), optical_depth.dataFirst(), single_scattering_albedo.dataFirst(), ncnt_.dataFirst(), index_.dataFirst());
40 
41  // Compute binned optical properties, packing into the intermediate variable
42 }
void compute_bins(const SpectralDomain &spec_domain, int chanel_index)
Definition: pca_binning.cc:12
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
Apply value function to a blitz array.
static std::ostream * stream()
Underlying stream, can be null if no underlying stream.
Definition: logger.h:93
blitz::Array< double, 1 > wavenumber(const Unit &Units=units::inv_cm) const
Return data as wavenumbers.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
void create_bin_uvvswir_v1(int *E_nlayers, int *E_ndat, int *E_maxbins, int *ndat, int *nlay, int *nbin, double *binlims, double *gasdat, double *omega, int *ncnt, int *index)

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