Commit 97a651c5 authored by Stuart Sides's avatar Stuart Sides
Browse files

PROG Fixed error caused by upgrade to SPICELIB 66. #Ref 4947

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7994 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9dbd8917
Loading
Loading
Loading
Loading
+46 −21
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ namespace Isis {
   */
  PvlGroup Target::radiiGroup(Pvl &cubeLab, const PvlGroup &mapGroup) {
    PvlGroup mapping = mapGroup;

    // Check to see if the mapGroup already has the target radii.
    // If BOTH radii are already in the mapGroup then just return the given
    // mapping group as is.
@@ -311,18 +312,20 @@ namespace Isis {
    catch (IException &e) {
      // If all previous attempts fail, look for the radii using the body frame
      // code in the NaifKeywords object.
      // Note: We will only look in the given label for the values after NAIF
      // Note: We will only look in the given label for the values after SPICELIB 
      // routines have failed to preserve backwards compatibility (since this
      // label check is new).
      if (cubeLab.hasObject("NaifKeywords")) {

        PvlObject naifKeywords = cubeLab.findObject("NaifKeywords");

        try {

          // Try using the value of the BODY_FRAME_CODE keyword in the NaifKeywords PVL object
          if (naifKeywords.hasKeyword("BODY_FRAME_CODE")) {

            PvlKeyword bodyFrame = naifKeywords.findKeyword("BODY_FRAME_CODE");
          QString radiiKeyword = "BODY" 
                                 + bodyFrame[0]
                                 + "_RADII";
            QString radiiKeyword = "BODY" + bodyFrame[0] + "_RADII";

            if (naifKeywords.hasKeyword(radiiKeyword)) {
              PvlKeyword radii =  naifKeywords.findKeyword(radiiKeyword);
@@ -336,6 +339,7 @@ namespace Isis {
                                  PvlContainer::Replace);
              return mapping;
            }
            // Try getting the radii using the BODY_FRAME_CODE with SPICELIB
            else {
              PvlGroup radiiGroup = Target::radiiGroup(toInt(bodyFrame[0]));
              // Now APPEND the EquatorialRadius and PolorRadius
@@ -347,6 +351,25 @@ namespace Isis {
            }
          }
        }
        catch (IException &e) {

          // Try using the BODYbodycode_RADII keyword in the NaifKeywords PVL object
          SpiceInt bodyCode = 0;
          bodyCode = lookupNaifBodyCode(target);
          QString radiiKeyword = "BODY" + toString(int(bodyCode)) + "_RADII";

          if (naifKeywords.hasKeyword(radiiKeyword)) {
            PvlKeyword radii =  naifKeywords.findKeyword(radiiKeyword);
            mapping.addKeyword( PvlKeyword("EquatorialRadius",
                                           toString(toDouble(radii[0]) * 1000.0), "meters"),
                                           PvlContainer::Replace);
            mapping.addKeyword( PvlKeyword("PolarRadius",
                                           toString(toDouble(radii[2]) * 1000.0), "meters"),
                                           PvlContainer::Replace);
            return mapping;
          }
        }
      }

      // If we get this far, we know the cube has no NaifKeywords object and previous attempts to
      // find radii in the mapping group or using spice IDs have failed
@@ -422,6 +445,8 @@ namespace Isis {
    // Load the most recent target attitude and shape kernel for NAIF
    static bool pckLoaded = false;

    NaifStatus::CheckErrors();

    FileName kern("$base/kernels/pck/pck?????.tpc");
    kern = kern.highestVersion();
    QString kernName = kern.expanded();
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ namespace Isis {
   *  @history 2016-05-18 Jeannie Backer - Removed unused lookupNaifBodyCode() method that takes no
   *                          input parameters (since it was replaced with lookupNaifBodyCode(Pvl)).
   *                          References #3934.
   *  @history 2017-08-14 Stuart Sides - Added the ability to use a target code and the
   *                          NaifKeywords to find the radii. Added so osirisrex and spicelib v66.
   *                          References #4947.
   */
  class Target {