Isis 3 Programmer Reference
Shade.cpp
1 #include "Shade.h"
2 #include "IException.h"
3 
4 
5 namespace Isis {
6  Shade::Shade(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
7  PvlGroup &algorithm = pvl.findObject("NormalizationModel").findGroup("Algorithm", Pvl::Traverse);
8 
9  SetNormPharef(0.0);
10  SetNormIncref(0.0);
11  SetNormEmaref(0.0);
12  SetNormAlbedo(1.0);
13 
14  if(algorithm.hasKeyword("Incref")) {
15  SetNormIncref(algorithm["Incref"]);
16  }
17 
18  if(algorithm.hasKeyword("Pharef")) {
19  SetNormPharef(algorithm["Pharef"]);
20  }
21  else {
22  p_normPharef = p_normIncref;
23  }
24 
25  if(algorithm.hasKeyword("Emaref")) {
26  SetNormEmaref(algorithm["Emaref"]);
27  }
28 
29  if(algorithm.hasKeyword("Albedo")) {
30  SetNormAlbedo(algorithm["Albedo"]);
31  }
32  }
33 
34  void Shade::NormModelAlgorithm(double phase, double incidence, double emission,
35  double demincidence, double dememission, double dn,
36  double &albedo, double &mult, double &base) {
37  double rho;
38  double psurfref;
39 
40  // Calculate normalization at standard conditions
41  GetPhotoModel()->SetStandardConditions(true);
42  psurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
43  GetPhotoModel()->SetStandardConditions(false);
44 
45  if(psurfref == 0.0) {
46  std::string msg = "Divide by zero error";
47  throw IException(IException::Unknown, msg, _FILEINFO_);
48  }
49 
50  rho = p_normAlbedo / psurfref;
51 
52  albedo = rho * GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
53  }
54 
64  void Shade::SetNormPharef(const double pharef) {
65  if(pharef < 0.0 || pharef >= 180.0) {
66  std::string msg = "Invalid value of normalization pharef [" + IString(pharef) + "]";
68  }
69 
70  p_normPharef = pharef;
71  }
72 
82  void Shade::SetNormIncref(const double incref) {
83  if(incref < 0.0 || incref >= 90.0) {
84  std::string msg = "Invalid value of normalization incref [" + IString(incref) + "]";
86  }
87 
88  p_normIncref = incref;
89  }
90 
100  void Shade::SetNormEmaref(const double emaref) {
101  if(emaref < 0.0 || emaref >= 90.0) {
102  std::string msg = "Invalid value of normalization emaref [" + IString(emaref) + "]";
104  }
105 
106  p_normEmaref = emaref;
107  }
108 
118  void Shade::SetNormAlbedo(const double albedo) {
119  p_normAlbedo = albedo;
120  }
121 }
122 
123 extern "C" Isis::NormModel *ShadePlugin(Isis::Pvl &pvl, Isis::PhotoModel &pmodel) {
124  return new Isis::Shade(pvl, pmodel);
125 }
void SetNormPharef(const double pharef)
Set parameters needed for albedo normalization.
Definition: Shade.cpp:64
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
Definition: Shade.cpp:118
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
Definition: PhotoModel.cpp:171
void SetNormIncref(const double incref)
Set the normalization function parameter.
Definition: Shade.cpp:82
Search child objects.
Definition: PvlObject.h:170
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
Container for cube-like labels.
Definition: Pvl.h:135
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
Definition: Shade.cpp:100
Isis exception class.
Definition: IException.h:107
Adds specific functionality to C++ strings.
Definition: IString.h:181
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual void SetStandardConditions(bool standard)
Sets whether standard conditions will be used.
Definition: PhotoModel.cpp:44