Unverified Commit 40ef1fba authored by Kristin's avatar Kristin Committed by GitHub
Browse files

Merge pull request #86 from SgStapleton/tgoExt

Modified tgocassis2issis to accept .img datafile extensions.
parents 3272598d 435e5657
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -27,10 +27,20 @@ void IsisMain() {
  try {
  try {
    ProcessImport importer;
    ProcessImport importer;
    translateCoreInfo(xmlFileName, importer);
    translateCoreInfo(xmlFileName, importer);
    // fails 
    
    if(xmlFileName.removeExtension().addExtension("dat").fileExists()){
      importer.SetInputFile(xmlFileName.removeExtension().addExtension("dat").expanded());
      importer.SetInputFile(xmlFileName.removeExtension().addExtension("dat").expanded());
    } 
    else if (xmlFileName.removeExtension().addExtension("img").fileExists()) {
      importer.SetInputFile(xmlFileName.removeExtension().addExtension("img").expanded());
    }
    else {
      QString msg = "Cannot find image file for [" + xmlFileName.name() + "]. Confirm that the "
        ".dat or .img file for this XML exists and is located in the same directory.";
      throw IException(IException::User, msg, _FILEINFO_);
    }
    
    Cube *outputCube = importer.SetOutputCube("TO");
    Cube *outputCube = importer.SetOutputCube("TO");
    // fails above
    translateLabels(xmlFileName, outputCube);
    translateLabels(xmlFileName, outputCube);


    FileName outputCubeFileName(ui.GetFileName("TO"));
    FileName outputCubeFileName(ui.GetFileName("TO"));
+3 −0
Original line number Original line Diff line number Diff line
@@ -106,6 +106,9 @@
    <change name="Jeannie Backer" date="2017-09-05">
    <change name="Jeannie Backer" date="2017-09-05">
      Added check to verify input input xml file corresponds to valid filter image. 
      Added check to verify input input xml file corresponds to valid filter image. 
    </change>
    </change>
    <change name="Summer Stapleton" date="2018-02-16">
      Added handling for image file extesnions of either .dat or .img. Fixs #5334. 
    </change>
  </history>
  </history>


  <category>
  <category>
+40 −0
Original line number Original line Diff line number Diff line
# Test the handling of data file extensions
#
# @history 2018-02-24 Summer Stapleton - Original version
#
# NOTE On re-import of data from tgocassisrdrgen, data files will have a .img extension as
#	opposed to a .dat

APPNAME = tgocassis2isis

include $(ISISROOT)/make/isismake.tsts

commands:
# TEST This tests the .dat file extension
	$(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-PAN-00000-B1.xml \
		to=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-PAN-00000-B1.cub > /dev/null;
	
	catlab from=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-PAN-00000-B1.cub \
		to=$(OUTPUT)/datLabels.pvl > /dev/null;
	
	
# TEST This tests the .img file extension
	$(APPNAME) from=$(INPUT)/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;
	
	catlab from=$(OUTPUT)/CAS-MCO-2016-11-22T15.45.50.984-BLU-03000-B1.cub \
		to=$(OUTPUT)/imgLabels.pvl > /dev/null;
	
	
# TEST This tests for the nonexistance of a .dat or .img file for a given .xml
	echo "Test for non-existant data file:" > $(OUTPUT)/errors.txt;
	if [ `$(APPNAME) \
		from=$(INPUT)/CAS-MCO-2016-11-22T15.45.50.984-RED-01000-B1.xml \
		to=$(OUTPUT)/BROKEN.cub \
		2>> $(OUTPUT)/errors.txt > /dev/null` ]; \
		then true; \
		fi;

	
# Cleanup
	$(RM) $(OUTPUT)/BROKEN.cub;