Commit 93eb506b authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

Modified test to remove ISIS version and modification_date. rdrgen checks if...

Modified test to remove ISIS version and modification_date. rdrgen checks if the Mosaic group exists.
parent f306a3a6
Loading
Loading
Loading
Loading
+12 −36
Original line number Diff line number Diff line
@@ -33,16 +33,17 @@ void IsisMain() {

  PvlObject *label= icube->label();

  PvlKeyword instrument;
  bool isMosaic;
  try {
  PvlKeyword instrument;
  if ( label->findObject("IsisCube").hasGroup("Instrument") ) {
    instrument = label->findObject("IsisCube").findGroup("Instrument").findKeyword("InstrumentId");
    isMosaic = false;
  }
  catch (IException e) {
  else if ( label->findObject("IsisCube").hasGroup("Mosaic") ) {
    instrument = label->findObject("IsisCube").findGroup("Mosaic").findKeyword("InstrumentId");
    isMosaic = true;
  }

  // Check if the cube is able to be translated into a CaSSIS xml file
  // This could very well be unnecessary
  if (!instrument.isEquivalent("CaSSIS")) {
@@ -56,42 +57,17 @@ void IsisMain() {
  // by the user, set it to the Observation Id.
  // This is added before the translation instead of adding it to the exported xml
  // because of the ease of editing pvl vs xml.

  // PvlGroup mainGroup;
  if (!isMosaic) {
    PvlGroup &mainGroup = label->findObject("IsisCube").findGroup("Instrument");
  PvlGroup &instrumentGroup = label->findObject("IsisCube").findGroup("Instrument");
  PvlKeyword productId = PvlKeyword("ProductId");
  if ( ui.WasEntered("PRODUCTID") ) {
    productId.setValue( ui.GetString("PRODUCTID") );
    instrumentGroup.addKeyword(productId);
  }
  else {
      QString observationId = mainGroup.findKeyword("ObservationId")[0];
    QString observationId = instrumentGroup.findKeyword("ObservationId")[0];
    productId.setValue(observationId);
  }
    mainGroup.addKeyword(productId);
  }
  else {
    PvlGroup &mainGroup = label->findObject("IsisCube").findGroup("Mosaic");
    PvlKeyword productId = PvlKeyword("ProductId");
    if ( ui.WasEntered("PRODUCTID") ) {
      productId.setValue( ui.GetString("PRODUCTID") );
    }
    else {
      QString observationId = mainGroup.findKeyword("ObservationId")[0];
      productId.setValue(observationId);
    }
    mainGroup.addKeyword(productId);
  }

  // PvlKeyword productId = PvlKeyword("ProductId");
  // if ( ui.WasEntered("PRODUCTID") ) {
  //   productId.setValue( ui.GetString("PRODUCTID") );
  // }
  // else {
  //   QString observationId = mainGroup.findKeyword("ObservationId")[0];
  //   productId.setValue(observationId);
  // }
  // mainGroup.addKeyword(productId);
  instrumentGroup.addKeyword(productId);

  /*
  * Add additional pds label data here
+27 −17
Original line number Diff line number Diff line
# Verify that we can export a non-projected and non-mosaiked cube as a TGO CaSSIS image.
# Test that we can override the product id with the PRODUCTID parameter.
#
# history 2018-05-18 Kaitlyn Lee - Changed input cube with an one that has the
# 				ObservationId. Added the removal of the modification_date and ISIS version.
# 				Added testing for PRODUCTID parameter.

APPNAME = tgocassisrdrgen

include $(ISISROOT)/make/isismake.tsts
@@ -7,16 +14,13 @@ commands:
	           to=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.img \
		   > /dev/null;
			 
	# Reingest the PDS4 data
	tgocassis2isis from=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xml \
	# Reingest output and make sure the cubes are the same
	raw2isis from=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.img \
					 to=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
		 > /dev/null;

	# Compare the output cube from raw2isis to the original input cube to
	# ensure that they are identical
	cubediff from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
	         from2=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
	         to=$(OUTPUT)/cubediffresults.txt \
					 SAMPLES=2048 \
					 LINES=252 \
					 BITTYPE=REAL \
					 BYTEORDER=LSB \
		 > /dev/null;

	$(SED) 's+\Product_Observational.*>+\Product_Observational>+' \
@@ -28,15 +32,18 @@ commands:
	$(SED) 's+\PEHK_HEADER.*>+\PEHK_HEADER>+' \
	       $(OUTPUT)/templabel2.txt \
	       > $(OUTPUT)/templabel3.txt;
	$(SED) 's+\Modification_Detail.*>+\Modification_Detail>+' \
	$(SED) 's+\modification_date.*>+\modification_date>+' \
	       $(OUTPUT)/templabel3.txt \
	       > $(OUTPUT)/templabel4.txt
	$(SED) 's+\ISIS version.*<+\ISIS version.<+' \
	       $(OUTPUT)/templabel4.txt \
	       > $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xmlLabel.txt;


	$(RM) $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xml \
	      $(OUTPUT)/templabel1.txt \
	      $(OUTPUT)/templabel2.txt \
	      $(OUTPUT)/templabel3.txt;
	      $(OUTPUT)/templabel3.txt \
				$(OUTPUT)/templabel4.txt;

	# Test PRODUCTID parameter with same input
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
@@ -53,12 +60,15 @@ commands:
	$(SED) 's+\PEHK_HEADER.*>+\PEHK_HEADER>+' \
	       $(OUTPUT)/templabel2.txt \
	       > $(OUTPUT)/templabel3.txt;
	$(SED) 's+\Modification_Detail.*>+\Modification_Detail>+' \
	$(SED) 's+\modification_date.*>+\modification_date>+' \
	       $(OUTPUT)/templabel3.txt \
	       > $(OUTPUT)/templabel4.txt
	$(SED) 's+\ISIS version.*<+\ISIS version.<+' \
	       $(OUTPUT)/templabel4.txt \
	       > $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1_modifiedId.xmlLabel.txt;


	$(RM) $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1_modifiedId.xml \
	      $(OUTPUT)/templabel1.txt \
	      $(OUTPUT)/templabel2.txt \
	      $(OUTPUT)/templabel3.txt;
	      $(OUTPUT)/templabel3.txt \
				$(OUTPUT)/templabel4.txt;