Unverified Commit 35b21fc9 authored by Amy Stamile's avatar Amy Stamile Committed by GitHub
Browse files

Tgocassis ingest fixes for cas_cal_sc images (#5435)

* fixes cas_cal_sc ingest errors

* fixed tests
parent 179415eb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ release.
- Fixed ProgramLauncher failing while reporting errors from launched programs [#5331](https://github.com/DOI-USGS/ISIS3/pull/5331)
- Fixed high/low filter functionality in trimfilter [#5311](https://github.com/DOI-USGS/ISIS3/issues/5311)
- Fixed downloadIsisData script excluding needed files in the calibration folder [#5272](https://github.com/DOI-USGS/ISIS3/issues/5272)
- Fixed tgocassis2isis cas_cal_sc ingest errors and added error for cas_raw_sc images [#5413](https://github.com/DOI-USGS/ISIS3/issues/5413)

## [8.0.1] - 2023-08-23

+20 −65
Original line number Diff line number Diff line
# Translates CaSSIS xml labels into the Instrument PvlGroup values
# Translates CaSSIS PSA Calibrated xml labels into the Instrument PvlGroup values
# for the ingested ISIS cube labels.
#
# The Dependencies keyword specifies a tag or attribute at the same level as
# the InputKey that uniquely identifies the InputKey.
#
# Consider the following translation group and xml
#
# Group = Samples
#   Auto
#   InputPosition  = (Array_2D_Image, Axis_Array)
#   Dependencies   = "tag@axis_name|Sample"
#   InputKey       = elements
#   OutputName     = Samples
#   OutputPosition = (Group, Dimensions)
#   Translation    = (*, *)
# End_Group
#
# <Array_2D_Image>
#   <Axis_Array>
#     <axis_name>Line</axis_name>
#     <sequence_number>1</sequence_number>
#     <elements>2048</elements>
#   </Axis_Array>
#   <Axis_Array>
#     <axis_name>Sample</axis_name>
#     <sequence_number>2</sequence_number>
#     <elements>279</elements>
#   </Axis_Array>
# </Array_2D_Image>
#
# There are two Axis_Array tags below Array_2D_Image and both of them have an
# elements tag.  So, the Dependencies keyword specifies to take the value of
# the elements tag under the second Axis_Array array tag because it also has a
# axis_name tag with a value of Sample.
#
#
# This translation table is for translating CaSSIS xml labels into pvl cube
# labels.
#
# See $ISISROOT/appdata/translations/XmlExample.trn for an example xml translation table
# and documentation for the different options.
#
# history 2018-05-17 Kaitlyn Lee - Added ObservationId with a placeholder value for now.

Group = SpacecraftName
  Auto
@@ -50,11 +8,9 @@ Group = SpacecraftName
  InputKey             = name
  OutputName           = SpacecraftName
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
  Translation          = ("TRACE GAS ORBITER", "TGO")
End_Group



Group = InstrumentId
  Auto
  InputPosition        = (Observation_Area, Observing_System, Observing_System_Component)
@@ -76,15 +32,6 @@ Group = Expanded
  Translation          = (1, *)
End_Group

Group = ObservationId
  Auto
  InputPosition      = (Identification_Area, Alias_List, Alias)
  InputKey           = alternate_id
  OutputName         = ObservationId
  OutputPosition     = (Object, IsisCube, Group, Archive)
  Translation        = (*, *)
End_Group

Group = TargetName
  Auto
  InputPosition        = (Observation_Area, Target_Identification)
@@ -114,8 +61,8 @@ End_Group

Group = Filter
  Auto
  InputPosition        = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey             = img:filter_name
  InputPosition        = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:HK_Derived_Data)
  InputKey             = em16_tgo_cas:filter
  OutputName           = Filter
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
@@ -123,8 +70,8 @@ End_Group

Group = FilterName
  Auto
  InputPosition        = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey             = img:filter_name
  InputPosition        = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:HK_Derived_Data)
  InputKey             = em16_tgo_cas:filter
  OutputName           = Filter
  OutputPosition       = (Object,IsisCube,Group,BandBin)
  Translation          = (*, *)
@@ -132,28 +79,26 @@ End_Group

Group = Center
  Auto
  InputPosition  = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey       = img:filter_name
  InputPosition  = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:HK_Derived_Data)
  InputKey       = em16_tgo_cas:filter
  OutputName     = Center
  OutputPosition = (Object, IsisCube, Group, BandBin)
  Translation    = (678.2, PAN)
  Translation    = (494.8, BLU)
  Translation    = (836.0, RED)
  Translation    = (939.3, NIR)

End_Group

Group = Width
  Auto
  InputPosition  = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey       = img:filter_name
  InputPosition  = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:HK_Derived_Data)
  InputKey       = em16_tgo_cas:filter
  OutputName     = Width
  OutputPosition = (Object, IsisCube, Group, BandBin)
  Translation    = (231.9, PAN)
  Translation    = (121.8, BLU)
  Translation    = (98.5, RED)
  Translation    = (133.6, NIR)

End_Group

Group = Expanded
@@ -166,4 +111,14 @@ Group = Expanded
  Translation          = (*, *)
End_Group

Group = UniqueIdentifier
  Auto
  Optional
  InputPosition  = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:Image_Command)
  InputKey       = em16_tgo_cas:unique_identifier
  OutputName     = UniqueIdentifier
  OutputPosition = (Object, IsisCube, Group, Archive)
  Translation    = (*, *)
