3 #include "NumericalApproximation.h" 12 TopoAtm::TopoAtm(Pvl &pvl, PhotoModel &pmodel, AtmosModel &amodel) : NormModel(pvl, pmodel, amodel) {
24 PvlGroup &algorithm = pvl.findObject(
"NormalizationModel").findGroup(
"Algorithm",
Pvl::Traverse);
31 if(algorithm.hasKeyword(
"Incref")) {
35 if(algorithm.hasKeyword(
"Pharef")) {
39 p_normPharef = p_normIncref;
42 if(algorithm.hasKeyword(
"Emaref")) {
46 if(algorithm.hasKeyword(
"Albedo")) {
56 std::string msg =
"Divide by zero encountered";
60 p_normRhobar = p_normAlbedo / psurf0;
63 psurfref = GetPhotoModel()->
CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
64 pprimeref = GetPhotoModel()->
PhtTopder(p_normPharef, p_normIncref, p_normEmaref);
72 munotref = cos((
PI / 180.0) * p_normIncref);
76 GetAtmosModel()->
CalcAtmEffect(p_normPharef, p_normIncref, p_normEmaref, &pstdref, &transref,
77 &trans0ref, &sbar, &transs);
83 p_normAout = p_normRhobar * pprimeref * trans0ref;
84 p_normBout = pstdref + p_normRhobar * (transref * ahref * munotref /
85 (1.0 - p_normRhobar * GetAtmosModel()->
AtmosAb() * sbar) + trans0ref *
86 (psurfref - ahref * munotref));
94 void TopoAtm::NormModelAlgorithm(
double phase,
double incidence,
double emission,
95 double demincidence,
double dememission,
double dn,
96 double &albedo,
double &mult,
double &base) {
100 static double ahInterp;
117 static double old_phase = -9999;
118 static double old_incidence = -9999;
119 static double old_emission = -9999;
120 static double old_demincidence = -9999;
121 static double old_dememission = -9999;
123 if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
124 old_demincidence != demincidence || old_dememission != dememission) {
126 psurf = GetPhotoModel()->
CalcSurfAlbedo(phase, demincidence, dememission);
127 pprime = GetPhotoModel()->
PhtTopder(phase, demincidence, dememission);
130 munot = cos(incidence * (
PI / 180.0));
133 old_incidence = incidence;
134 old_emission = emission;
135 old_demincidence = demincidence;
136 old_dememission = dememission;
139 GetAtmosModel()->
CalcAtmEffect(phase, incidence, emission, &pstd, &trans, &trans0, &sbar,
141 pflat = pstd + p_normRhobar * (trans * ahInterp * munot /
142 (1.0 - p_normRhobar * GetAtmosModel()->
AtmosAb() * sbar) + trans0 * (psurf -
144 ptilt = pflat + p_normRhobar * pprime * trans0 * eps;
146 dpm = (psurf - ahInterp * munot) * trans0;
147 q = ahInterp * munot * trans + GetAtmosModel()->
AtmosAb() * sbar * dpo + dpm;
148 rhotlt = 2.0 * dpo / (q + sqrt(pow(q, 2.0) - 4.0 * GetAtmosModel()->AtmosAb() * sbar * dpo * dpm));
150 q = ahInterp * munot * trans + GetAtmosModel()->
AtmosAb() * sbar * dpo + dpm;
151 rhoflat = 2.0 * dpo / (q + sqrt(pow(q, 2.0) - 4.0 * GetAtmosModel()->AtmosAb() * sbar * dpo * dpm));
152 pprimeeff = (rhotlt - rhoflat) / (rhoflat * eps);
153 slope = (dn - 1.0) / pprimeeff;
154 albedo = p_normAout * slope + p_normBout;
167 if(pharef < 0.0 || pharef >= 180.0) {
168 std::string msg =
"Invalid value of normalization pharef [" +
IString(pharef) +
"]";
172 p_normPharef = pharef;
185 if(incref < 0.0 || incref >= 90.0) {
186 std::string msg =
"Invalid value of normalization incref [" +
IString(incref) +
"]";
190 p_normIncref = incref;
203 if(emaref < 0.0 || emaref >= 90.0) {
204 std::string msg =
"Invalid value of normalization emaref [" +
IString(emaref) +
"]";
208 p_normEmaref = emaref;
220 p_normAlbedo = albedo;
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
void SetNormPharef(const double pharef)
Set the normalization function parameter.
const double PI
The mathematical constant PI.
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.
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
NumericalApproximation AtmosAhSpline()
If GenerateAhTable() has been called this returns a clamped cubic spline of the data set (p_atmosIncT...
double PhtTopder(double phase, double incidence, double emission)
Obtain topographic derivative of an arbitrary photometric function.
Isotropic atmos scattering model.
#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.
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
Container for cube-like labels.
void SetNormPharef(const double pharef)
Set the normalization function parameter.
void SetNormIncref(const double incref)
Set the normalization function parameter.
As in the case without an atmosphere, processing proceeds in three steps, a pass 1 PHOTOM followed by...
void SetNormIncref(const double incref)
Set the normalization function parameter.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
double AtmosAb() const
Return atmospheric Ab value.
void GenerateAhTable()
This method computes the values of the atmospheric Ah table and sets the properties of the atmospheri...
Evaluate() attempts to extrapolate if a is outside of the domain. This is only valid for NumericalApp...
virtual void SetStandardConditions(bool standard)
Sets whether standard conditions will be used.