Commit b6a1c8a2 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Adam Paquette
Browse files

added pds4 gen for hyb2 (#3933)

* added pds4 gen for hyb2

* removed xml docs to be re-written after app becomes more complete

* asdfkl;alsdkf';lkasd';flka';sdlkf';laskdf';lkasd';lfkas';df

* cleaned up a little
parent c82afe4b
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
# Translation for Hayabusa 2 export from ISIS cube to PDS4 product 

Group = PixelAveragingWidth
  Auto 
  Optional
  InputKey       = Binning 
  InputPosition  = (IsisCube, Instrument)
  OutputName     = img:pizel_averaging_width 
  OutputPosition = (Product_Observational, Observation_Area, Discipline_Area, img:Imaging, img:Downsample_Parameters)
  Translation    = (*, *)
End_Group 

Group = PixelAveragingHeight
  Auto 
  Optional
  InputKey       = Binning 
  InputPosition  = (IsisCube, Instrument)
  OutputName     = img:pizel_averaging_width 
  OutputPosition = (Product_Observational, Observation_Area, Discipline_Area, img:Imaging, img:Downsample_Parameters)
  Translation    = (*, *)
End_Group 
+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
+71 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<application name="hyb2pds4gen" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">

  <brief>
    Convert Hayabusa2 image from from ISIS3 cube to PDS4 format
  </brief>

  <description>
   This programs exports an ISIS3 Haybusa cube to a PDS4 product. 
   If available, Instrument and  Mapping information will be written to the detached 
   output PDS4 formatted xml label file.
  </description>

  <category>
    <categoryItem>Import and Export</categoryItem>
  </category>

  <history>
  </history>

  <groups>
    <group name="Files">
      <parameter name="FROM">
        <type>cube</type>
        <fileMode>input</fileMode>
        <brief>
          Input cube to be converted
        </brief>
        <description>
          The cube to be converted to pds format.
        </description>
        <filter>
          *.cub
        </filter>
      </parameter>

      <parameter name="TO">
        <type>filename</type>
        <fileMode>output</fileMode>
        <brief>
          Output pds image
        </brief>
        <description>
          The resulting pds file. For PDS4, a detached label of the same name with the file extension .xml 
          will be created in the same directory.
        </description>
        <filter>
          *.img
        </filter>
      </parameter>
    </group>

    <group name="Keywords">
      <parameter name="PDS4LOGICALIDENTIFIER">
        <type>string</type>
        <brief>
          String value for the PDS4 logical_identifier keyword.
        </brief>
        <description>
          This value is used to set the required PDS4 value, logical_identifier. It should be a
          6-part colon separated string of the form 
          <b>urn:space_agency:archiving_agency:pds_approved_bundle_id:pds_approved_collection_id:product_id</b>.
          Note that space_agency is generally "nasa" and archiving_agency is generally "pds".
        </description>
      </parameter>
    </group>

  </groups>

</application>
+49 −0
Original line number Diff line number Diff line
#include "Isis.h"

#include <QDomDocument>
#include <QDomElement>
#include <QString>

#include "Application.h"
#include "Cube.h"
#include "ExportDescription.h"
#include "FileName.h"
#include "Process.h"
#include "ProcessExportPds.h"
#include "ProcessExportPds4.h"
#include "Pvl.h"
#include "PvlKeyword.h"
#include "PvlToXmlTranslationManager.h"

using namespace std;
using namespace Isis;

void IsisMain() {
  UserInterface &ui = Application::GetUserInterface();

  QString translationFile = "$ISISROOT/appdata/translations/Hayabusa2OncPds4Export.trn";

  // Setup the process and set the input cube
  ProcessExportPds4 process;
  Cube *inputCube = process.SetInputCube("FROM");
  Pvl *inputLabel = inputCube->label();
  
  process.setImageType(ProcessExportPds4::BinSetSpectrum);

  QDomDocument &pdsLabel = process.StandardPds4Label();
  ProcessExportPds4::translateUnits(pdsLabel);
  
  QString logicalId = ui.GetString("PDS4LOGICALIDENTIFIER");
  process.setLogicalId(logicalId);

  PvlToXmlTranslationManager xlator(*(inputLabel), translationFile);
  xlator.Auto(pdsLabel);

  PvlGroup instGroup = inputLabel->findObject("IsisCube").findGroup("Instrument");

  QString outFile = ui.GetFileName("TO");
  process.WritePds4(outFile);

  return;
}