8#include "SpecialPixel.h"
16 PvlGroup &algorithm = pvl.findObject(
"NormalizationModel").findGroup(
"Algorithm", Pvl::Traverse);
24 if(algorithm.hasKeyword(
"Incref")) {
25 SetNormIncref(algorithm[
"Incref"]);
28 if(algorithm.hasKeyword(
"Pharef")) {
29 SetNormPharef(algorithm[
"Pharef"]);
31 p_normPharef = p_normIncref;
34 if(algorithm.hasKeyword(
"Emaref")) {
35 SetNormEmaref(algorithm[
"Emaref"]);
38 if(algorithm.hasKeyword(
"Thresh")) {
39 SetNormThresh(algorithm[
"Thresh"]);
42 if(algorithm.hasKeyword(
"Albedo")) {
43 SetNormAlbedo(algorithm[
"Albedo"]);
47 void Topo::NormModelAlgorithm(
double phase,
double incidence,
double emission,
48 double demincidence,
double dememission,
double dn,
49 double &albedo,
double &mult,
double &base) {
51 static double pprimeref;
52 static double psurfref;
57 static double old_phase = -9999;
58 static double old_incidence = -9999;
59 static double old_emission = -9999;
60 static double old_demincidence = -9999;
61 static double old_dememission = -9999;
63 if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
64 old_demincidence != demincidence || old_dememission != dememission) {
66 GetPhotoModel()->SetStandardConditions(
true);
67 psurf0 = GetPhotoModel()->CalcSurfAlbedo(0.0, 0.0, 0.0);
70 std::string msg =
"Divide by zero error";
71 throw IException(IException::Unknown, msg, _FILEINFO_);
74 rhobar = p_normAlbedo / psurf0;
77 psurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
78 pprimeref = GetPhotoModel()->PhtTopder(p_normPharef, p_normIncref, p_normEmaref);
79 GetPhotoModel()->SetStandardConditions(
false);
82 psurf = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
83 pprime = GetPhotoModel()->PhtTopder(phase, demincidence, dememission);
86 old_incidence = incidence;
87 old_emission = emission;
88 old_demincidence = demincidence;
89 old_dememission = dememission;
92 if(psurf * pprimeref > pprime * p_normThresh) {
97 std::string msg =
"Divide by zero error";
98 throw IException(IException::Unknown, msg, _FILEINFO_);
101 albedo = dn * rhobar * (psurf * pprimeref) / pprime +
102 rhobar * psurfref - rhobar * (psurf * pprimeref) / pprime;
117 if(pharef < 0.0 || pharef >= 180.0) {
118 std::string msg =
"Invalid value of normalization pharef [" +
119 IString(pharef) +
"]";
120 throw IException(IException::User, msg, _FILEINFO_);
123 p_normPharef = pharef;
136 if(incref < 0.0 || incref >= 90.0) {
137 std::string msg =
"Invalid value of normalization incref [" +
138 IString(incref) +
"]";
139 throw IException(IException::User, msg, _FILEINFO_);
142 p_normIncref = incref;
155 if(emaref < 0.0 || emaref >= 90.0) {
156 std::string msg =
"Invalid value of normalization emaref [" +
157 IString(emaref) +
"]";
158 throw IException(IException::User, msg, _FILEINFO_);
161 p_normEmaref = emaref;
173 p_normAlbedo = albedo;
182 p_normThresh = thresh;
Topographic derivative of an arbitrary photometric function.
void SetNormPharef(const double pharef)
Set the normalization function parameter.
void SetNormIncref(const double incref)
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.
void SetNormThresh(const double thresh)
Set the normalization function parameter.
This is free and unencumbered software released into the public domain.