10#include "NumericalApproximation.h" 
   11#include "IException.h" 
   14  ShadeAtm::ShadeAtm(Pvl &pvl, PhotoModel &pmodel, AtmosModel &amodel) : NormModel(pvl, pmodel, amodel) {
 
   15    PvlGroup &algorithm = pvl.findObject(
"NormalizationModel").findGroup(
"Algorithm", Pvl::Traverse);
 
   22    if(algorithm.hasKeyword(
"Incref")) {
 
   23      SetNormIncref(algorithm[
"Incref"]);
 
   26    if(algorithm.hasKeyword(
"Pharef")) {
 
   27      SetNormPharef(algorithm[
"Pharef"]);
 
   29      p_normPharef = p_normIncref;
 
   32    if(algorithm.hasKeyword(
"Emaref")) {
 
   33      SetNormEmaref(algorithm[
"Emaref"]);
 
   36    if(algorithm.hasKeyword(
"Albedo")) {
 
   37      SetNormAlbedo(algorithm[
"Albedo"]);
 
   55  void ShadeAtm::NormModelAlgorithm(
double phase, 
double incidence, 
double emission,
 
   56                                    double demincidence, 
double dememission, 
double dn,
 
   57                                    double &albedo, 
double &mult, 
double &base) {
 
   61    static double ahInterp;
 
   69    static double old_phase = -9999;
 
   70    static double old_incidence = -9999;
 
   71    static double old_emission = -9999;
 
   72    static double old_demincidence = -9999;
 
   73    static double old_dememission = -9999;
 
   76    GetPhotoModel()->SetStandardConditions(
true);
 
   77    psurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
 
   78    GetPhotoModel()->SetStandardConditions(
false);
 
   81    GetAtmosModel()->GenerateAhTable();
 
   84      std::string msg = 
"Divide by zero error";
 
   85      throw IException(IException::Unknown, msg, _FILEINFO_);
 
   88    rho = p_normAlbedo / psurfref;
 
   90    if (old_phase != phase || old_incidence != incidence || old_emission != emission ||
 
   91        old_demincidence != demincidence || old_dememission != dememission) {
 
   93      psurf = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
 
   95      ahInterp = (GetAtmosModel()->AtmosAhSpline()).Evaluate(incidence, NumericalApproximation::Extrapolate);
 
   97      munot = cos(incidence * (PI / 180.0));
 
  100      old_incidence = incidence;
 
  101      old_emission = emission;
 
  102      old_demincidence = demincidence;
 
  103      old_dememission = dememission;
 
  106    GetAtmosModel()->CalcAtmEffect(phase, incidence, emission, &pstd, &trans, &trans0, &sbar,
 
  109    albedo = pstd + rho * (ahInterp * munot * trans /
 
  110                           (1.0 - rho * GetAtmosModel()->AtmosAb() * sbar) + (psurf - ahInterp * munot) * trans0);
 
  122  void ShadeAtm::SetNormPharef(
const double pharef) {
 
  123    if(pharef < 0.0 || pharef >= 180.0) {
 
  124      std::string msg = 
"Invalid value of normalization pharef [" +
 
  126      throw IException(IException::User, msg, _FILEINFO_);
 
  129    p_normPharef = pharef;
 
 
  141  void ShadeAtm::SetNormIncref(
const double incref) {
 
  142    if(incref < 0.0 || incref >= 90.0) {
 
  143      std::string msg = 
"Invalid value of normalization incref [" +
 
  145      throw IException(IException::User, msg, _FILEINFO_);
 
  148    p_normIncref = incref;
 
 
  160  void ShadeAtm::SetNormEmaref(
const double emaref) {
 
  161    if(emaref < 0.0 || emaref >= 90.0) {
 
  162      std::string msg = 
"Invalid value of normalization emaref [" +
 
  164      throw IException(IException::User, msg, _FILEINFO_);
 
  167    p_normEmaref = emaref;
 
 
  178  void ShadeAtm::SetNormAlbedo(
const double albedo) {
 
  179    p_normAlbedo = albedo;
 
 
Isotropic atmos scattering model.
 
Adds specific functionality to C++ strings.
 
Container for cube-like labels.
 
This is free and unencumbered software released into the public domain.