Unverified Commit fa759849 authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Merge pull request #80 from AgoinsUSGS/CubeDifferences

Modified tgocassisstitch to include the Archive group for ingested framelets. Fixes #5333.
parents 3c6c554f d2e9e530
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ QMap<QString, FileName> sortFramelets(FileName frameletListFile) {
 *
 * @param frameletList A list of the framelet cubes to stitch together
 * @param frameFileName The file name of the output frame cube
 *
 * @internal
 *   @history 2018-02-15 Adam Goins - Modified stitchFrame to store the Archive
 *                           group for ingested framelets. Fixes #5333.
 */
void stitchFrame(QList<FileName> frameletList, FileName frameFileName) {
  // Create the frame cube based on the first framelet cube
@@ -130,22 +134,13 @@ void stitchFrame(QList<FileName> frameletList, FileName frameFileName) {
  frameCube.create( frameFileName.expanded() );

  // Setup the label for the new cube
  PvlGroup archGroup = firstFrameletCube.group("Archive");
  PvlGroup kernGroup = firstFrameletCube.group("Kernels");
  PvlGroup instGroup = firstFrameletCube.group("Instrument");
  PvlGroup bandBinGroup("BandBin");
  if ( instGroup.hasKeyword("Filter") ) {
    instGroup["Filter"].setValue("FULLCCD");
  }
  if ( archGroup.hasKeyword("ProductId") ) {
    archGroup.deleteKeyword("ProductId");
  }
  if ( archGroup.hasKeyword("FileName") ) {
    archGroup.deleteKeyword("FileName");
  }
  if ( archGroup.hasKeyword("Window_Count") ) {
    archGroup.deleteKeyword("Window_Count");
  }

  bandBinGroup += PvlKeyword("FilterName", "FULLCCD");

  // Setup Stitch group keywords
@@ -203,6 +198,10 @@ void stitchFrame(QList<FileName> frameletList, FileName frameFileName) {
    stitchGroup["FilterWidths"]    += frameletBandBin["Width"];
    stitchGroup["FilterIkCodes"]   += frameletBandBin["NaifIkCode"];

    PvlGroup archiveGroup = frameletCube->group("Archive");
    archiveGroup.setName("Archive" + QString(frameletBandBin["FilterName"]));
    frameCube.putGroup(archiveGroup);

    AlphaCube frameletAlphaCube(*frameletCube);
    stitchGroup["FilterStartSamples"] += toString(frameletAlphaCube.AlphaSample(0.0));
    stitchGroup["FilterSamples"]      += toString(frameletAlphaCube.BetaSamples());
@@ -226,7 +225,6 @@ void stitchFrame(QList<FileName> frameletList, FileName frameFileName) {
  // Finalize the frame cube label
  frameCube.putGroup(instGroup);
  frameCube.putGroup(kernGroup);
  frameCube.putGroup(archGroup);
  frameCube.putGroup(bandBinGroup);
  frameCube.putGroup(stitchGroup);
}
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
      Backward Compatibility Issue: Changed name from stitch to tgocassisstitch and
      changed output parameter name "TO" to "OUTPUTPREFIX."
    </change>
    <change name="Adam Goins" date="2018-02-15">
      Modified stitchFrame to store the Archive group for ingested framelets. Fixes #5333.
    </change>
  </history>

  <category>
+19 −2
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ using namespace Isis;
 *
 * @internal
 *   @history 2017-09-15 Kristin Berry - Original Version
 *
 *   @history 2018-02-15 Adam Goins - Modified unstitch to parse the archive group
 *                           from the stitched frame. Changed "Name" to "FilterName"
 *                           in bandBin group.
 */
struct FilterInfo : public PushFrameCameraCcdLayout::FrameletInfo {
  FilterInfo() : FrameletInfo(), m_wavelength(0), m_width(0) { }
@@ -152,16 +156,29 @@ void IsisMain() {
  for (int i = 0; i < g_outputCubes.size(); i++) {
    progress.CheckStatus();
    for (int j = 0; j < inputLabel->findObject("IsisCube").groups(); j++) {
      g_outputCubes[i]->putGroup(inputLabel->findObject("IsisCube").group(j));
      PvlGroup group = inputLabel->findObject("IsisCube").group(j);

      // The stitched frame has ArchiveRED, ArchiveNIR, ArchivePAN, and ArchiveBLU.
      // We won't add the archive group unless
      if ( group.name().contains("Archive") &&
           group.name() != "Archive" + g_frameletInfoList[i].m_filterName ) {
             continue;
           }

      g_outputCubes[i]->putGroup(group);

    }
    // Update the labels
    Pvl *frameletLabel = g_outputCubes[i]->label();
    frameletLabel->findGroup("Instrument", PvlObject::Traverse).addKeyword(PvlKeyword("Filter",
                                          g_frameletInfoList[i].m_filterName), PvlObject::Replace);

    // Sets the name from ArchiveRED (or NIR, BLU, PAN) to just "Archive" in the unstitched cube.
    frameletLabel->findGroup("Archive" + g_frameletInfoList[i].m_filterName, PvlObject::Traverse).setName("Archive");

    PvlGroup &bandBin = frameletLabel->findGroup("BandBin", PvlObject::Traverse);

    bandBin.addKeyword(PvlKeyword("Name", g_frameletInfoList[i].m_filterName),
    bandBin.addKeyword(PvlKeyword("FilterName", g_frameletInfoList[i].m_filterName),
                                                PvlObject::Replace);
    bandBin.addKeyword(PvlKeyword("Center", toString(g_frameletInfoList[i].m_wavelength)));
    bandBin.addKeyword(PvlKeyword("Width", toString(g_frameletInfoList[i].m_width)));
+12 −10
Original line number Diff line number Diff line
@@ -23,11 +23,13 @@
      but containing other '.'s  in the string to not strip off everything after the last period. For example, if the
      user inputs CAS-MCO-2016-11-22T16:10:43.505 as the OUTPUTPREFIX, now the 505 will now be retained.
    </change>
    
    <change name="Adam Goins" date="2018-02-15">
      Updated the application to include the sample offsets when processing lines from the stitched
      frame into output cubes.
    </change>
    <change name="Adam Goins" date="2018-02-15">
     Modified unstitchFrame to parse the Archive group for each framelet.
   </change>

  </history>

+4 −4
Original line number Diff line number Diff line
@@ -4,10 +4,10 @@ include $(ISISROOT)/make/isismake.tsts

commands:
        # Test output prefix with standard extension (will be removed)
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-22T16:10:43.505.cub \
	           outputprefix=$(OUTPUT)/CAS-MCO_2016-11-22T16:10:43.505.cub > /dev/null;
	mv $(OUTPUT)/CAS-MCO_2016-11-22T16:10:43.505.lis \
	   $(OUTPUT)/CAS-MCO_2016-11-22T16:10:43.505.txt;
	$(APPNAME) from=$(INPUT)/stitched-2016-11-26T22:50:27.381.cub \
	           outputprefix=$(OUTPUT)/stitched-2016-11-26T22:50:27.381.cub > /dev/null;
	mv $(OUTPUT)/stitched-2016-11-26T22:50:27.381.lis \
	   $(OUTPUT)/stitched-2016-11-26T22:50:27.381.txt;


Loading