10#include "NumericalApproximation.h"
11#include "IException.h"
15 PvlGroup &algorithm = pvl.findObject(
"NormalizationModel").findGroup(
"Algorithm", Pvl::Traverse);
22 if(algorithm.hasKeyword(
"Incref")) {
23 SetNormIncref(algorithm[
"Incref"]);
26 if(algorithm.hasKeyword(
"Pharef")) {
27 SetNormPharef(algorithm[
"Pharef"]);
29 p_normPharef = p_normIncref;
32 if(algorithm.hasKeyword(
"Emaref")) {
33 SetNormEmaref(algorithm[
"Emaref"]);
36 if(algorithm.hasKeyword(
"Albedo")) {
37 SetNormAlbedo(algorithm[
"Albedo"]);
55 void ShadeAtm::NormModelAlgorithm(
double phase,
double incidence,
double emission,
56 double demincidence,
double dememission,
double dn,
57 double &albedo,
double &mult,
double &base) {
61 static double ahInterp;
69 static double old_phase = -9999;
70 static double old_incidence = -9999;
71 static double old_emission = -9999;
72 static double old_demincidence = -9999;
73 static double old_dememission = -9999;
76 GetPhotoModel()->SetStandardConditions(
true);
77 psurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
78 GetPhotoModel()->SetStandardConditions(
false);
81 GetAtmosModel()->GenerateAhTable();
84 std::string msg =
"Divide by zero error";
85 throw IException(IException::Unknown, msg, _FILEINFO_);
88 rho = p_normAlbedo / psurfref;
90 if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
91 old_demincidence != demincidence || old_dememission != dememission) {
93 psurf = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
95 ahInterp = (GetAtmosModel()->AtmosAhSpline()).Evaluate(incidence, NumericalApproximation::Extrapolate);
97 munot = cos(incidence * (PI / 180.0));
100 old_incidence = incidence;
101 old_emission = emission;
102 old_demincidence = demincidence;
103 old_dememission = dememission;
106 GetAtmosModel()->CalcAtmEffect(phase, incidence, emission, &pstd, &trans, &trans0, &sbar,
109 albedo = pstd + rho * (ahInterp * munot * trans /
110 (1.0 - rho * GetAtmosModel()->AtmosAb() * sbar) + (psurf - ahInterp * munot) * trans0);
123 if(pharef < 0.0 || pharef >= 180.0) {
124 std::string msg =
"Invalid value of normalization pharef [" +
129 p_normPharef = pharef;
142 if(incref < 0.0 || incref >= 90.0) {
143 std::string msg =
"Invalid value of normalization incref [" +
148 p_normIncref = incref;
161 if(emaref < 0.0 || emaref >= 90.0) {
162 std::string msg =
"Invalid value of normalization emaref [" +
167 p_normEmaref = emaref;
179 p_normAlbedo = albedo;
Isotropic atmos scattering model.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Adds specific functionality to C++ strings.
Container for cube-like labels.
void SetNormIncref(const double incref)
Set the normalization function parameter.
void SetNormPharef(const double pharef)
Set the normalization function parameter.
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
This is free and unencumbered software released into the public domain.