Commit 25087aa7 authored by Janet Barrett's avatar Janet Barrett
Browse files

Modified kaguyatc2isis to translate all keywords in the PDS label and to fix...

Modified kaguyatc2isis to translate all keywords in the PDS label and to fix the missing TARGET_NAME in the label. Fixes #2036

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@5743 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9738facd
Loading
Loading
Loading
Loading
+33 −9
Original line number Diff line number Diff line
@@ -13,16 +13,15 @@ using namespace Isis;

void IsisMain() {
  ProcessImportPds p;
  Pvl label;
  UserInterface &ui = Application::GetUserInterface();

  QString labelFile = ui.GetFileName("FROM");
  FileName inFile = ui.GetFileName("FROM");
  QString id;
  Pvl lab(inFile.expanded());
  Pvl label(inFile.expanded());

  try {
    id = (QString) lab.findKeyword("DATA_SET_ID");
    id = (QString) label.findKeyword("DATA_SET_ID");
  }
  catch(IException &e) {
    QString msg = "Unable to read [DATA_SET_ID] from input file [" +
@@ -38,7 +37,12 @@ void IsisMain() {
    throw IException(IException::Unknown, msg, _FILEINFO_);
  }

  p.SetPdsFile(labelFile, "", label);
  if (!label.hasKeyword("TARGET_NAME")) {
    label.addKeyword(PvlKeyword("TARGET_NAME", "MOON"), Pvl::Replace);
  }

  p.SetPdsFile(label, labelFile);

  Cube *outcube = p.SetOutputCube("TO");

  // Get user entered special pixel ranges
@@ -66,18 +70,38 @@ void IsisMain() {
  Pvl otherLabels;
  p.TranslatePdsProjection(otherLabels);

  // Get the directory where the generic pds2isis level 2 translation tables are.
  // Translate the remaining MI MAP labels
  PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));
  QString transDir = (QString) dataDir["base"] + "/translations/";
  QString transDir = (QString) dataDir["Kaguya"] + "/translations/";
  
  FileName transFile(transDir + "tcmapBandBin.trn");
  PvlTranslationManager bandBinXlater(label, transFile.expanded());
  bandBinXlater.Auto(otherLabels);
  
  transFile = transDir + "tcmapInstrument.trn";
  PvlTranslationManager instXlater(label, transFile.expanded());
  instXlater.Auto(otherLabels);
  
  // Translate the Archive group
  FileName transFile(transDir + "pdsImageArchive.trn");
  transFile = transDir + "tcmapArchive.trn";
  PvlTranslationManager archiveXlater(label, transFile.expanded());
  archiveXlater.Auto(otherLabels);
  
  // Write the Archive and Mapping groups to the output cube label
  if(otherLabels.hasGroup("Mapping") &&
    (otherLabels.findGroup("Mapping").keywords() > 0)) {
    outcube->putGroup(otherLabels.findGroup("Mapping"));
  }
  if(otherLabels.hasGroup("Instrument") &&
    (otherLabels.findGroup("Instrument").keywords() > 0)) {
    outcube->putGroup(otherLabels.findGroup("Instrument"));
  }
  if(otherLabels.hasGroup("BandBin") &&
    (otherLabels.findGroup("BandBin").keywords() > 0)) {
    outcube->putGroup(otherLabels.findGroup("BandBin"));
  }
  if(otherLabels.hasGroup("Archive") &&
    (otherLabels.findGroup("Archive").keywords() > 0)) {
    outcube->putGroup(otherLabels.findGroup("Archive"));
  }

  // Add the BandBin group
  PvlGroup bbin("BandBin");
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
      SETLRSRANGE, SETLISRANGE) to allow the user to specify
      special pixel values. Fixes #1718.
    </change>
    <change name="Janet Barrett" date="2014-02-11">
      Added check for TARGET_NAME keyword. Fixes #2036.
    </change>
  </history>

  <category>