15 switch (surface_type) {
20 initialize_brdf_kernel(
COXMUNK);
25 initialize_brdf_kernel(
RAHMAN);
26 initialize_brdf_kernel(surface_type);
29 Exception e(
"Unhandled BRDF type index: ");
43 int kernel_index = n_brdf_kernels();
44 n_brdf_kernels(n_brdf_kernels()+1);
46 bool lambertian_flag =
false;
47 int n_brdf_parameters;
49 Array<bool, 1> do_params_wfs;
52 lambertian_flag =
true;
53 n_brdf_parameters = 1;
57 do_params_wfs.resize(n_brdf_parameters);
58 do_params_wfs(0) =
false;
61 n_brdf_parameters = 3;
63 do_factor_wfs =
false;
65 do_params_wfs.resize(n_brdf_parameters);
66 do_params_wfs(0) =
true;
67 do_params_wfs(1) =
true;
68 do_params_wfs(2) =
false;
71 n_brdf_parameters = 3;
75 do_params_wfs.resize(n_brdf_parameters);
80 n_brdf_parameters = 1;
84 do_params_wfs.resize(n_brdf_parameters);
85 do_params_wfs(0) =
false;
88 Exception e(
"Unhandled BRDF kernel type: ");
93 initialize_kernel_parameters(kernel_index, which_brdf, lambertian_flag, n_brdf_parameters, do_factor_wfs, do_params_wfs);
96 int n_factor_wfs = do_factor_wfs ? 1 : 0;
97 int n_param_wfs = sum(where(do_params_wfs(Range::all()) ==
true, 1, 0));
99 n_kernel_factor_wfs(n_kernel_factor_wfs() + n_factor_wfs);
100 n_kernel_params_wfs(n_kernel_params_wfs() + n_param_wfs);
101 n_surface_wfs(n_surface_wfs() + n_factor_wfs + n_param_wfs);
104 do_kparams_derivs(kernel_index, any(do_params_wfs(Range::all())));
122 Array<int, 1> parameter_indexes;
124 switch (surface_type) {
126 parameter_indexes.resize(1);
127 parameter_indexes(0) = 0;
128 setup_lambertian_inputs(0, rt_surf_params, parameter_indexes);
132 parameter_indexes.resize(3);
133 parameter_indexes(0) = 0;
134 parameter_indexes(1) = 1;
135 parameter_indexes(2) = 3;
136 setup_coxmunk_inputs(0, rt_surf_params, parameter_indexes);
139 parameter_indexes.resize(1);
140 parameter_indexes(0) = 2;
141 setup_lambertian_inputs(1, rt_surf_params, parameter_indexes);
145 parameter_indexes.resize(4);
146 parameter_indexes(0) = 0;
147 parameter_indexes(1) = 1;
148 parameter_indexes(2) = 2;
149 parameter_indexes(3) = 3;
150 setup_rahman_inputs(0, rt_surf_params, parameter_indexes);
152 parameter_indexes.resize(1);
153 parameter_indexes(0) = 4;
154 setup_breon_inputs(1, rt_surf_params, parameter_indexes);
157 Exception e(
"Unhandled BRDF type index: ");
165 return rt_surf_params;
174 int albedo_idx = parameter_indexes(0);
175 brdf_factors(kernel_index) = surface_parameters(albedo_idx).
value();
178 brdf_params(kernel_index, 0) = 1.0;
183 brdf_factors(kernel_index) = 1.0;
186 int ws_idx = parameter_indexes(0);
187 int refr_idx = parameter_indexes(1);
188 int shadow_idx = parameter_indexes(2);
191 surface_parameters(ws_idx) = 0.003 + 0.00512 * surface_parameters(ws_idx);
192 brdf_params(kernel_index, 0) = surface_parameters(ws_idx).
value();
194 surface_parameters(refr_idx) = surface_parameters(refr_idx) * surface_parameters(refr_idx);
195 brdf_params(kernel_index, 1) = surface_parameters(refr_idx).
value();
198 brdf_params(kernel_index, 2) = surface_parameters(shadow_idx).
value();
202 do_shadow_effect(surface_parameters(shadow_idx).
value() > 0.0);
208 int kf_idx = parameter_indexes(0);
209 int ampl_idx = parameter_indexes(1);
210 int asym_idx = parameter_indexes(2);
211 int geom_idx = parameter_indexes(3);
213 brdf_factors(kernel_index) = surface_parameters(kf_idx).
value();
216 brdf_params(kernel_index, 0) = surface_parameters(ampl_idx).
value();
218 brdf_params(kernel_index, 1) = surface_parameters(asym_idx).
value();
220 brdf_params(kernel_index, 2) = surface_parameters(geom_idx).
value();
225 int kf_idx = parameter_indexes(0);
227 brdf_factors(kernel_index) = surface_parameters(kf_idx).
value();
228 brdf_params(kernel_index, 0) = 2.25;
238 double sza,
double azm,
double zen,
240 const Array<double, 1>& surface_parameters,
241 const Array<double, 1>& od,
242 const Array<double, 1>& ssa,
243 const Array<double, 2>& pf,
245 const Array<double, 1>& atmosphere_bb)
248 setup_height_grid(height_grid);
249 brdf_driver_-> setup_geometry(sza, azm, zen);
250 setup_geometry(sza, azm, zen);
255 surf_param_ad.
value() = surface_parameters;
256 ArrayAd<double, 1> lidort_surf = brdf_driver_->setup_brdf_inputs(surface_type, surf_param_ad);
259 setup_optical_inputs(od, ssa, pf);
261 if (do_thermal_emission)
262 setup_thermal_inputs(surface_bb, atmosphere_bb);
264 clear_linear_inputs();
268 return get_intensity();
277 double sza,
double azm,
double zen,
284 Array<double, 2>& jac_atm,
285 Array<double, 1>& jac_surf,
287 const Array<double, 1>& atmosphere_bb)
291 setup_height_grid(height_grid);
292 brdf_driver_->setup_geometry(sza, azm, zen);
293 setup_geometry(sza, azm, zen);
296 surface_parameters = brdf_driver_->setup_brdf_inputs(surface_type, surface_parameters);
300 if (do_thermal_emission)
301 setup_thermal_inputs(surface_bb, atmosphere_bb);
303 bool do_surface_pd =
true;
304 setup_linear_inputs(od, ssa, pf, do_surface_pd);
308 reflectance = get_intensity();
309 copy_jacobians(jac_atm, jac_surf);
virtual void setup_coxmunk_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > ¶meter_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...
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...
This is the base of the exception hierarchy for Full Physics code.
virtual double reflectance_calculate(const blitz::Array< double, 1 > &height_grid, double sza, double azm, double zen, int surface_type, const blitz::Array< double, 1 > &surface_parameters, const blitz::Array< double, 1 > &od, const blitz::Array< double, 1 > &ssa, const blitz::Array< double, 2 > &pf, double surface_bb=0, const blitz::Array< double, 1 > &atmosphere_bb=blitz::Array< double, 1 >())
Computes reflectance without jacobians.
Apply value function to a blitz array.
const blitz::Array< T, D > & value() const
virtual void reflectance_and_jacobian_calculate(const blitz::Array< double, 1 > &height_grid, double sza, double azm, double zen, int surface_type, ArrayAd< double, 1 > &surface_parameters, const ArrayAd< double, 1 > &od, const ArrayAd< double, 1 > &ssa, const ArrayAd< double, 2 > &pf, double &reflectance, blitz::Array< double, 2 > &jac_atm, blitz::Array< double, 1 > &jac_surf, double surface_bb=0, const blitz::Array< double, 1 > &atmosphere_bb=blitz::Array< double, 1 >())
Calculates intensity, profile and surface weighting factors (jacobians) with the given inputs...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
virtual void setup_breon_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > ¶meter_indexes) const
virtual void initialize_brdf_inputs(int surface_type)
Initializes the BRDF kernels for the given Ground surface type integer.
double value(const FullPhysics::AutoDerivative< double > &Ad)
virtual void setup_lambertian_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > ¶meter_indexes) const
virtual void setup_rahman_inputs(int kernel_index, ArrayAd< double, 1 > &surface_parameters, const blitz::Array< int, 1 > ¶meter_indexes) const