ReFRACtor
spurr_driver.h
Go to the documentation of this file.
1 #ifndef SPURR_RT_DRIVER_H
2 #define SPURR_RT_DRIVER_H
3 
4 #include <boost/shared_ptr.hpp>
5 #include <blitz/array.h>
6 #include "array_ad.h"
7 #include "generic_object.h"
8 
9 /****************************************************************/
14 namespace FullPhysics {
15 
16 /****************************************************************/
37 class SpurrBrdfDriver : public virtual GenericObject {
38 
39 public:
40  virtual void initialize_brdf_inputs(int surface_type);
41  virtual void setup_geometry(double sza, double azm, double zen) const = 0;
42  virtual ArrayAd<double, 1> setup_brdf_inputs(int surface_type, const ArrayAd<double, 1>& surface_parameters) const;
43 
44  virtual int n_brdf_kernels() const = 0;
45 
46  virtual int n_kernel_factor_wfs() const = 0;
47  virtual int n_kernel_params_wfs() const = 0;
48  virtual int n_surface_wfs() const = 0;
49  virtual bool do_kparams_derivs(const int kernel_index) const = 0;
50  virtual bool do_shadow_effect() const = 0;
51 
52 protected:
53  virtual void initialize_brdf_kernel(int kernel_type);
54 
55  virtual void setup_lambertian_inputs(int kernel_index, ArrayAd<double, 1>& surface_parameters, const blitz::Array<int, 1>& parameter_indexes) const;
56  virtual void setup_coxmunk_inputs(int kernel_index, ArrayAd<double, 1>& surface_parameters, const blitz::Array<int, 1>& parameter_indexes) const;
57  virtual void setup_rahman_inputs(int kernel_index, ArrayAd<double, 1>& surface_parameters, const blitz::Array<int, 1>& parameter_indexes) const;
58  virtual void setup_breon_inputs(int kernel_index, ArrayAd<double, 1>& surface_parameters, const blitz::Array<int, 1>& parameter_indexes) const;
59 
60  virtual void calculate_brdf() const = 0;
61 
62  virtual void n_brdf_kernels(const int n_kernels) = 0;
63  virtual void n_kernel_factor_wfs(const int n_factors) = 0;
64  virtual void n_kernel_params_wfs(const int n_params) = 0;
65  virtual void n_surface_wfs(const int n_wfs) = 0;
66  virtual void do_kparams_derivs(const int kernel_index, const bool do_kparams) = 0;
67  virtual void do_shadow_effect(const bool do_shadow) const = 0;
68 
69  virtual void initialize_kernel_parameters(const int kernel_index,
70  const int which_brdf,
71  const bool lambertian_flag,
72  const int n_brdf_parameters,
73  const bool do_factor_wfs,
74  const blitz::Array<bool, 1>& do_params_wfs) = 0;
75 
76  // To speed up brdf setup, ie reduce the number of function calls
77  // These are set through attributes linked to a valid array by the implementing class.
78  mutable blitz::Array<double, 1> brdf_factors;
79  mutable blitz::Array<double, 2> brdf_params;
80 };
81 
82 /****************************************************************/
90 class SpurrRtDriver : public virtual GenericObject {
91 
92 public:
93 
94  SpurrRtDriver(bool do_solar = true, bool do_thermal = false)
95  : do_solar_sources(do_solar), do_thermal_emission(do_thermal) {}
96 
98  virtual double reflectance_calculate(const blitz::Array<double, 1>& height_grid,
99  double sza, double azm, double zen,
100  int surface_type,
101  const blitz::Array<double, 1>& surface_parameters,
102  const blitz::Array<double, 1>& od,
103  const blitz::Array<double, 1>& ssa,
104  const blitz::Array<double, 2>& pf,
105  double surface_bb = 0,
106  const blitz::Array<double, 1>& atmosphere_bb = blitz::Array<double,1>());
107 
108  // Computes reflectance and jacobians for profiles as well as surface
109  virtual void reflectance_and_jacobian_calculate(const blitz::Array<double, 1>& height_grid,
110  double sza, double azm, double zen,
111  int surface_type,
112  ArrayAd<double, 1>& surface_parameters,
113  const ArrayAd<double, 1>& od,
114  const ArrayAd<double, 1>& ssa,
115  const ArrayAd<double, 2>& pf,
116  double& reflectance,
117  blitz::Array<double, 2>& jac_atm,
118  blitz::Array<double, 1>& jac_surf,
119  double surface_bb = 0,
120  const blitz::Array<double, 1>& atmosphere_bb = blitz::Array<double,1>());
121 
123  const boost::shared_ptr<SpurrBrdfDriver> brdf_driver() const { return brdf_driver_; }
124 
127  virtual void setup_height_grid(const blitz::Array<double, 1>& height_grid) const = 0;
128 
131  virtual void setup_geometry(double sza, double azm, double zen) const = 0;
132 
134  virtual void setup_thermal_inputs(double surface_bb, const blitz::Array<double, 1> atmosphere_bb) const = 0;
135 
138  virtual void setup_optical_inputs(const blitz::Array<double, 1>& od,
139  const blitz::Array<double, 1>& ssa,
140  const blitz::Array<double, 2>& pf) const = 0;
141 
143  virtual void clear_linear_inputs() const = 0;
144 
146  virtual void setup_linear_inputs(const ArrayAd<double, 1>& od,
147  const ArrayAd<double, 1>& ssa,
148  const ArrayAd<double, 2>& pf,
149  bool do_surface_linearization) const = 0;
150 
153  virtual void calculate_rt() const = 0;
154 
156  virtual double get_intensity() const = 0;
157 
159  virtual void copy_jacobians(blitz::Array<double, 2>& jac_atm, blitz::Array<double, 1>& jac_surf) const = 0;
160 
161 protected:
162 
163  bool do_solar_sources, do_thermal_emission;
164 
166  virtual void initialize_rt() = 0;
167 
170 
171 };
172 
173 }
174 
175 #endif
virtual void setup_coxmunk_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > &parameter_indexes) const
virtual void initialize_brdf_kernel(int kernel_type)
Initializes a specific BRDF kernel based on the kernel type integer Each call adds a new kernel setup...
Definition: spurr_driver.cc:41
virtual bool do_shadow_effect() const =0
virtual ArrayAd< double, 1 > setup_brdf_inputs(int surface_type, const ArrayAd< double, 1 > &surface_parameters) const
Sets up the BRDF inputs to be used by the BRDF calculation code This routine is intended to be called...
virtual int n_brdf_kernels() const =0
virtual int n_kernel_params_wfs() const =0
const boost::shared_ptr< SpurrBrdfDriver > brdf_driver() const
Access to BRDF driver.
Definition: spurr_driver.h:123
SpurrRtDriver(bool do_solar=true, bool do_thermal=false)
Definition: spurr_driver.h:94
virtual void setup_geometry(double sza, double azm, double zen) const =0
virtual int n_surface_wfs() const =0
Abstracts away set up of BRDF kernel interfaces.
Definition: spurr_driver.h:37
virtual void initialize_kernel_parameters(const int kernel_index, const int which_brdf, const bool lambertian_flag, const int n_brdf_parameters, const bool do_factor_wfs, const blitz::Array< bool, 1 > &do_params_wfs)=0
blitz::Array< double, 1 > brdf_factors
Definition: spurr_driver.h:78
virtual int n_kernel_factor_wfs() const =0
virtual bool do_kparams_derivs(const int kernel_index) const =0
Abstracts away set up of Radiative Transfer software from Rob Spurr into a simpler common inteface us...
Definition: spurr_driver.h:90
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual void setup_breon_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > &parameter_indexes) const
For use with SWIG, it is useful to have a base class that everything can be cast to.
virtual void calculate_brdf() const =0
virtual void initialize_brdf_inputs(int surface_type)
Initializes the BRDF kernels for the given Ground surface type integer.
Definition: spurr_driver.cc:13
virtual void setup_lambertian_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > &parameter_indexes) const
boost::shared_ptr< SpurrBrdfDriver > brdf_driver_
Spurr BRDF class interface class to use.
Definition: spurr_driver.h:169
virtual void setup_rahman_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > &parameter_indexes) const
blitz::Array< double, 2 > brdf_params
Definition: spurr_driver.h:79

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