Commit 7abcf647 authored by Kaj Williams's avatar Kaj Williams
Browse files

Added support for Hayabusa2 ingestion and spiceinit. Fixes #5056, #5057.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7879 41f8697f-d340-4b68-9986-7bafba869bb8
parent 378913ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ Group = DataDirectory
  Tgo          = $ISIS3DATA/tgo
  Galileo      = $ISIS3DATA/galileo
  Hayabusa     = $ISIS3DATA/hayabusa
  Hayabusa2    = $ISIS3DATA/hayabusa2
  Juno         = $ISIS3DATA/juno
  Kaguya       = $ISIS3DATA/kaguya
  Lo           = $ISIS3DATA/lo
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ Group = DataDirectory
  Tgo          = $ISIS3DATA/tgo
  Galileo      = $ISIS3DATA/galileo
  Hayabusa     = $ISIS3DATA/hayabusa
  Hayabusa2    = $ISIS3DATA/hayabusa2
  Juno         = $ISIS3DATA/juno
  Kaguya       = $ISIS3DATA/kaguya
  Lo           = $ISIS3DATA/lo
+7 −0
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.apps
endif
 No newline at end of file
+129 −0
Original line number Diff line number Diff line
#include "Isis.h"

#include <QString>

#include "FileName.h"
#include "iTime.h"
#include "OriginalLabel.h"
#include "ProcessImportFits.h"
#include "Pvl.h"
#include "PvlGroup.h"
#include "PvlKeyword.h"
#include "PvlObject.h"
#include "PvlToPvlTranslationManager.h"
#include "UserInterface.h"

using namespace std;
using namespace Isis;

