Unverified Commit 8683003c authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Instrument Specific Import tests (#4956)

* Added more tests from other instruments to isisimport

* More tests and fixes to isisimport

* Added isisimport tests

* Finished lrocnac tests for isisimport

* Fixed lroc tests for isisimport

* Removed kaguyatc test from base isisimport test file

* Added comment to commented out tests
parent 535ae5a2
Loading
Loading
Loading
Loading
+64 −5
Original line number Diff line number Diff line
{% extends "img_base.tpl" %}


{% block instrument %}
SpacecraftName              = "{{ MISSION_NAME.Value }}"
InstrumentHostName          = "{{ INSTRUMENT_HOST_NAME.Value }}"
InstrumentHostId            = {{ INSTRUMENT_HOST_ID.Value }}
InstrumentName              = "{{ INSTRUMENT_NAME.Value }}"
InstrumentId                = {{ INSTRUMENT_ID.Value }}
FrameId                     = {{ FRAME_ID.Value }}
{% set frameId =  FRAME_ID.Value %}
{% if frameId == "LEFT" %}
InstrumentName              = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA LEFT"
{% else %}
InstrumentName              = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA RIGHT"
{% endif %}
{% if frameId == "LEFT" %}
InstrumentId                = "NACL"
{% else %}
InstrumentId                = "NACR"
{% endif %}
FrameId                     = {{ frameId }}
TargetName                  = {{ TARGET_NAME.Value }}
MissioinPhaseName           = "{{ MISSION_PHASE_NAME.Value }}"
PreRollTime                 = {{ LRO_PREROLL_TIME.Value }}
StartTime                   = {{ START_TIME.Value }}
@@ -55,6 +64,56 @@ Group = BandBin
  Width        = {{ BANDWIDTH.Value }} <ms>
End_Group

{% block kernels %}
Group = Kernels
  {% if frameId == "LEFT" %}
  NaifFrameCode = -85600
  {% else %}
  NaifFrameCode = -85610
  {% endif %}
End_Group
{% endblock %}

{% block translation %}
CubeAtts             = "+Real"
{% set xtermSize = 0 %}
{%- if isArray(LRO_XTERM.Value) -%}
xterm                = (
## for term in LRO_XTERM.Value
  {% set xtermSize = xtermSize + 1%}
  {{ term }} {%- if not loop.is_last -%}, {%- endif -%}
## endfor
)
{%- else -%}
{% set xtermSize = 1 %}
xterm                = {{ LRO_XTERM.Value }}
{%- endif -%}

{% set mtermSize = 0 %}
{%- if isArray(LRO_MTERM.Value) -%}
mterm                = (
## for term in LRO_MTERM.Value
  {% set mtermSize = mtermSize + 1%}
  {{ term }} {%- if not loop.is_last -%}, {%- endif -%}
## endfor
)
{%- else -%}
{% set mtermSize = 1 %}
mterm                = {{ LRO_MTERM.Value }}
{%- endif -%}

{% set btermSize = 0 %}
{%- if isArray(LRO_BTERM.Value) -%}
bterm                = (
## for term in LRO_BTERM.Value
  {% set btermSize = btermSize + 1%}
  {{ term }} {%- if not loop.is_last -%}, {%- endif -%}
## endfor
)
{%- else -%}
{% set btermSize = 1 %}
bterm                = {{ LRO_BTERM.Value }}
{%- endif -%}
{% if mtermSize != xtermSize or btermSize != xtermSize%}
Failure              = "The decompanding terms do not have the same dimensions"
{% endif %}
{% endblock %}
+16 −15
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
        FiducialCoordinateMicron = {{RemoveUnits(LO_FIDUCIAL_COORDINATE_MICRON.Value)}} <um>
        {% set fiducialArray=LO_FIDUCIAL_ID.Value %}
        FiducialID               =  ({{ join(LO_FIDUCIAL_ID.Value, ",") }})
        FiducialSamples          = ({{ join(LO_FIDUCIAL_SAMPLES, ",") }}) <pixels>
        FiducialSamples          = ({{ join(LO_FIDUCIAL_SAMPLES.Value, ",") }}) <pixels>
        {% set fidLineArray=LO_FIDUCIAL_LINES.Value %}
        FiducialLines            = ({% for line in fidLineArray %}
                                        {% if loop.is_last %}
@@ -83,12 +83,12 @@
                                    {% endfor %}) <mm>

    {% else if exists("LO_BORESIGHT_LINE")%}
        BoresightLine = {{LO_BORESIGHT_LINE}}
        BoresightSample = {{LO_BORESIGHT_SAMPLE}}
        BoresightLine = {{LO_BORESIGHT_LINE.Value}}
        BoresightSample = {{LO_BORESIGHT_SAMPLE.Value}}

    {% else if exists("QUBE.ISIS_INSTRUMENT.BORESIGHT_LINE") %}
        BoresightLine = {{QUBE.ISIS_INSTRUMENT.BORESIGHT_LINE}}
        BoresightSample = {{QUBE.ISIS_INSTRUMENT.BORESIGHT_SAMPLE}}
        BoresightLine = {{QUBE.ISIS_INSTRUMENT.BORESIGHT_LINE.Value}}
        BoresightSample = {{QUBE.ISIS_INSTRUMENT.BORESIGHT_SAMPLE.Value}}
        FiducialCoordinateMicron = {{RemoveUnits(QUBE.ISIS_INSTRUMENT.FIDUCIAL_COORD_MICRON.Value)}} <um>

    {% endif %}
@@ -104,13 +104,14 @@
{% endblock %}

{% block bandbin %}
    {% if exists("QUBE.ISIS_INSTRUMENT.FIDUCIAL_ID") %}
        FilterName   = {{QUBE.BAND_BIN.BAND_BIN_UNIT.Value}}
        Center       = {{QUBE.BAND_BIN.BAND_BIN_CENTER.Value}}
        OriginalBand = {{QUBE.BAND_BIN.BAND_BIN_ORIGINAL_BAND.Value}}

    {% else if exists("QUBE.ISIS_INSTRUMENT.BORESIGHT_SAMPLE") %}
{% if exists("QUBE.ISIS_INSTRUMENT.FIDUCIAL_ID") or exists("QUBE.ISIS_INSTRUMENT.BORESIGHT_SAMPLE") %}
  {%- set filterName = QUBE.BAND_BIN.BAND_BIN_UNIT.Value -%}
  {% if filterName == "NONE" %}
  FilterName   = none
  {% else %}
  FilterName   = {{QUBE.BAND_BIN.BAND_BIN_UNIT.Value}}
  {% endif %}
  Center       = {{QUBE.BAND_BIN.BAND_BIN_CENTER.Value}}
  OriginalBand = {{QUBE.BAND_BIN.BAND_BIN_ORIGINAL_BAND.Value}}
{% endif %}
+3 −1
Original line number Diff line number Diff line
@@ -93,7 +93,9 @@ Object = IsisCube
End_Object

Object = Translation
  {% if exists("ptrIMAGE.Value") %}
  {% if exists("ptrIMAGE.Units") %}
  DataFilePointer             = {{ ptrIMAGE.Value }} <{{ ptrIMAGE.Units }}>
  {% else if exists("ptrIMAGE.Value") %}
    {% if isArray(ptrIMAGE.Value) %}
    DataFilePointer             = ({{ ptrIMAGE.Value.0 }}, {{ ptrIMAGE.Value.1 }})
    {% else %}
+9 −1
Original line number Diff line number Diff line
@@ -120,7 +120,15 @@ End_Object


Object = Translation
  {% if exists("ptrQUBE.Units") %}
  DataFilePointer             = {{ ptrQUBE.Value }} <{{ ptrQUBE.Units }}>
  {% else if exists("ptrQUBE.Value") %}
    {% if isArray(ptrQUBE.Value) %}
    DataFilePointer             = ({{ ptrQUBE.Value.0 }}, {{ ptrQUBE.Value.1 }})
    {% else %}
    DataFilePointer             = {{ ptrQUBE.Value }}
    {% endif %}
  {% endif %}
  {% if exists("RECORD_BYTES") %}
  DataFileRecordBytes  = {{ RECORD_BYTES.Value }}
  {% endif %}
+20 −5
Original line number Diff line number Diff line
@@ -367,13 +367,23 @@ namespace Isis {
      QString msg = "Unable to create a cube label from [";
      msg += inputTemplate.expanded() + "]. ";
      msg += e.what();
      if (ui.WasEntered("TEMPLATE")) {
        throw IException(IException::User, msg, _FILEINFO_);
      }
      else {
        throw IException(IException::Programmer, msg, _FILEINFO_);
      }
    }

    // Turn this into a Pvl label
    Pvl newLabel;
    newLabel.fromString(result);

    PvlObject translation = newLabel.findObject("Translation");
    if (translation.hasKeyword("Failure")) {
      throw IException(IException::Io, QString(translation.findKeyword("Failure")), _FILEINFO_);
    }

    // Set everything needed by ProcessImport
    PvlGroup dimensions = newLabel.findObject("IsisCube").findObject("Core").findGroup("Dimensions");
    int ns = toInt(dimensions["Samples"]);
@@ -397,8 +407,6 @@ namespace Isis {
      inst["TargetName"] = ui.GetString("TARGET");
    }

    PvlObject translation = newLabel.findObject("Translation");

    // Check translation for potential PDS3 offset
    if (translation.hasKeyword("DataFilePointer")) {
      PvlKeyword dataFilePointer = translation["DataFilePointer"];
@@ -430,9 +438,16 @@ namespace Isis {
        throw IException(IException::Unknown, msg, _FILEINFO_);
      }

      // Now, to handle the offset
      units = units.trimmed();
      if (units == "BYTES" || units == "B") {
        recSize = 1;
      }
      else {
        if (translation.hasKeyword("DataFileRecordBytes")) {
          recSize = toInt(translation["DataFileRecordBytes"]);
        }
      }
      importer.SetFileHeaderBytes(offset * recSize);
      importer.SaveFileHeader();
    }
Loading