3 #include "NumericalApproximation.h"
7 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
8 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
40 p_normPharef = p_normIncref;
50 p_normPsurfref = GetPhotoModel()->
CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
58 p_normMunotref = cos((
PI / 180.0) * p_normIncref);
62 GetAtmosModel()->
CalcAtmEffect(p_normPharef, p_normIncref, p_normEmaref,
63 &p_normPstdref, &p_normTransref,
64 &p_normTrans0ref, &p_normSbar,
82 void AlbedoAtm::NormModelAlgorithm(
double phase,
double incidence,
double emission,
83 double demincidence,
double dememission,
double dn,
84 double &albedo,
double &mult,
double &base) {
86 static double ahInterp;
102 static double old_phase = -9999;
103 static double old_incidence = -9999;
104 static double old_emission = -9999;
105 static double old_demincidence = -9999;
106 static double old_dememission = -9999;
108 if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
109 old_demincidence != demincidence || old_dememission != dememission) {
116 munot = cos(incidence * (
PI / 180.0));
119 old_incidence = incidence;
120 old_emission = emission;
121 old_demincidence = demincidence;
122 old_dememission = dememission;
125 GetAtmosModel()->
CalcAtmEffect(phase, incidence, emission, &pstd, &trans, &trans0, &p_normSbar,
130 dpm = (psurf - ahInterp * munot) * trans0;
131 q = ahInterp * munot * trans + GetAtmosModel()->
AtmosAb() * p_normSbar * dpo + dpm;
133 if(dpo <= 0.0 && GetAtmosModel()->AtmosNulneg()) {
137 firsterm = GetAtmosModel()->
AtmosAb() * p_normSbar;
138 secondterm = dpo * dpm;
139 thirdterm = firsterm * secondterm;
140 fourthterm = pow(q, 2.0) - 4.0 * thirdterm;
142 if(fourthterm < 0.0) {
143 QString msg =
"Square root of negative (math) encountered";
147 fifthterm = q + sqrt(fourthterm);
150 rho = 2 * dpo / fifthterm;
154 if((1.0 - rho * GetAtmosModel()->AtmosAb()*p_normSbar) <= 0.0) {
155 QString msg =
"Divide by zero (math) encountered";
159 albedo = p_normPstdref + rho * (p_normAhref * p_normMunotref *
160 p_normTransref / (1.0 - rho * GetAtmosModel()->
AtmosAb() *
161 p_normSbar) + (p_normPsurfref - p_normAhref *
162 p_normMunotref) * p_normTrans0ref);
176 if(pharef < 0.0 || pharef >= 180.0) {
177 QString msg =
"Invalid value of normalization pharef [" +
182 p_normPharef = pharef;
195 if(incref < 0.0 || incref >= 90.0) {
196 QString msg =
"Invalid value of normalization incref [" +
201 p_normIncref = incref;
214 if(emaref < 0.0 || emaref >= 90.0) {
215 QString msg =
"Invalid value of normalization emaref [" +
220 p_normEmaref = emaref;
double AtmosAb() const
Return atmospheric Ab value.
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
void SetNormPharef(const double pharef)
Set parameters needed for albedo normalization.
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
virtual void SetStandardConditions(bool standard)
Used to calculate atmosphere at standard conditions.
void CalcAtmEffect(double pha, double inc, double ema, double *pstd, double *trans, double *trans0, double *sbar, double *transs)
Calculate the atmospheric scattering effect using photometric angle information.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
const double PI(3.14159265358979323846)
The mathematical constant PI.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void SetNormIncref(const double incref)
Set the normalization function parameter.
NumericalApproximation AtmosAhSpline()
If GenerateAhTable() has been called this returns a clamped cubic spline of the data set (p_atmosIncT...
AlbedoAtm(Pvl &pvl, PhotoModel &pmodel, AtmosModel &amodel)
Constructs AlbedoAtm object using a Pvl, PhotoModel, and AtmosModel.
Isotropic atmos scattering model.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A type of error that cannot be classified as any of the other error types.
Container for cube-like labels.
void GenerateAhTable()
This method computes the values of the atmospheric Ah table and sets the properties of the atmospheri...
Albedo normalization with atmosphere.
Evaluate() attempts to extrapolate if a is outside of the domain. < This is only valid for NumericalA...
virtual void SetStandardConditions(bool standard)
Sets whether standard conditions will be used.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.