Commit b9eb204c authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Modified rosvirtis2isis to extract the timing backplane for lvl3 data

parent 5364b89f
Loading
Loading
Loading
Loading
+222 −194
Original line number Diff line number Diff line
@@ -89,19 +89,29 @@ void IsisMain ()
    throw IException(IException::Unknown, msg, _FILEINFO_);
  }

  int procLevel = (int) pdsLabel.findKeyword("PROCESSING_LEVEL_ID");

  // Override default DataTrailerBytes constructed from PDS header
  // Will this number ever change? Where did this # come from?
  if (procLevel == 2) {
    p.SetDataTrailerBytes(864);
  }
  else if ((procLevel == 3)) {
    p.SetDataTrailerBytes(0);
    p.SetDataSuffixBytes(4);
  }

  p.StartProcess();

  // Retrieve HK settings file and read in HK values.
  QList<VirtisHK> hk;

  // Get the directory where the Rosetta translation tables are.
  PvlGroup dataDir (Preference::Preferences().findGroup("DataDirectory"));
  QString transDir = (QString) dataDir["Rosetta"] + "/translations/";

  if (procLevel == 2) {

    // Retrieve HK settings file and read in HK values.
    QList<VirtisHK> hk;

    FileName hkTranslationFile = transDir + "virtis_housekeeping.txt";
    QFile hkFile(hkTranslationFile.toString());

@@ -316,6 +326,24 @@ void IsisMain ()
    }

    outcube->write(table);
  }
  else if (procLevel == 3) {
    std::vector<char *> hkData = p.DataTrailer();
    TableRecord rec;
    TableField scETField("dataSCET", TableField::Double);
    rec += scETField;
    Table table("VIRTISHouseKeeping", rec);
    for (unsigned int i=0; i < hkData.size() ; i++) {
      const char *hk = hkData.at(i);
      const unsigned short *uihk = reinterpret_cast<const unsigned short *> (hk);
      int word1 = swapb(uihk[0]);
      int word2 = swapb(uihk[1]);
      int word3 = swapb(uihk[2]);
      rec[0] = translateScet(word1, word2, word3);
      table += rec;
    }
    outcube->write(table);
  }


  // Create a PVL to store the translated labels in