Commit 933a7d88 authored by gsn9's avatar gsn9 Committed by jessemapel
Browse files

Assert pvl group equal (#4669)



* fixed PvlGroup comparison not failing when groups are not equal

* added my self to zenodo.json

* updated test's

* fixed test's to use EXPECT_PRED_FORMAT2 vs adding a failure to the test's

* changed test's to use correct formatting, test's are still failing

* Fixed mapping comparison and cleaned up test, mosaic still failing

* Fixed both himos and kaguyami2isis tests

* Removed extranious output from kaguyaMInir test

* Updated failing test truth data

Co-authored-by: default avatarGavin Nelson <gnelson@prog28.wr.usgs.gov>
Co-authored-by: default avataracpaquette <acp263@nau.edu>
parent 15ac2e27
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -312,6 +312,10 @@
    {
      "name": "Miller-Ribelin, Elizabeth"
    },
    {
        "affiliation": "United States Geological Survey, Astro Geology Science Center",
        "name": "Nelson, Gavin"
    },
    {
      "name": "Neubauer, Cole"
    },
+6 −5
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ find files of those names at the top level of this repository. **/
#include <QDebug>

#include "Application.h"
#include "Displacement.h"
#include "IException.h"
#include "ProcessByLine.h"
#include "Preference.h"
@@ -509,9 +510,6 @@ namespace Isis {
    Pvl fileLab(inputFile);
    PvlGroup &mapping = fileLab.findGroup("Mapping", Pvl::Traverse);

    mapping["UpperLeftCornerX"] = toString(xmin);
    mapping["UpperLeftCornerY"] = toString(ymax);

    // All mosaicking programs use only the upper left x and y to determine where to
    // place an image into a mosaic. For clarity purposes, the mosaic programs do
    // not use lat/lon ranges for anything except creating the mosaic. By specifying
@@ -541,13 +539,15 @@ namespace Isis {
    }

    Projection *firstProj = ProjectionFactory::CreateFromCube(fileLab);
    firstProj->SetUpperLeftCorner(Displacement(xmin, Displacement::Meters),
                                  Displacement(ymax, Displacement::Meters));

    int samps = (int)(ceil(firstProj->ToWorldX(xmax) - firstProj->ToWorldX(xmin)) + 0.5);
    int lines = (int)(ceil(firstProj->ToWorldY(ymin) - firstProj->ToWorldY(ymax)) + 0.5);
    delete firstProj;

    if (p_createMosaic) {
      Pvl newMap;
      newMap.addGroup(mapping);
      newMap.addGroup(firstProj->Mapping());

      // Initialize the mosaic
      CubeAttributeInput inAtt;
@@ -574,6 +574,7 @@ namespace Isis {
      ocube->putGroup(newMap.findGroup("Mapping", Pvl::Traverse));
      p.EndProcess();
    }
    delete firstProj;

    Cube *mosaicCube = new Cube();
    mosaicCube->open(mosaicFile, "rw");
+6 −6
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ Object = IsisCube
    MaximumLatitude    = -4.0
    MinimumLongitude   = 29.5
    MaximumLongitude   = 31.0
    UpperLeftCornerX   = -15195.585618718
    UpperLeftCornerY   = -121074.5047685
    UpperLeftCornerX   = -15195.585618718 <meters>
    UpperLeftCornerY   = -121074.5047685 <meters>
    PixelResolution    = 245.09009062449 <meters/pixel>
    Scale              = 123.72328210776 <pixels/degree>
  End_Group
@@ -92,8 +92,8 @@ Object = IsisCube
    MaximumLatitude    = -4.0
    MinimumLongitude   = 29.0
    MaximumLongitude   = 31.0
    UpperLeftCornerX   = -45586.756856155
    UpperLeftCornerY   = -121074.5047685
    UpperLeftCornerX   = -45586.756856155 <meters>
    UpperLeftCornerY   = -121074.5047685 <meters>
    PixelResolution    = 245.09009062449 <meters/pixel>
    Scale              = 123.72328210776 <pixels/degree>
  End_Group
@@ -607,8 +607,8 @@ Object = IsisCube
    LatitudeType       = Planetocentric
    LongitudeDirection = PositiveEast
    LongitudeDomain    = 360
    UpperLeftCornerX   = -475029.8023764
    UpperLeftCornerY   = 2042714.0507253
    UpperLeftCornerX   = -475029.8023764 <meters>
    UpperLeftCornerY   = 2042714.0507253 <meters>
    PixelResolution    = 429.50253379421 <meters/pixel>
    Scale              = 138.00779473796 <pixels/degree>
  End_Group
+33 −4
Original line number Diff line number Diff line
@@ -47,10 +47,39 @@ TEST_F(MroHiriseCube, FunctionalTestHimosDefault) {
  EXPECT_EQ(double(pixels["Base"]), 1.4996565881653);
  EXPECT_EQ(double(pixels["Multiplier"]), 4.57882446313283e-05);

  AssertPvlGroupEqual("InputMapping", "OutputMapping",
                      inputCubeLabel.findGroup("Mapping"), outputCubeLabel.findGroup("Mapping"));
  AssertPvlGroupEqual("InputMosaic", "OutputMosaic",
                      inputCubeLabel.findGroup("Mosaic"), outputCubeLabel.findGroup("Mosaic"));

  PvlGroup inputMappingGroup = inputCubeLabel.findGroup("Mapping");
  PvlGroup outputMappingGroup = outputCubeLabel.findGroup("Mapping");
  EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, inputMappingGroup, outputMappingGroup);

  std::istringstream mosaicStream(R"(
  Group = Mosaic
    ProductId                 = TRA_000823_1720_BLUEGREEN
    SourceProductId           = (TRA_000823_1720_RED4_0, TRA_000823_1720_RED4_1)
    StartTime                 = 2006-09-29T15:16:33.385
    SpacecraftClockStartCount = 844010212:12516
    StopTime                  = 2006-09-29T15:16:35.036
    SpacecraftClockStopCount  = 844010213:55196
    IncidenceAngle            = 59.687930340662 <DEG>
    EmissionAngle             = 0.091672512443932 <DEG>
    PhaseAngle                = 59.597812369363 <DEG>
    LocalTime                 = 15.486088288555 <LOCALDAY/24>
    SolarLongitude            = 113.54746578654 <DEG>
    SubSolarAzimuth           = 212.41484032558 <DEG>
    NorthAzimuth              = 270.00024569628 <DEG>
    cpmmTdiFlag               = (Null, Null, Null, Null, Null, 128, Null, Null,
                                 Null, Null, Null, Null, Null, Null)
    cpmmSummingFlag           = (Null, Null, Null, Null, Null, 1, Null, Null,
                                 Null, Null, Null, Null, Null, Null)
    SpecialProcessingFlag     = (Null, Null, Null, Null, Null, NOMINAL, Null,
                                 Null, Null, Null, Null, Null, Null, Null)
  End_Group
  )");
  PvlGroup mosaicGroupTruth;
  mosaicStream >> mosaicGroupTruth;
  PvlGroup outputMosaicGroup = outputCubeLabel.findGroup("Mosaic");
  EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, mosaicGroupTruth, outputMosaicGroup);

}

TEST_F(MroHiriseCube, FunctionalTestHimosError) {
+6 −6
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ TEST(kaguyatc2isisTest, FunctionalTestKaguyami2isisVis) {
  )");
  PvlGroup bandBinTruth;
  bandBinStream >> bandBinTruth;
  AssertPvlGroupEqual("resultingBandBin", "truthBandBin", bandBin, bandBinTruth);
  EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, bandBin, bandBinTruth);

  // Kernels Group
  PvlGroup &kern = isisLabel->findGroup("Kernels", Pvl::Traverse);
@@ -150,15 +150,15 @@ TEST(kaguyatc2isisTest, FunctionalTestKaguyami2isisNir) {
  PvlGroup &bandBin = isisLabel->findGroup("BandBin", Pvl::Traverse);
  std::istringstream bandBinStream(R"(
  Group = BandBin
    FilterName = (MV1, MV2, MV3, MV4, MV5)
    Center     = (414.0, 749.0, 901.0, 950.0, 1001.0) <nm>
    Width      = (20.0, 12.0, 21.0, 30.0, 42.0) <nm>
    BaseBand   = MV5
    FilterName = (MN1, MN2, MN3, MN4)
    Center     = (1000.0, 1049.0, 1248.0, 1548.0) <nm>
    Width      = (27.0, 28.0, 33.0, 48.0) <nm>
    BaseBand   = MN1
  End_Group
  )");
  PvlGroup bandBinTruth;
  bandBinStream >> bandBinTruth;
  AssertPvlGroupEqual("resultingBandBin", "truthBandBin", bandBin, bandBinTruth);
  EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, bandBin, bandBinTruth);

  // Kernels Group
  PvlGroup &kern = isisLabel->findGroup("Kernels", Pvl::Traverse);
Loading