Isis 3.0 Programmer Reference
Back | Home
Albedo.cpp
1 #include "Albedo.h"
2 #include "SpecialPixel.h"
3 #include "IException.h"
4 #include "IString.h"
5 #include "NormModel.h"
6 
7 namespace Isis {
8  Albedo::Albedo(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
9  PvlGroup &algorithm = pvl.findObject("NormalizationModel").findGroup("Algorithm", Pvl::Traverse);
10 
11  SetNormPharef(0.0);
12  SetNormIncref(0.0);
13  SetNormEmaref(0.0);
14  SetNormIncmat(0.0);
15  SetNormThresh(30.0);
16  SetNormAlbedo(1.0);
17 
18  // Get value from user
19  if(algorithm.hasKeyword("Incref")) {
20  SetNormIncref(algorithm["Incref"]);
21  }
22 
23  if(algorithm.hasKeyword("Pharef")) {
24  SetNormPharef(algorithm["Pharef"]);
25  } else {
26  p_normPharef = p_normIncref;
27  }
28 
29  if(algorithm.hasKeyword("Emaref")) {
30  SetNormEmaref(algorithm["Emaref"]);
31  }
32 
33  if(algorithm.hasKeyword("Incmat")) {
34  SetNormIncmat(algorithm["Incmat"]);
35  }
36 
37  if(algorithm.hasKeyword("Thresh")) {
38  SetNormThresh(algorithm["Thresh"]);
39  }
40 
41  if(algorithm.hasKeyword("Albedo")) {
42  SetNormAlbedo(algorithm["Albedo"]);
43  }
44 
45  // Calculate normalization at standard conditions.
46  GetPhotoModel()->SetStandardConditions(true);
47  p_normPsurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
48  GetPhotoModel()->SetStandardConditions(false);
49  }
50 
51 
52  void Albedo::NormModelAlgorithm(double phase, double incidence,
53  double emission, double demincidence, double dememission,
54  double dn, double &albedo, double &mult, double &base) {
55  double psurf;
56  double result;
57 
58  // code for scaling each pixel
59  psurf = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
60 
61  // thresh is a parameter limiting how much we amplify the dns
62  if(p_normPsurfref > psurf * p_normThresh) {
63  result = NULL8;
64  albedo = NULL8;
65  mult = 0.0;
66  base = 0.0;
67  }
68  else {
69  if(psurf == 0.0) {
70  QString msg = "Albedo math divide by zero error";
71  throw IException(IException::Unknown, msg, _FILEINFO_);
72  }
73  else {
74  result = dn * p_normPsurfref / psurf;
75  albedo = result;
76  mult = p_normPsurfref / psurf;
77  base = 0.0;
78  }
79  }
80  }
81 
91  void Albedo::SetNormPharef(const double pharef) {
92  if(pharef < 0.0 || pharef >= 180.0) {
93  QString msg = "Invalid value of normalization pharef [" +
94  toString(pharef) + "]";
96  }
97  p_normPharef = pharef;
98  }
99 
109  void Albedo::SetNormIncref(const double incref) {
110  if(incref < 0.0 || incref >= 90.0) {
111  QString msg = "Invalid value of normalization incref [" +
112  toString(incref) + "]";
114  }
115  p_normIncref = incref;
116  }
117 
127  void Albedo::SetNormEmaref(const double emaref) {
128  if(emaref < 0.0 || emaref >= 90.0) {
129  QString msg = "Invalid value of normalization emaref [" +
130  toString(emaref) + "]";
132  }
133  p_normEmaref = emaref;
134  }
135 
142  void Albedo::SetNormIncmat(const double incmat) {
143  if(incmat < 0.0 || incmat >= 90.0) {
144  QString msg = "Invalid value of normalization incmat [" +
145  toString(incmat) + "]";
147  }
148  p_normIncmat = incmat;
149  }
150 
159  void Albedo::SetNormAlbedo(const double albedo) {
160  p_normAlbedo = albedo;
161  }
162 
177  void Albedo::SetNormThresh(const double thresh) {
178  p_normThresh = thresh;
179  }
180 }
181 
182 extern "C" Isis::NormModel *AlbedoPlugin(Isis::Pvl &pvl, Isis::PhotoModel &pmodel) {
183  return new Isis::Albedo(pvl, pmodel);
184 }
void SetNormIncref(const double incref)
Set the normalization function parameter.
Definition: Albedo.cpp:109
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
Definition: Albedo.cpp:159
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
Definition: PhotoModel.cpp:171
void SetNormPharef(const double pharef)
Set parameters needed for albedo normalization.
Definition: Albedo.cpp:91
Search child objects.
Definition: PvlObject.h:170
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void SetNormIncmat(const double incmat)
Set the normalization function parameter.
Definition: Albedo.cpp:142
void SetNormThresh(const double thresh)
Set the normalization function parameter.
Definition: Albedo.cpp:177
Albedo normalization.
Definition: Albedo.h:58
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:134
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
Container for cube-like labels.
Definition: Pvl.h:135
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
Definition: Albedo.cpp:127
Isis exception class.
Definition: IException.h:99

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:14:05