Commit d6ea4064 authored by Kristin's avatar Kristin Committed by Jesse Mapel
Browse files

Updates voy2isis to add an optional parameter to specify the instrument name (#3490)

* Update date and other metadata

* ckwriter_test_fix

* Fix unintentional cmakelists change

* Updated voy2isis to add instrument parameter which can be used to specify the instrument name wac or nac if it is not provided in the image label

* Added simple test

* Updates test and documentation for voy2isis adds instrument_name update

* Updated history documentation to add ticket number for voy2isis changes
parent 6d2a71a0
Loading
Loading
Loading
Loading
−31 KiB (51.2 KiB)
Loading image diff...
−11.9 KiB (2.42 KiB)
Loading image diff...
+32 −12
Original line number Diff line number Diff line
@@ -234,7 +234,9 @@ void TranslateVoyagerLabels(Pvl &inputLab, Cube *ocube) {
  PvlGroup kern("Kernels");
  QString spacecraftNumber;
  int spacecraftCode = 0;

  QString instId = (QString) inst.findKeyword("InstrumentId");

  if((QString) inst.findKeyword("SpacecraftName") == "VOYAGER_1") {
    spacecraftNumber = "1";
    if(instId == "NARROW_ANGLE_CAMERA") {
@@ -249,7 +251,9 @@ void TranslateVoyagerLabels(Pvl &inputLab, Cube *ocube) {
    }
    else {
      QString msg = "Instrument ID [" + instId + "] does not match Narrow or " +
                    "Wide angle camera. The cube was created, but the labels were not translated.";
                    "Wide angle camera. The cube was created, but the labels were not translated. "
                    "To create a cube with translated labels, re-run this application with "
                    "INSTRUMENT set to NAC or WAC.";
      throw IException(IException::User, msg, _FILEINFO_);
    }
  }
@@ -267,7 +271,9 @@ void TranslateVoyagerLabels(Pvl &inputLab, Cube *ocube) {
    }
    else {
      QString msg = "Instrument ID [" + instId + "] does not match Narrow or " +
                    "Wide angle camera. The cube was created, but the labels were not translated.";
                    "Wide angle camera. The cube was created, but the labels were not translated. "
                    "To create a cube with translated labels, re-run this application with "
                    "INSTRUMENT set to NAC or WAC.";
      throw IException(IException::User, msg, _FILEINFO_);
    }
  }
@@ -484,17 +490,31 @@ QByteArray fixLabels(QString fileName, History *hist){

  // Check if the instrument name is valid
  if (labels.contains(QByteArray("INSTRUMENT_NAME\n"))) {
    labels.replace("INSTRUMENT_NAME", "INSTRUMENT_NAME                  = Unknown");
 
    // Only set name to Unknown and warn the user about a missing INSTRUMENT_NAME 
    // if it wasn't specified by the user.
    UserInterface &ui = Application::GetUserInterface();
    if (ui.GetString("INSTRUMENT") == "AUTOMATIC") {
      labels.replace("INSTRUMENT_NAME", "INSTRUMENT_NAME                  = Unknown");
      PvlGroup insNameWarning("Warning"); 
      PvlKeyword insNameMsg("Message", "The INSTRUMENT_NAME for [" + fileName + "] is empty."
                                + "The InstrumentId in the output cube will instead be set to "
                              + "[Unknown] and the labels will not translate.");
                                + "[Unknown] and the labels will not translate. To create a cube "  
                                + "with translated labels, re-run this "
                                + "application with INSTRUMENT set to NAC or WAC.");

      insNameWarning += insNameMsg;
      Application::Log(insNameWarning);

      hEntry += insNameWarning;
    }
    else if (ui.GetString("INSTRUMENT") == "NAC") {
      labels.replace("INSTRUMENT_NAME", "INSTRUMENT_NAME                  = NARROW_ANGLE_CAMERA");
    }
    else if (ui.GetString("INSTRUMENT") == "WAC") {
      labels.replace("INSTRUMENT_NAME", "INSTRUMENT_NAME                  = WIDE_ANGLE_CAMERA");
    }
  }

  // Check if image id is valid
  int imageIdIndex = labels.indexOf(QByteArray("IMAGE_ID"));
+13 −0
Original line number Diff line number Diff line
# history - Added to test the instrument option. 
APPNAME = voy2isis

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/c2061155.imq \
        to=$(OUTPUT)/c2061155.cub instrument=nac > /dev/null;
        
	catlab from=$(OUTPUT)/c2061155.cub \
        to=$(OUTPUT)/c2061155.pvl > /dev/null;

	> /dev/null;
+46 −0
Original line number Diff line number Diff line
@@ -7,12 +7,20 @@
  </brief>

  <description>
      <p>
    This program will take in raw image files from the Voyager spacecraft
    mission and import them into Isis formatted cubes.  The input files are
    compressed Planetary Data System (PDS) formatted Voyager Experiment 
    Data Record (EDR) files.  The output cube will contain tranlated labels in 
    pvl format with instrument, archive, bandbin, kernel, and nominal reseau 
    information.
      </p>
      <p>
    Some input images from the PDS archive may be missing a value for INSTRUMENT_NAME in their header.
    For these images, the name of the instrument can be specified as NAC (NARROW_ANGLE_CAMERA)
     or WAC (WIDE_ANGLE_CAMERA) using the optional INSTRUMENT parameter. 
    Users are encouraged to find this information in the pds data volume index.tab file.
      </p>
  </description>

  <history>
@@ -55,6 +63,10 @@
    <change name="Christopher Combs" date="2018-01-19">
      Made changes to allow merge of two voy2isis tickets. References #4421, #4345.
    </change>
    <change name="Kristin Berry" date="2019-11-06">
      Added the INSTRUMENT parameter to allow the specification of the InstrumentId 
      when it cannot be determined from the labels. Fixed #3426
    </change>
  </history>

  <category>
@@ -126,6 +138,40 @@
           *.cub
         </filter>
       </parameter>

      <parameter name="INSTRUMENT">
        <type>string</type>
        <brief>Defines the InstrumentId to use for the image. Only needs to be specified if missing from the input image.</brief>
        <default><item>AUTOMATIC</item></default>
        <description>
          This parameter is used to specify the InstrumentId for the image. If left at 
           its default value, ISIS will determine the InstrumentId automatically 
	   using the INSTRUMENT_NAME value from the input image. This option was added because some images are 
	   missing the INSTRUMENT_NAME from their labels. 
        </description>
          <list>
           <option value="AUTOMATIC">
              <brief>Read the InstrumentId from the input image.</brief>
              <description>
                ISIS will attempt to read the InstrumentId from the input image.
              </description>
            </option>

           <option value="NAC">
              <brief>Set the InstrumentId to NARROW_ANGLE_CAMERA.</brief>
              <description>
                Set the InstrumentId to NARROW_ANGLE_CAMERA.
              </description>
            </option>

           <option value="WAC">
              <brief> Set the InstrumentId to WIDE_ANGLE_CAMERA.</brief>
              <description>
		   Set the InstrumentId to WIDE_ANGLE_CAMERA.
              </description>
            </option>
        </list>
      </parameter>
    </group>
  </groups>
  <examples>