Esempio n. 1
0
  Mixed::Mixed (Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl,pmodel) {
    PvlGroup &algorithm = pvl.FindObject("NormalizationModel").FindGroup("Algorithm",Pvl::Traverse);

    // Set default value
    SetNormIncref(0.0);
    SetNormIncmat(0.0);
    SetNormThresh(30.0);
    SetNormAlbedo(1.0);

    // Get value from user
    if (algorithm.HasKeyword("Incref")) {
      SetNormIncref(algorithm["Incref"]);
    }
    if (algorithm.HasKeyword("Incmat")) {
      SetNormIncmat(algorithm["Incmat"]);
    }

    if (algorithm.HasKeyword("Thresh")) {
      SetNormThresh(algorithm["Thresh"]);
    }

    if (algorithm.HasKeyword("Albedo")) {
      SetNormAlbedo(algorithm["Albedo"]);
    }

    // First-time setup
    // Calculate normalization at standard conditions
    // Turn off Hapke opposition effect
    GetPhotoModel()->SetStandardConditions(true);
    p_psurfref = GetPhotoModel()->CalcSurfAlbedo(0.0, p_normIncref, 0.0);
    double pprimeref = GetPhotoModel()->PhtTopder(0.0, p_normIncref, 0.0);

    if (p_psurfref == 0.0) {
      std::string err = "Divide by zero error";
      throw iException::Message(iException::Math, err, _FILEINFO_);
    }
    else {
      p_rhobar = p_normAlbedo / p_psurfref;
    }

    // Calculate brightness and topo derivative at matchpoint incidence
    p_psurfmatch = GetPhotoModel()->CalcSurfAlbedo(p_normIncmat, p_normIncmat, 0.0);
    p_pprimematch = GetPhotoModel()->PhtTopder(p_normIncmat, p_normIncmat, 0.0);

    // Calculate numerator of the stretch coeff. a; if it is very
    // large or small we haven't chosen a good reference state
    double arg = pow(p_psurfref,2.0) + pow(p_psurfmatch*pprimeref / std::max(1.0e-30,p_pprimematch),2.0);
    if ((arg < 1.0e-10) || (arg > 1.0e10)) {
      std::string err = "Bad reference state encountered";
      throw iException::Message(iException::Math, err, _FILEINFO_);
    }

    p_anum = sqrt(arg);
    GetPhotoModel()->SetStandardConditions(false);
  }
Esempio n. 2
0
  Albedo::Albedo(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
    PvlGroup &algorithm = pvl.findObject("NormalizationModel").findGroup("Algorithm", Pvl::Traverse);

    SetNormPharef(0.0);
    SetNormIncref(0.0);
    SetNormEmaref(0.0);
    SetNormIncmat(0.0);
    SetNormThresh(30.0);
    SetNormAlbedo(1.0);

    // Get value from user
    if(algorithm.hasKeyword("Incref")) {
      SetNormIncref(algorithm["Incref"]);
    }

    if(algorithm.hasKeyword("Pharef")) {
      SetNormPharef(algorithm["Pharef"]);
    } else {
      p_normPharef = p_normIncref;
    }

    if(algorithm.hasKeyword("Emaref")) {
      SetNormEmaref(algorithm["Emaref"]);
    }

    if(algorithm.hasKeyword("Incmat")) {
      SetNormIncmat(algorithm["Incmat"]);
    }

    if(algorithm.hasKeyword("Thresh")) {
      SetNormThresh(algorithm["Thresh"]);
    }

    if(algorithm.hasKeyword("Albedo")) {
      SetNormAlbedo(algorithm["Albedo"]);
    }

    // Calculate normalization at standard conditions.
    GetPhotoModel()->SetStandardConditions(true);
    p_normPsurfref = GetPhotoModel()->CalcSurfAlbedo(p_normPharef, p_normIncref, p_normEmaref);
    GetPhotoModel()->SetStandardConditions(false);
  }