Unverified Commit aeeca9f4 authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by GitHub
Browse files

Allows user to use the web service and specify a shape model with spiceinit (#4216)

* Allowed web=true and model=user

* Added changelog entry

* Addressed comments
parent 15fe9731
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ update the Unreleased link so that it compares against the latest release tag.

- Added documentation to lronaccal and lrowaccal to describe why there are negative DNs in I/F calibrated images. [#3860](https://github.com/USGS-Astrogeology/ISIS3/issues/3860)
- Update qview MeasureTool to add an option to calculate distances using RA/DEC and update qview to show DEC/RA rather than LAT/LON in lower-right corner [#3371](https://github.com/USGS-Astrogeology/ISIS3/issues/3371)

- Updated spiceinit so that a user can specify a shape model and use the spice web service without any errors. [#1986](https://github.com/USGS-Astrogeology/ISIS3/issues/1986) 
### Fixed

- Fixed lrowaccal so required SPICE files are reported instead of continuing without them. [#4038](https://github.com/USGS-Astrogeology/ISIS3/issues/4038)
+8 −8
Original line number Diff line number Diff line
@@ -612,11 +612,7 @@ namespace Isis {
    QString shape     = QString(ui.GetString("SHAPE")).toLower();

    if (shape == "user") {
      shape = QString(ui.GetAsString("MODEL"));

      // Test for valid labels with mapping group at least
      Pvl shapeTest(shape);
      shapeTest.findGroup("Mapping", Pvl::Traverse);
      shape = "ellipsoid";
    }

    double startPad = ui.GetDouble("STARTPAD");
@@ -637,7 +633,6 @@ namespace Isis {
    connectionProgress.CheckStatus();

    PvlGroup kernelsGroup = client.kernelsGroup();
    PvlGroup logGrp = client.applicationLog();
    PvlObject naifKeywords = client.naifKeywordsObject();
    Table *pointingTable = client.pointingTable();
    Table *positionTable = client.positionTable();
@@ -663,11 +658,16 @@ namespace Isis {
      }
    }
    
    if (log) {
      log->addGroup(logGrp);
    if (ui.GetString("SHAPE") == "USER") {
      kernelsGroup["ShapeModel"] = ui.GetFileName("MODEL");
    }

    icube->putGroup(kernelsGroup);

    if (log) {
      log->addGroup(kernelsGroup);
    }

    icube->label()->addObject(naifKeywords);

    icube->write(*pointingTable);
+4 −0
Original line number Diff line number Diff line
@@ -295,6 +295,10 @@
      derived from bundle adjustment can be used alongside CKs derived from bundle adjustment.
      Fixes #3669.
    </change>
    <change name="Kaitlyn Lee" date="2020-12-21">
      Updated shape model keyword in the kernels group when shape=user and web=true with the user
      specified model. Fixes #1986
    </change>
  </history>

  <oldName>
+106 −0
Original line number Diff line number Diff line
@@ -518,3 +518,109 @@ TEST(Spiceinit, TestSpiceinitPadding) {
  EXPECT_PRED_FORMAT2(AssertQStringsEqual, kernels["EndPadding"][0], "0.5");
  EXPECT_PRED_FORMAT2(AssertQStringsEqual, kernels["EndPadding"].unit(0), "seconds");
}

TEST_F(DemCube, FunctionalTestSpiceinitWebAndShapeModel) {

  std::istringstream labelStrm(R"(
    Object = IsisCube
      Object = Core
        StartByte   = 65537
        Format      = Tile
        TileSamples = 128
        TileLines   = 128

        Group = Dimensions
          Samples = 1204
          Lines   = 1056
          Bands   = 1
        End_Group

        Group = Pixels
          Type       = UnsignedByte
          ByteOrder  = Lsb
          Base       = 0.0
          Multiplier = 1.0
        End_Group
      End_Object

      Group = Instrument
        SpacecraftName       = VIKING_ORBITER_1
        InstrumentId         = VISUAL_IMAGING_SUBSYSTEM_CAMERA_B
        TargetName           = MARS
        StartTime            = 1977-07-09T20:05:51
        ExposureDuration     = 0.008480 <seconds>
        SpacecraftClockCount = 33322515
        FloodModeId          = ON
        GainModeId           = HIGH
        OffsetModeId         = ON
      End_Group

      Group = Archive
        DataSetId       = VO1/VO2-M-VIS-2-EDR-V2.0
        ProductId       = 387A06
        MissonPhaseName = EXTENDED_MISSION
        ImageNumber     = 33322515
        OrbitNumber     = 387
      End_Group

      Group = BandBin
        FilterName = CLEAR
        FilterId   = 4
      End_Group

      Group = Kernels
        NaifFrameCode = -27002
      End_Group

      Group = Reseaus
        Line     = (5, 6, 8, 9, 10, 11, 12, 13, 14, 14, 15, 133, 134, 135, 137,
                    138, 139, 140, 141, 141, 142, 143, 144, 263, 264, 266, 267,
                    268, 269, 269, 270, 271, 272, 273, 393, 393, 395, 396, 397,
                    398, 399, 399, 400, 401, 402, 403, 523, 524, 525, 526, 527,
                    527, 528, 529, 530, 530, 532, 652, 652, 654, 655, 656, 657,
                    657, 658, 659, 660, 661, 662, 781, 783, 784, 785, 786, 787,
                    788, 788, 789, 790, 791, 911, 912, 913, 914, 915, 916, 917,
                    918, 918, 919, 920, 921, 1040, 1041, 1043, 1044, 1045, 1045,
                    1046, 1047, 1047, 1048, 1050)
        Sample   = (24, 142, 259, 375, 491, 607, 723, 839, 954, 1070, 1185, 24,
                    84, 201, 317, 433, 549, 665, 780, 896, 1011, 1127, 1183, 25,
                    142, 259, 375, 492, 607, 722, 838, 953, 1068, 1183, 25, 84,
                    201, 317, 433, 549, 665, 779, 895, 1010, 1125, 1182, 25, 143,
                    259, 375, 491, 607, 722, 837, 952, 1067, 1182, 25, 84, 201,
                    317, 433, 548, 664, 779, 894, 1009, 1124, 1181, 25, 142, 258,
                    374, 490, 605, 720, 835, 951, 1066, 1180, 24, 83, 200, 316,
                    431, 547, 662, 776, 892, 1007, 1122, 1179, 23, 140, 257, 373,
                    488, 603, 718, 833, 948, 1063, 1179)
        Type     = (1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                    5, 6, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 5, 5, 5,
                    5, 5, 5, 6, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 5,
                    5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5,
                    5, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6)
        Valid    = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        Template = $viking1/reseaus/vo1.visb.template.cub
        Status   = Nominal
      End_Group
    End_Object
  End
  )");

  Pvl label;
  labelStrm >> label;

  QTemporaryFile tempFile;
  tempFile.open();
  Cube testCube;

  testCube.fromLabel(tempFile.fileName() + ".cub", label, "rw");

  QVector<QString> args = {"web=true", "shape=user", "model=" + demCube->fileName()};
  UserInterface options(APP_XML, args);
  spiceinit(&testCube, options);

  PvlGroup kernels = testCube.label()->findGroup("Kernels", Pvl::Traverse);
  EXPECT_PRED_FORMAT2(AssertQStringsEqual, kernels.findKeyword("ShapeModel"), demCube->fileName());
}