void IsisMain () {

  ProcessImportFits importFits;
  UserInterface &ui = Application::GetUserInterface();
  importFits.setFitsFile(FileName(ui.GetFileName("FROM")));
  importFits.setProcessFileStructure(0);

  Cube *outputCube = importFits.SetOutputCube("TO");

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

  // Create a PVL to store the translated labels in
  Pvl outputLabel;

  // Get the FITS label
  Pvl fitsLabel;
  fitsLabel.addGroup(importFits.fitsImageLabel(0));
  try {
    fitsLabel.addGroup(importFits.extraFitsLabel(0));
  }
  catch (IException &e) {
    QString msg = "Input file [" + FileName(ui.GetFileName("FROM")).expanded() + 
                  "] does not appear to be a Hayabusa2/ONC label file.";
    throw IException(e, IException::Unknown, msg, _FILEINFO_);
  }

  QString instid;
  QString missid;
  try {
    instid = fitsLabel.findGroup("FitsLabels").findKeyword("INSTRUME")[0];
    missid = fitsLabel.findGroup("FitsLabels").findKeyword ("SPCECRFT")[0]; 
  }
  catch (IException &e) {
    QString msg = "Unable to read instrument ID, [INSTRUME], or spacecraft ID, [SPCECRFT], " 
                  "from input file [" + FileName(ui.GetFileName("FROM")).expanded() + "]";
    throw IException(e, IException::Io,msg, _FILEINFO_);
  }

  missid = missid.simplified().trimmed();
  if (QString::compare(missid, "HAYABUSA-2", Qt::CaseInsensitive) != 0) {
    QString msg = "Input file [" + FileName(ui.GetFileName("FROM")).expanded() + 
                  "] does not appear to be a Hayabusa2 label file.";
    throw IException(IException::Unknown, msg, _FILEINFO_);
  }
  instid = instid.simplified().trimmed();
  if (QString::compare(instid, "Optical Navigation Camera", Qt::CaseInsensitive) != 0) {
    QString msg = "Input file [" + FileName(ui.GetFileName("FROM")).expanded() + 
                  "] does not appear to be a Hayabusa2/ONC label file.";
    throw IException(IException::Unknown, msg, _FILEINFO_);
  }

  // Translate the Instrument group
  FileName transFile(transDir + "hyb2oncInstrument.trn");
  PvlToPvlTranslationManager instrumentXlater (fitsLabel, transFile.expanded());
  instrumentXlater.Auto(outputLabel);
  
  //  Update target if user specifies it
  PvlGroup &instGrp = outputLabel.findGroup("Instrument",Pvl::Traverse);
  QString target;
  if (ui.WasEntered("TARGET")) {
    instGrp["TargetName"] = ui.GetString("TARGET");
  }
  instGrp["ExposureDuration"].setUnits("seconds");
  outputCube->putGroup(instGrp);

  // Translate the BandBin group
  transFile = transDir + "hyb2oncBandBin.trn";
  PvlToPvlTranslationManager bandBinXlater (fitsLabel, transFile.expanded());
  bandBinXlater.Auto(outputLabel);
  PvlGroup &bandGrp = outputLabel.findGroup("BandBin",Pvl::Traverse);
  if (bandGrp.hasKeyword("Width")) { // if width exists, then so must center
    bandGrp["Width"].setUnits("nanometers");
    bandGrp["Center"].setUnits("nanometers");
  }
  outputCube->putGroup(outputLabel.findGroup("BandBin",Pvl::Traverse));

  // Translate the Archive group
  transFile = transDir + "hyb2oncArchive.trn";
  PvlToPvlTranslationManager archiveXlater (fitsLabel, transFile.expanded());
  archiveXlater.Auto(outputLabel);
  PvlGroup &archGrp = outputLabel.findGroup("Archive", Pvl::Traverse);
  QString source = archGrp.findKeyword("SourceProductId")[0];
  archGrp["SourceProductId"].setValue(FileName(source).baseName());

  //  Create YearDoy keyword in Archive group
  iTime stime(outputLabel.findGroup("Instrument", Pvl::Traverse)["StartTime"][0]);
  PvlKeyword yeardoy("YearDoy", toString(stime.Year()*1000 + stime.DayOfYear()));
  archGrp.addKeyword(yeardoy);
  outputCube->putGroup(archGrp);


  // Create a Kernels group
  transFile = transDir + "hyb2oncKernels.trn";
  PvlToPvlTranslationManager kernelsXlater(fitsLabel, transFile.expanded());
  kernelsXlater.Auto(outputLabel);
  outputCube->putGroup(outputLabel.findGroup("Kernels", Pvl::Traverse));

  // Now write the FITS augmented label as the original label
  // Save the input FITS label in the Cube original labels
  OriginalLabel originalLabel(fitsLabel);
  outputCube->write(originalLabel);

  // Convert the image data
  importFits.Progress()->SetText("Importing Hayabusa2 image");
  importFits.StartProcess();
  importFits.Finalize();

}
+209 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<application name="hyb2onc2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd"> 
<!-- $Id: hyb2onc2isis.xml 6226 2017-07-05 20:46:13Z kewilliams@usgs.gov $ -->

  <brief>Import PDS/FITS formatted Hayabusa2 image into ISIS cube</brief>

  <description>
    <p>
       This application will import and convert a Hayabusa2 Optical Navigation Camera (ONC) FITS image to an ISIS cube.
      
    </p>
    <br/>
    <h3>Requirements</h3>
    <ul>
      <li>
        Raw image data file (.fit) (specified in <em>FROM</em> label)
      </li>
      <li>
        Output ISIS file name (.cub) (<em>TO</em>)
      </li>
      <li>
        Users may need to override the target name (<em>TARGET</em>). 
      </li>
    </ul>
    <p>
       The input FITS formatted header file for the Hayabusa2
       image must be used in the FROM parameter.  
    </p>
    <h3>When TARGET Parameter Should Be Specified</h3>
    <ul>
      <li>
        When Hayabusa2 EDR labels contain an incorrect value for the 
      TARGET_NAME keyword 
      </li>
      <li>
         Define TARGET = "SKY" to later project the data with 
        <em>skymap</em>.
      </li>
    </ul>
    <br/>
    <h2>Mission Overview</h2>
    <p>
       The Hayabusa2 spacecraft was launched on 3 Dec 2014.  The Optical Navigation Camera (ONC) 
       package is positioned on the nadir-facing panel.
    </p>
    <p>
       The mission purpose is to rendezvous with (and provide a sample return from) 
       the apollo asteroid 162173 Ryugu, a Cg-type asteroid. 
    </p> 
    <h2>Instrument Overview</h2>
    <p>
       The ONC package consists of three cameras: the telescopic (ONC-T) camera and two wide-angle 
       cameras (ONC-W1,ONC-W2). 
    </p>
    <p>
       The wide-angle cameras each have a square 65.24 x 65.24 deg. field of view (FOV). The wide-angle 
       camera ONC-W1 and ONC-W2 have focal lengths of
       10.35 mm and 10.44 mm, respectively. The telescope camera 
       has a 6.35 x 6.35 deg. FOV. The telescopic camera ONC-T has a focal length of 121.1 mm. 
    </p>
    <p>
       The ONC package has a set of eight bandpass filters. Below is a table of 
       the filters and their specifications:
    </p>
    <br/>
    <h2>ONC Filters</h2>
    <p>
       The following table provides the specifications for each of the six 
       ONC-T bandpass filters. 
    </p>
      <TABLE BORDER="1">
            <CAPTION>
                ONC Filter Specifications
              </CAPTION>
          <TR>
            <TH>Filter Number</TH>
            <TH>Band center (nm)</TH>
            <TH>FWHP Bandwidth (nm)</TH>
          </TR>
          <TR>
              <TD>ul</TD>
              <TD>390</TD>
              <TD>40</TD>
          </TR>
          <TR>
              <TD>Wide</TD>
              <TD>775</TD>
              <TD>850</TD>
          </TR>
          <TR>
              <TD>v</TD>
              <TD>550</TD>
              <TD>30</TD>
          </TR>
          <TR>
              <TD>w</TD>
              <TD>700</TD>
              <TD>30</TD>
          </TR>
          <TR>
              <TD>x</TD>
              <TD>860</TD>
              <TD>40</TD>
          </TR>
          <TR>
              <TD>Na</TD>
              <TD>589.5</TD>
              <TD>10</TD>
          </TR>
          <TR>
              <TD>p</TD>
              <TD>950</TD>
              <TD>60</TD>
          </TR>
          <TR>
              <TD>b</TD>
              <TD>480</TD>
              <TD>30</TD>
          </TR>
      </TABLE>

    <br/>
    <h2>Data Archive</h2>
    <p>
       ???
    </p>
    
    <br/>
    <h2>References</h2>
    <br/>
    <cite>
      Suzuki, H. et al. (2017) Initial Inflight Calibration for Hayabusa2 Optical Navigation Camera (ONC) for Scientific Observations of Asteroid Ryugu (in review for Icarus). 
    </cite>
    <br/>
    <br/>
    <cite>
        Kameda, S. et al. (2015) Detectability of hydrous minerals using ONC-T camera onboard the Hayabusa2 spacecraft, Advances in Space Research, Volume 56, Issue 7, Pages 1519-1524, ISSN 0273-1177, http://dx.doi.org/10.1016/j.asr.2015.06.037.
        (http://www.sciencedirect.com/science/article/pii/S0273117715004743)
    </cite>
    <br/>
    <br/>

  </description>

  <history>
    <change name="Kaj Williams" date="2017-07-05">
      Original version
    </change>
    <change name="Kaj Williams and Ian Humphrey" date="2017-07-26">
      Added references and more text.
    </change>
  </history>

  <category>
    <missionItem>Hayabusa2</missionItem> 
  </category> 

  <groups>
    <group name="Files">
      <parameter name="FROM">
        <type>filename</type>
        <fileMode>input</fileMode>
        <brief>
          Input PDS formatted detached header file for ONC image.
        </brief>
        <description>
           This file is the PDS label (ending in .lbl) to the image data.  The 
           image data are stored in  FITS format with the detached .lbl file 
           describing generic access to the data.  The program, 
           <em>hyb2onc2isis</em>, will also read the FITS file and extract 
           the header contained therein.  Some FITS label values are transferred 
           to the output ISIS files as well for completeness.
        </description>
        <filter>*.lbl *.LBL</filter>
      </parameter>
      
      <parameter name="TO">
         <type>cube</type>
         <pixelType>real</pixelType>
         <fileMode>output</fileMode>
         <brief>Output ISIS3 cube filename</brief>
         <description>
           Use this parameter to select the output filename of the ISIS cube 
           generated by this application.
         </description>
         <filter>*.cub</filter>
       </parameter>

    </group>
    <group name="Parameters">
        <parameter name="TARGET">
            <type>string</type>
            <brief>Provide target name if absent or incorrect in input (FROM) 
              label 
            </brief>
            <description>
              <p>
                 This parameter may be necessary as some ONC EDR labels may 
                 not contain correct values for the TARGET_NAME keyword. This 
                 parameter can be used to provide the correct name of the target.  
                 It may also be used to specify SKY as the target to support 
                 projecting data to the celestial sphere. 
              </p>
            </description>
            <internalDefault>Label Value</internalDefault> 
        </parameter>
    </group>
  </groups>
</application>
Loading