Unverified Commit fb6caded authored by AgoinsUSGS's avatar AgoinsUSGS Committed by GitHub
Browse files

Merge pull request #176 from kdl222/rdrgenProductId

Added PRODUCTID parameter to tgocassisrdrgen to allow users to update the product id
parents e2c8e6ed 9894c76d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ void IsisMain() {


    PvlGroup mos("Mosaic");
    mos += PvlKeyword("ProductId ", ProdId);
    mos += PvlKeyword("ObservationId ", ProdId);
    mos += PvlKeyword("SpacecraftName", spacecraftName);
    mos += PvlKeyword("InstrumentId", instrumentId);
//     mos += PvlKeyword(sourceProductId);
+20 −3
Original line number Diff line number Diff line
@@ -43,6 +43,23 @@ void IsisMain() {
    throw  IException(IException::User, msg, _FILEINFO_);
  }

  // Add the ProductId keyword for translation. If a product id is not specified
  // 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 &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 = instrumentGroup.findKeyword("ObservationId")[0];
    productId.setValue(observationId);
  }
  instrumentGroup.addKeyword(productId);

  /*
  * Add additional pds label data here
  */
+19 −1
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@
    <change name="Marjorie Hahn" date="2017-06-08">
      Moved code to write out .img and .xml PDS4 data to WritePds4 in ProcessExportPds4.
    </change>
    <change name="Kaitlyn Lee" date="2018-05-16">
      Added parameter PRODUCTID to set the ProductId keyword. If the product id is
      not specified by the user, set the ProductId keyword to the observation id.
    </change>
  </history>

  <category>
@@ -65,5 +69,19 @@
        <filter>*.img</filter>
      </parameter>
    </group>

    <group name="Keywords">
      <parameter name="PRODUCTID">
        <type>string</type>
        <internalDefault>None</internalDefault>
        <brief>
          Poduct ID value
        </brief>
        <description>
          Update the default Product ID value.
        </description>
      </parameter>
    </group>

  </groups>
</application>
+35 −14
Original line number Diff line number Diff line
@@ -3,28 +3,24 @@ APPNAME = tgocassisrdrgen
include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.cub \
	           to=$(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.img \
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
	           to=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.img \
		   > /dev/null;

	# Reingest the PDS4 data
	raw2isis from=$(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.img \
	         to=$(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.cub \
	         SAMPLES=2048 \
	         LINES=254 \
	         BITTYPE=REAL \
	         BYTEORDER=LSB \
	tgocassis2isis from=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xml \
	         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-26T22.32.39.582-BLU-03025-00.cub \
	         from2=$(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.cub \
	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 \
		 > /dev/null;

	$(SED) 's+\Product_Observational.*>+\Product_Observational>+' \
	       $(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.xml \
	       $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xml \
	       > $(OUTPUT)/templabel1.txt;
	$(SED) 's+\FSW_HEADER.*>+\FSW_HEADER>+' \
	       $(OUTPUT)/templabel1.txt \
@@ -34,10 +30,35 @@ commands:
	       > $(OUTPUT)/templabel3.txt;
	$(SED) 's+\Modification_Detail.*>+\Modification_Detail>+' \
	       $(OUTPUT)/templabel3.txt \
	       > $(OUTPUT)/CAS-MCO-2016-11-26T22.32.39.582-BLU-03025-00.xmlLabel.txt;
	       > $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.xmlLabel.txt;


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

	# Test PRODUCTID parameter with same input
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
	           to=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1_modifiedId.img \
						 PRODUCTID=placeholderId \
		   > /dev/null;

	$(SED) 's+\Product_Observational.*>+\Product_Observational>+' \
	       $(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1_modifiedId.xml \
	       > $(OUTPUT)/templabel1.txt;
	$(SED) 's+\FSW_HEADER.*>+\FSW_HEADER>+' \
	       $(OUTPUT)/templabel1.txt \
	       > $(OUTPUT)/templabel2.txt;
	$(SED) 's+\PEHK_HEADER.*>+\PEHK_HEADER>+' \
	       $(OUTPUT)/templabel2.txt \
	       > $(OUTPUT)/templabel3.txt;
	$(SED) 's+\Modification_Detail.*>+\Modification_Detail>+' \
	       $(OUTPUT)/templabel3.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;