End_Group

End
+168 −0
Original line number Diff line number Diff line
# Translates CaSSIS xml labels into the Instrument PvlGroup values
# for the ingested ISIS cube labels.
#
# The Dependencies keyword specifies a tag or attribute at the same level as
# the InputKey that uniquely identifies the InputKey.
#
# Consider the following translation group and xml
#
# Group = Samples
#   Auto
#   InputPosition  = (Array_2D_Image, Axis_Array)
#   Dependencies   = "tag@axis_name|Sample"
#   InputKey       = elements
#   OutputName     = Samples
#   OutputPosition = (Group, Dimensions)
#   Translation    = (*, *)
# End_Group
#
# <Array_2D_Image>
#   <Axis_Array>
#     <axis_name>Line</axis_name>
#     <sequence_number>1</sequence_number>
#     <elements>2048</elements>
#   </Axis_Array>
#   <Axis_Array>
#     <axis_name>Sample</axis_name>
#     <sequence_number>2</sequence_number>
#     <elements>279</elements>
#   </Axis_Array>
# </Array_2D_Image>
#
# There are two Axis_Array tags below Array_2D_Image and both of them have an
# elements tag.  So, the Dependencies keyword specifies to take the value of
# the elements tag under the second Axis_Array array tag because it also has a
# axis_name tag with a value of Sample.
#
#
# This translation table is for translating CaSSIS xml labels into pvl cube
# labels.
#
# See $ISISROOT/appdata/translations/XmlExample.trn for an example xml translation table
# and documentation for the different options.
#
# history 2018-05-17 Kaitlyn Lee - Added ObservationId with a placeholder value for now.

Group = SpacecraftName
  Auto
  InputPosition        = (Observation_Area, Observing_System, Observing_System_Component)
  InputKeyDependencies = "tag@type|Host"
  InputKey             = name
  OutputName           = SpacecraftName
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
End_Group



Group = InstrumentId
  Auto
  InputPosition        = (Observation_Area, Observing_System, Observing_System_Component)
  InputKeyDependencies = "tag@type|Instrument"
  InputKey             = name
  OutputName           = InstrumentId
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
End_Group

Group = Expanded
  Auto
  InputDefault         = 1
  InputPosition        = (Observation_Area, Observing_System, Observing_System_Component)
  InputKeyDependencies = "tag@type|Host"
  InputKey             = name
  OutputName           = Expanded
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (1, *)
End_Group

Group = ObservationId
  Auto
  InputPosition      = (Identification_Area, Alias_List, Alias)
  InputKey           = alternate_id
  OutputName         = ObservationId
  OutputPosition     = (Object, IsisCube, Group, Archive)
  Translation        = (*, *)
End_Group

Group = TargetName
  Auto
  InputPosition        = (Observation_Area, Target_Identification)
  InputKey             = name
  OutputName           = TargetName
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
End_Group

Group = StartTime
  Auto
  InputPosition        = (Observation_Area, Time_Coordinates)
  InputKey             = start_date_time
  OutputName           = StartTime
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
End_Group

