8#include "SpecialPixel.h"
15 Topo::Topo(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
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;
116 void Topo::SetNormPharef(
const double pharef) {
117 if(pharef < 0.0 || pharef >= 180.0) {
118 std::string msg =
"Invalid value of normalization pharef [" +
120 throw IException(IException::User, msg, _FILEINFO_);
123 p_normPharef = pharef;
135 void Topo::SetNormIncref(
const double incref) {
136 if(incref < 0.0 || incref >= 90.0) {
137 std::string msg =
"Invalid value of normalization incref [" +
139 throw IException(IException::User, msg, _FILEINFO_);
142 p_normIncref = incref;
154 void Topo::SetNormEmaref(
const double emaref) {
155 if(emaref < 0.0 || emaref >= 90.0) {
156 std::string msg =
"Invalid value of normalization emaref [" +
158 throw IException(IException::User, msg, _FILEINFO_);
161 p_normEmaref = emaref;
172 void Topo::SetNormAlbedo(
const double albedo) {
173 p_normAlbedo = albedo;
181 void Topo::SetNormThresh(
const double thresh) {
182 p_normThresh = thresh;
Adds specific functionality to C++ strings.
Container for cube-like labels.
Topographic derivative of an arbitrary photometric function.
This is free and unencumbered software released into the public domain.