Commit 8f58de30 authored by Stuart Sides's avatar Stuart Sides
Browse files

Updated the START and STOP TIME keywords with value calculated from the CLOCK COUNTS. Fixes #2200

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6125 41f8697f-d340-4b68-9986-7bafba869bb8
parent 2fda4ac4
Loading
Loading
Loading
Loading
+37 −5
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "IException.h"
#include "ImportPdsTable.h"
#include "iTime.h"
#include "NaifStatus.h"
#include "OriginalLabel.h"
#include "PixelType.h"
#include "ProcessByLine.h"
@@ -135,6 +136,7 @@ void importImage(QString outputParamName, ProcessImportPds::PdsFileType fileType
        iTime firstEt((QString)(*g_utcTable)[0]["UtcTime"]);
        iTime lastEt((QString)(*g_utcTable)[importPds.Lines()-1]["UtcTime"]);

        // The UTC line time table has been flipped in the same manner as the image lines, thus fabs
        outputLines = ceil(fabs(lastEt - firstEt) / g_expectedLineRate + 1.0);
      }
      else {
@@ -254,11 +256,6 @@ void writeCubeWithDroppedLines(Buffer &in) {
        (*g_oBuff)[i] = Null;
      }

//      qDebug() << "Lines to Add for this gap -----------------------------  " << linesToAdd;
//      qDebug() << qSetRealNumberPrecision(14) << "  ETs:  " << thisEt.Et() << nextEt.Et();
//      qDebug() << "  in buf pos: " << in.Sample() << in.Line() << in.Band();
//      qDebug() << "  obuf pos:   " << g_oBuff->Sample() << g_oBuff->Line() << g_oBuff->Band();

      while (linesToAdd > 0.9) {

        for (int band = 0; band < g_oCube->bandCount(); band++) {
@@ -294,9 +291,44 @@ void translateChandrayaan1M3Labels(Pvl& pdsLabel, Cube *ocube, Table& utcTable,
  instrumentXlator.Auto(outLabel);

  PvlGroup &inst = outLabel.findGroup("Instrument", Pvl::Traverse);

  // The start and stop times for M3 in the PDS file look to have been truncated.
  // Update them with the times from the UTC table if we have one. 
  if (fileType != ProcessImportPds::L0) {

    // The original START/STOPTIME keywords and the UTC table did not have accurate enough times to
    // allow spiceinit to work on ck and spk  kernels generated by ckwriter and spkwriter after 
    // jigsaw, so use the clock counts to update these keywords.
    NaifStatus::CheckErrors();

    QString lsk = "$base/kernels/lsk/naif????.tls";
    FileName lskName(lsk);
    lskName = lskName.highestVersion();
    furnsh_c(lskName.expanded().toAscii().data());

    QString sclk = "$chandrayaan1/kernels/sclk/aig_ch1_sclk_complete_biased_m1p???.tsc";
    FileName sclkName(sclk);
    sclkName = sclkName.highestVersion();
    furnsh_c(sclkName.expanded().toAscii().data());

    SpiceInt sclkCode = -86;

    QString startTime = inst["SpacecraftClockStartCount"];
    double et;
    scs2e_c(sclkCode, startTime.toAscii().data(), &et);
    iTime startEt(et);
    inst.findKeyword("StartTime").setValue(startEt.UTC());

    QString stopTime = inst["SpacecraftClockStopCount"];
    scs2e_c(sclkCode, stopTime.toAscii().data(), &et);
    iTime stopEt(et);
    inst.findKeyword("StopTime").setValue(stopEt.UTC());
  }

  ocube->putGroup(inst);



  if (fileType == ProcessImportPds::L0 || fileType == ProcessImportPds::Rdn) {
    // Setup the band bin group
    QString bandFile = "$chandrayaan1/bandBin/bandBin.pvl";
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@
    <change name="Stuart Sides" date="2014-04-18">
      Added missing line detection and correction based on the TIM table for level 1B products.
    </change>
    <change name="Stuart Sides" date="2015-03-25">
      Recalculted the STARTTIME and STOPTIMeE keywords from the clock counts.
    </change>
  </history>

  <category>