Group = ExposureDuration
  Auto
  InputPosition        = (Observation_Area, Mission_Area, em16_tgo_cas:Cassis_Data, em16_tgo_cas:PEHK_Derived_Data)
  InputKey             = em16_tgo_cas:exposure_time
  OutputName           = ExposureDuration
  OutputPosition       = (Object, IsisCube, Group, Instrument)
  Translation          = (*, *)
End_Group

Group = Filter
  Auto
  InputPosition        = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey             = img:filter_name
  OutputName           = Filter
  OutputPosition       = (Object,IsisCube,Group,Instrument)
  Translation          = (*, *)
End_Group

Group = FilterName
  Auto
  InputPosition        = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey             = img:filter_name
  OutputName           = Filter
  OutputPosition       = (Object,IsisCube,Group,BandBin)
  Translation          = (*, *)
End_Group

Group = Center
  Auto
  InputPosition  = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey       = img:filter_name
  OutputName     = Center
  OutputPosition = (Object, IsisCube, Group, BandBin)
  Translation    = (678.2, PAN)
  Translation    = (494.8, BLU)
  Translation    = (836.0, RED)
  Translation    = (939.3, NIR)

End_Group

Group = Width
  Auto
  InputPosition  = (Observation_Area, Discipline_Area, img:Imaging, img:Optical_Filter)
  InputKey       = img:filter_name
  OutputName     = Width
  OutputPosition = (Object, IsisCube, Group, BandBin)
  Translation    = (231.9, PAN)
  Translation    = (121.8, BLU)
  Translation    = (98.5, RED)
  Translation    = (133.6, NIR)
End_Group

Group = Expanded
  Auto
  Optional
  InputPosition        = (CaSSIS_Header, DERIVED_HEADER_DATA)
  InputKey             = Expanded
  OutputName           = Expanded
  OutputPosition       = (Object, IsisCube, Group, Instrument)
  Translation          = (*, *)
End_Group

End
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ Group = CoreType
  OutputName     = CoreType
  OutputPosition = (Group, Pixels)
  Translation    = (Real, IEEE754LSBSingle)
  Translation    = (UnsignedWord, UnsignedLSB2)
End_Group

Group = CoreByteOrder
@@ -92,6 +93,7 @@ Group = CoreByteOrder
  OutputPosition = (Group, Pixels)
  Translation    = (Lsb, IEEE754LSBSingle)
  Translation    = (Lsb, SignedLSB2)
  Translation    = (Lsb, UnsignedLSB2)
End_Group

Group = CoreBase
+13 −1
Original line number Diff line number Diff line
@@ -36,6 +36,16 @@ namespace Isis {
  void tgocassis2isis(UserInterface &ui) {
    FileName xmlFileName = ui.GetFileName("FROM");

    if (!xmlFileName.removeExtension().addExtension("dat").fileExists() && !xmlFileName.removeExtension().addExtension("img").fileExists()) {
        QString msg = "Cannot find image file for [" + xmlFileName.name() + "]. Confirm that the "
        ".dat or .img file for this XML exists and is located in the same directory.";
      throw IException(IException::User, msg, _FILEINFO_);
    }
    if(xmlFileName.name().contains("cas_raw_sc")){
        QString msg = "tgocassis2isis is unable to process cas_raw_sc data. Please use cas_cal_sc data instead.";
      throw IException(IException::User, msg, _FILEINFO_);
    }

    try {
      ProcessImport importer;
      translateCoreInfo(xmlFileName, importer);
@@ -59,9 +69,11 @@ namespace Isis {
      QFile xmlFile(xmlFileName.expanded());
      QDomDocument xmlDoc;
      xmlDoc.setContent(&xmlFile, true);
      // If any instances of "Optical_Filter" exist, use PSA .trn file
      // If any instances of "Optical_Filter" or "Mission_Area" exist, use PSA .trn file
      QString transExportFile;
      if (xmlDoc.elementsByTagName("Optical_Filter").size()){
        transExportFile = "TgoCassisExportedInstrument_PSA_Optical_Filter.trn";
      } else if (xmlDoc.elementsByTagName("Mission_Area").size()) {
        transExportFile = "TgoCassisExportedInstrument_PSA.trn";
      } else {
        transExportFile = "TgoCassisExportedInstrument.trn";