9#include "SpecialPixel.h"
10#include "IException.h"
13 MoonAlbedo::MoonAlbedo(Pvl &pvl, PhotoModel &pmodel) :
14 NormModel(pvl, pmodel) {
15 PvlGroup &algo = pvl.findObject(
"NormalizationModel")
16 .findGroup(
"Algorithm", Pvl::Traverse);
23 SetNormWl(p_normWavelength);
30 if(algo.hasKeyword(
"D")) {
34 if(algo.hasKeyword(
"Wl")) {
35 SetNormWl(algo[
"Wl"]);
38 if(algo.hasKeyword(
"E")) {
43 p_normE = -0.3575 * p_normWl - 0.0607;
50 if(algo.hasKeyword(
"F")) {
54 if(algo.hasKeyword(
"G2")) {
55 SetNormG2(algo[
"G2"]);
59 p_normG2 = -0.9585 * p_normWl + 0.98;
66 if(algo.hasKeyword(
"Xmul")) {
67 SetNormXmul(algo[
"Xmul"]);
70 if(algo.hasKeyword(
"H")) {
74 if(algo.hasKeyword(
"Bsh1")) {
75 SetNormBsh1(algo[
"Bsh1"]);
78 p_normBsh1 = 19.89 - 59.58 * p_normWl + 59.86 * pow(p_normWl, 2) -
79 20.09 * pow(p_normWl, 3);
80 if(p_normBsh1 < 0.0) {
85 if(algo.hasKeyword(
"Xb1")) {
86 SetNormXb1(algo[
"Xb1"]);
89 if(algo.hasKeyword(
"Xb2")) {
90 SetNormXb2(algo[
"Xb2"]);
95 p_normF1 = 1.0 - p_normF;
96 double g1 = p_normD * 0.1 + p_normE;
97 double g1sq = g1 * g1;
98 p_normG2sq = p_normG2 * p_normG2;
99 double c30 = cos(30.0 *
Isis::PI / 180.0);
100 if(1.0 + g1sq + 2.0 * g1 *c30 <= 0.0) {
101 std::string msg =
"Error while initializing Buratti function";
102 throw IException(IException::Unknown, msg, _FILEINFO_);
104 double pg130 = p_normF1 * (1.0 - g1sq) / (pow((1.0 + g1sq + 2.0 * g1 * c30), 1.5));
105 if(1.0 + p_normG2sq + 2.0 * p_normG2 *c30 <= 0.0) {
106 std::string msg =
"Error while initializing Buratti function";
107 throw IException(IException::Unknown, msg, _FILEINFO_);
109 double pg230 = p_normF * (1.0 - p_normG2sq) / (pow((1.0 + p_normG2sq + 2.0 * p_normG2 * c30), 1.5));
110 if(p_normBsh1 < 0.0) p_normBsh1 = 0.0;
111 if(1.0 + tan(15.0 *
Isis::PI / 180.0) / p_normH == 0.0) {
112 std::string msg =
"Error while initializing Buratti function";
113 throw IException(IException::Unknown, msg, _FILEINFO_);
115 double bshad30 = 1.0 + p_normBsh1 / (1.0 + tan(15.0 *
Isis::PI / 180.0) / p_normH);
116 p_normPg30 = (pg130 + pg230) * bshad30;
117 p_normBc1 = p_normXb1 + p_normXb2 * p_normWl;
118 p_normFbc3 = 1.0 + p_normBc1 * 2.0;
119 if(p_normFbc3 == 0.0) {
120 std::string msg =
"Error while initializing Buratti function";
121 throw IException(IException::Unknown, msg, _FILEINFO_);
123 p_normC3 = cos(2.0 *
Isis::PI / 180.0);
124 if(1.0 + p_normG2sq + 2.0 * p_normG2 *p_normC3 <= 0.0) {
125 std::string msg =
"Error while initializing Buratti function";
126 throw IException(IException::Unknown, msg, _FILEINFO_);
128 p_normPg32 = p_normF * (1.0 - p_normG2sq) / (pow((1.0 + p_normG2sq + 2.0 * p_normG2 * p_normC3), 1.5));
129 if(1.0 + tan(
Isis::PI / 180.0) / p_normH == 0.0) {
130 std::string msg =
"Error while initializing Buratti function";
131 throw IException(IException::Unknown, msg, _FILEINFO_);
133 p_normBshad3 = 1.0 + p_normBsh1 / (1.0 + tan(
Isis::PI / 180.0) / p_normH);
136 void MoonAlbedo::NormModelAlgorithm(
double phase,
double incidence,
double emission,
137 double demincidence,
double dememission,
double dn,
138 double &albedo,
double &mult,
double &base) {
152 a = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
155 cosa = cos(phase *
Isis::PI / 180.0);
156 if(1.0 + p_normG2sq + 2.0 * p_normG2 *cosa <= 0.0) {
160 pg2 = p_normF * (1.0 - p_normG2sq) / (pow((1.0 + p_normG2sq + 2.0 * p_normG2 * cosa), 1.5));
161 if(1.0 + tan(phase * .5 *
Isis::PI / 180.0) / p_normH == 0.0) {
165 bshad = 1.0 + p_normBsh1 / (1.0 + tan(phase * .5 *
Isis::PI / 180.0) / p_normH);
169 for(
int i = 0; i < 6; i++) {
170 g1 = p_normD * albedo + p_normE;
172 if(1.0 + g1sq + 2.0 * g1 *cosa <= 0.0) {
176 pg1 = p_normF1 * (1.0 - g1sq) / (pow((1.0 + g1sq + 2.0 * g1 * cosa), 1.5));
177 pg = (pg1 + pg2) * bshad;
179 fbc = 1.0 + p_normBc1 * phase;
180 if(1.0 + g1sq + 2.0 * g1 *p_normC3 <= 0.0) {
184 pg31 = p_normF1 * (1.0 - g1sq) / (pow((1.0 + g1sq + 2.0 * g1 * p_normC3), 1.5));
185 pg3 = (pg31 + p_normPg32) * p_normBshad3;
186 pg = fbc * (pg3 / p_normFbc3);
192 albedo = r * a * p_normPg30 / pg;
208 void MoonAlbedo::SetNormD(
const double d) {
220 void MoonAlbedo::SetNormWl(
const double wl) {
231 void MoonAlbedo::SetNormE(
const double e) {
242 void MoonAlbedo::SetNormF(
const double f) {
253 void MoonAlbedo::SetNormG2(
const double g2) {
264 void MoonAlbedo::SetNormXmul(
const double xmul) {
275 void MoonAlbedo::SetNormH(
const double h) {
277 std::string msg =
"Invalid value of normalization h [" +
279 throw IException(IException::User, msg, _FILEINFO_);
292 void MoonAlbedo::SetNormBsh1(
const double bsh1) {
294 std::string msg =
"Invalid value of normalization bsh1 [" +
296 throw IException(IException::User, msg, _FILEINFO_);
309 void MoonAlbedo::SetNormXb1(
const double xb1) {
320 void MoonAlbedo::SetNormXb2(
const double xb2) {
Adds specific functionality to C++ strings.
Albedo dependent phase function normalization for the Moon.
Container for cube-like labels.
This is free and unencumbered software released into the public domain.
const double PI
The mathematical constant PI.