Commit e0ba96a9 authored by Amy Stamile's avatar Amy Stamile
Browse files

more PVL updates

parent 64830a1e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ void TranslateApolloLabels (IString filename, Cube *opack) {
  Isis::PvlGroup &dataDir = Isis::Preference::Preferences().findGroup("DataDirectory");
  Process p;
  PvlTranslationTable tTable("$ISISROOT/appdata/translations/MissionName2DataDir.trn");
  QString missionDir = dataDir[tTable.Translate("MissionName", QString::fromStdString(apollo->SpacecraftName()))][0];
  QString missionDir = QString::fromStdString(dataDir[tTable.Translate("MissionName", apollo->SpacecraftName()).toStdString()][0]);
  Pvl resTemplate(missionDir.toStdString() + "/reseaus/" + apollo->InstrumentId().toStdString() + "_NOMINAL.pvl");
  PvlGroup *reseaus = &resTemplate.findGroup("Reseaus");

+20 −20
Original line number Diff line number Diff line
@@ -132,19 +132,19 @@ void IsisMain() {

  //four that are the same for every panaramic mission
  keyword.setName("SpacecraftName");
  keyword.setValue(mission);
  keyword.setValue(mission.toStdString());
  inst_pvlG.addKeyword(keyword);

  keyword.setName("InstrumentName");
  keyword.setValue(transTable.Translate("InstrumentName","whatever"));
  keyword.setValue(transTable.Translate("InstrumentName","whatever").toStdString());
  inst_pvlG.addKeyword(keyword);

  keyword.setName("InstrumentId");
  keyword.setValue(transTable.Translate("InstrumentId","whatever"));
  keyword.setValue(transTable.Translate("InstrumentId","whatever").toStdString());
  inst_pvlG.addKeyword(keyword);

  keyword.setName("TargetName");
  keyword.setValue(transTable.Translate("TargetName","whatever"));
  keyword.setValue(transTable.Translate("TargetName","whatever").toStdString());
  inst_pvlG.addKeyword(keyword);

  //three that need to be calculated from input values
@@ -171,17 +171,17 @@ void IsisMain() {

  isisTime = time0;
  keyword.setName("StartTime");
  keyword.setValue(iStrTEMP=isisTime.UTC());
  keyword.setValue(isisTime.UTC().toStdString());
  inst_pvlG.addKeyword(keyword);

  isisTime = time1;
  keyword.setName("StopTime");
  keyword.setValue(iStrTEMP=isisTime.UTC());
  keyword.setValue(isisTime.UTC().toStdString());
  inst_pvlG.addKeyword(keyword);

  keyword.setName("LineExposureDuration");
  //converted led to msec/mm--negative sign to account for the anti-parallel time and line axes
  keyword.setValue(iStrTEMP=std::to_string(-led),"sec/mm");
  keyword.setValue(std::to_string(-led),"sec/mm");
  inst_pvlG.addKeyword(keyword);

  panCube.putGroup(inst_pvlG);
@@ -195,23 +195,23 @@ void IsisMain() {
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("LeapSecond");
  keyword.setValue( transTable.Translate("LeapSecond","File1") );
  keyword.setValue( transTable.Translate("LeapSecond","File1").toStdString() );
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("TargetAttitudeShape");
  keyword.setValue( transTable.Translate("TargetAttitudeShape", "File1") );
  keyword.addValue( transTable.Translate("TargetAttitudeShape", "File2") );
  keyword.addValue( transTable.Translate("TargetAttitudeShape", "File3") );
  keyword.setValue( transTable.Translate("TargetAttitudeShape", "File1").toStdString() );
  keyword.addValue( transTable.Translate("TargetAttitudeShape", "File2").toStdString() );
  keyword.addValue( transTable.Translate("TargetAttitudeShape", "File3").toStdString() );
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("TargetPosition");
  keyword.setValue("Table");
  keyword.addValue( transTable.Translate("TargetPosition", "File1") );
  keyword.addValue( transTable.Translate("TargetPosition", "File2") );
  keyword.addValue( transTable.Translate("TargetPosition", "File1").toStdString() );
  keyword.addValue( transTable.Translate("TargetPosition", "File2").toStdString() );
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("ShapeModel");
  keyword.setValue( transTable.Translate("ShapeModel", "File1") );
  keyword.setValue( transTable.Translate("ShapeModel", "File1").toStdString() );
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("InstrumentPointing");
@@ -223,7 +223,7 @@ void IsisMain() {
  kernels_pvlG.addKeyword(keyword);

  keyword.setName("InstrumentAddendum");
  keyword.setValue( transTable.Translate("InstrumentAddendum",mission));
  keyword.setValue( transTable.Translate("InstrumentAddendum", mission).toStdString());
  kernels_pvlG.addKeyword(keyword);

  panCube.putGroup(kernels_pvlG);
@@ -630,7 +630,7 @@ void IsisMain() {
  //parameters for maximum correlation autoregestration
  // see:  file:///usgs/pkgs/isis3nightly2011-09-21/isis/doc/documents/patternSMatch/patternSMatch.html#DistanceTolerance
  FileName fiducialPvl("$ISISROOT/appdata/templates/apollo/PanFiducialFinder.def");
  pvl.read(fiducialPvl.expanded());  //read in the autoreg parameters
  pvl.read(fiducialPvl.expanded().toStdString());  //read in the autoreg parameters
  AutoReg *arS = AutoRegFactory::Create(pvl);

  *arS->PatternChip()   = patternS;  //patternS chip is constant
@@ -797,12 +797,12 @@ void Load_Kernel(Isis::PvlKeyword &key) {

  for(int i = 0; i < key.size(); i++) {
     if(key[i] == "") continue;
     if(QString(key[i]).toUpper() == "NULL") break;
     if(QString(key[i]).toUpper() == "NADIR") break;
     if(QString::fromStdString(key[i]).toUpper() == "NULL") break;
     if(QString::fromStdString(key[i]).toUpper() == "NADIR") break;
     //Table was left as the first value of these keywords because one is about to be attached,
     //  still though it needs to be skipped in this loop
     if(QString(key[i]).toUpper() == "TABLE") continue;
     Isis::FileName file(key[i]);
     if(QString::fromStdString(key[i]).toUpper() == "TABLE") continue;
     Isis::FileName file(QString::fromStdString(key[i]));
     if(!file.fileExists()) {
       QString msg = "Spice file does not exist [" + file.expanded() + "]";
       throw IException(IException::Io, msg, _FILEINFO_);
+6 −6
Original line number Diff line number Diff line
@@ -902,7 +902,7 @@ void gbl::FindDustRingParameters() {
                      + gbl::dustFile.expanded() + "*** not found.", _FILEINFO_);
    }
  }
  gbl::calgrp += PvlKeyword("DustRingFile", gbl::dustFile.original());
  gbl::calgrp += PvlKeyword("DustRingFile", gbl::dustFile.original().toStdString());
  // if anti-blooming correction is off correct ring at sample=887, line=388
  if (!gbl::cissLab->AntibloomingOn()) {
    gbl::dustFile2 = (gbl::GetCalibrationDirectory("dustring") + "nac_dustring_aboff"
@@ -936,7 +936,7 @@ void gbl::FindDustRingParameters() {
  }
  gbl::mottleCorrection = true;
  gbl::calgrp += PvlKeyword("MottleCorrectionPerformed", "Yes");
  gbl::calgrp += PvlKeyword("MottleFile", gbl::mottleFile.original());
  gbl::calgrp += PvlKeyword("MottleFile", gbl::mottleFile.original().toStdString());

  // determine strength factor, need effective wavelength of filter
  vector <int> filterIndex(2);
@@ -1107,7 +1107,7 @@ FileName gbl::FindFlatFile() {
  }
  gbl::calgrp += PvlKeyword("FlatfieldCorrectionPerformed", "Yes");
  gbl::calgrp.findKeyword("FlatfieldCorrectionPerformed").addComment("Flatfield Correction Parameters");
  gbl::calgrp += PvlKeyword("SlopeDataBase", slopeDatabaseName.original());
  gbl::calgrp += PvlKeyword("SlopeDataBase", slopeDatabaseName.original().toStdString());
  gbl::flatCorrection = true;

  // Find the best-match flat file
@@ -1673,8 +1673,8 @@ void gbl::FindEfficiencyFactor(QString fluxunits) {
  spline2.AddData(lambda, fluxproduct2);
  gbl::efficiencyFactor = spline1.BoolesRule(spline1.DomainMinimum(), spline1.DomainMaximum());
  double efficiency = spline2.BoolesRule(spline2.DomainMinimum(), spline2.DomainMaximum());
  gbl::calgrp += PvlKeyword("EfficiencyFactor", gbl::efficiencyFactor, units);
  gbl::calgrp += PvlKeyword("TotalEfficiency", efficiency);
  gbl::calgrp += PvlKeyword("EfficiencyFactor", std::to_string(gbl::efficiencyFactor), units.toStdString());
  gbl::calgrp += PvlKeyword("TotalEfficiency", std::to_string(efficiency));

  // Cannot divide by 0.0
  if(gbl::efficiencyFactor == 0) {
@@ -1859,6 +1859,6 @@ void gbl::FindSensitivityCorrection() {
QString gbl::GetCalibrationDirectory(QString calibrationType) {
  // Get the directory where the CISS calibration directories are.
  PvlGroup &dataDir = Preference::Preferences().findGroup("DataDirectory");
  QString missionDir = (QString) dataDir["Cassini"];
  QString missionDir = QString::fromStdString(dataDir["Cassini"]);
  return missionDir + "/calibration/" + calibrationType + "/";
}
+13 −13
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ void IsisMain() {
  FileName in = ui.GetFileName("FROM");
  FileName outIr = ui.GetCubeName("IR");
  FileName outVis = ui.GetCubeName("VIS");
  Pvl lab(in.expanded());
  Pvl lab(in.expanded().toStdString());

  //Checks if in file is rdr
  if(lab.hasObject("IMAGE_MAP_PROJECTION")) {
@@ -64,7 +64,7 @@ void IsisMain() {
  try {
    PvlObject qube(lab.findObject("QUBE"));
    QString id;
    id = (QString)qube["INSTRUMENT_ID"];
    id = QString::fromStdString(qube["INSTRUMENT_ID"]);
    id = id.simplified().trimmed();
    if(id != "VIMS") {
      QString msg = "Invalid INSTRUMENT_ID [" + id + "]";
@@ -79,10 +79,10 @@ void IsisMain() {
  }

  FileName tempname(in.baseName() + ".bsq.cub");
  Pvl pdsLab(in.expanded());
  Pvl pdsLab(in.expanded().toStdString());

  // It's VIMS, let's figure out if it has the suffix data or not
  if(toInt(lab.findObject("QUBE")["SUFFIX_ITEMS"][0]) == 0) {
  if(std::stoi(lab.findObject("QUBE")["SUFFIX_ITEMS"][0]) == 0) {
    // No suffix data, we can use processimportpds
    ProcessImportPds p;

@@ -164,7 +164,7 @@ void IsisMain() {
 * @param outFile FileName of the output file
 */
void ReadVimsBIL(QString inFileName, const PvlKeyword &suffixItems, QString outFile) {
  Pvl pdsLabel(inFileName);
  Pvl pdsLabel(inFileName.toStdString());
  Isis::FileName transFile("$ISISROOT/appdata/translations/pdsQube.trn");
  Isis::PvlToPvlTranslationManager pdsXlater(pdsLabel, transFile.expanded());

@@ -339,10 +339,10 @@ void ReadVimsBIL(QString inFileName, const PvlKeyword &suffixItems, QString outF
      out.SetBasePosition(1, line + 1, band + 1);
      outCube.write(out);

      if(toInt(suffixItems[0]) != 0) {
      if(std::stoi(suffixItems[0]) != 0) {
        pos = fin.tellg();
        char *sideplaneData = new char[4*toInt(suffixItems[0])];
        fin.read(sideplaneData, 4 * toInt(suffixItems[0]));
        char *sideplaneData = new char[4*std::stoi(suffixItems[0])];
        fin.read(sideplaneData, 4 * std::stoi(suffixItems[0]));
        int suffixData = (int)swapper.Int((int *)sideplaneData);
        record[0] = line + 1;
        record[1] = band + 1;
@@ -382,7 +382,7 @@ void ReadVimsBIL(QString inFileName, const PvlKeyword &suffixItems, QString outF
      }
    } // End band loop

    int backplaneSize = toInt(suffixItems[1]) * (4 * (ns + toInt(suffixItems[0])));
    int backplaneSize = std::stoi(suffixItems[1]) * (4 * (ns + std::stoi(suffixItems[0])));
    fin.seekg(backplaneSize, ios_base::cur);

    // Check the last io
@@ -460,7 +460,7 @@ void ProcessBands(Pvl &pdsLab, Cube *vimsCube, VimsType vtype) {
  PvlKeyword center("Center");
  PvlGroup bbin(qube.findGroup("BandBin"));
  for(int i = vims.mi32BandCenterStart; i < vims.mi32BandCenterEnd; i++) {
    center += (QString) bbin["BandBinCenter"][i];
    center += bbin["BandBinCenter"][i];
  }
  bandbin += center;

@@ -468,7 +468,7 @@ void ProcessBands(Pvl &pdsLab, Cube *vimsCube, VimsType vtype) {

  //Create the Kernels Group
  PvlGroup kern("Kernels");
  kern += PvlKeyword("NaifFrameCode", toString(vims.mi32NaifFrameCode));
  kern += PvlKeyword("NaifFrameCode", std::to_string(vims.mi32NaifFrameCode));
  vimsCube->putGroup(kern);
}

@@ -500,8 +500,8 @@ void TranslateVimsLabels(Pvl &pdsLab, Cube *vimscube, VimsType vType) {
  PvlGroup &inst = outputLabel.findGroup("Instrument", Pvl::Traverse);

  //trim start and stop time
  QString strTime = inst.findKeyword("StartTime")[0];
  inst.findKeyword("StartTime").setValue(strTime.remove("Z"));
  QString strTime = QString::fromStdString(inst.findKeyword("StartTime")[0]);
  inst.findKeyword("StartTime").setValue(strTime.remove("Z").toStdString());
  strTime = QString::fromStdString(qube["StopTime"]);
  inst.findKeyword("StopTime").setValue((strTime).remove("Z").toStdString());

+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ int main(void) {
    // Test Shutter Open/Close
    const PvlGroup &inst = c.label()->findGroup("Instrument", Pvl::Traverse);
    double exposureDuration = ((double) inst["ExposureDuration"])/1000;
    QString stime = inst["StartTime"];
    QString stime = QString::fromStdString(inst["StartTime"]);
    double et; // StartTime keyword is the center exposure time
    str2et_c(stime.toLatin1().data(), &et);
    pair <iTime, iTime> shuttertimes = cam->ShutterOpenCloseTimes(et, exposureDuration);
Loading