From 05037b9d6ccabc91f6698a0874731bb6b616c76c Mon Sep 17 00:00:00 2001 From: Stuart Sides Date: Thu, 5 Mar 2020 15:46:12 -0700 Subject: [PATCH] Moved Mex data files into source code (#3738) * Added translation files. * Renamed hrscSerialNumber0001.trn * Renamed Xfiles, updated app to point to /appdata/translations, and moved SN xfile to appdata. * Renamed files to be upper camel case. * Removed commented line Co-authored-by: Stuart Sides --- .../serialnumbers/MexHrscSerialNumber.trn | 42 +++++++ .../src/mex/apps/hrsc2isis/MexHrscArchive.trn | 62 ++++++++++ .../src/mex/apps/hrsc2isis/MexHrscBandBin.trn | 40 ++++++ .../mex/apps/hrsc2isis/MexHrscInstrument.trn | 117 ++++++++++++++++++ isis/src/mex/apps/hrsc2isis/main.cpp | 9 +- 5 files changed, 265 insertions(+), 5 deletions(-) create mode 100644 isis/appdata/serialnumbers/MexHrscSerialNumber.trn create mode 100644 isis/src/mex/apps/hrsc2isis/MexHrscArchive.trn create mode 100644 isis/src/mex/apps/hrsc2isis/MexHrscBandBin.trn create mode 100644 isis/src/mex/apps/hrsc2isis/MexHrscInstrument.trn diff --git a/isis/appdata/serialnumbers/MexHrscSerialNumber.trn b/isis/appdata/serialnumbers/MexHrscSerialNumber.trn new file mode 100644 index 0000000000..712e82c239 --- /dev/null +++ b/isis/appdata/serialnumbers/MexHrscSerialNumber.trn @@ -0,0 +1,42 @@ +Group = Keyword1 + Auto + InputKey = SpacecraftName + InputGroup = "IsisCube,Instrument" + InputPosition = (IsisCube, Instrument) + OutputName = Keyword1 + OutputPosition = (Group, SerialNumberKeywords) + Translation = (MEX, "MARS EXPRESS") + Translation = (MEX, MARS_EXPRESS) + Translation = (*, *) +End_Group + +Group = Keyword2 + Auto + InputKey = SpacecraftClockStartCount + InputGroup = "IsisCube,Instrument" + InputPosition = (IsisCube, Instrument) + OutputName = Keyword2 + OutputPosition = (Group, SerialNumberKeywords) + Translation = (*, *) +End_Group + +Group = Keyword3 + Auto + InputKey = InstrumentId + InputGroup = "IsisCube,Instrument" + InputPosition = (IsisCube, Instrument) + OutputName = Keyword3 + OutputPosition = (Group, SerialNumberKeywords) + Translation = (*, *) +End_Group + +Group = Keyword4 + Auto + InputKey = DetectorId + InputGroup = "IsisCube,Archive" + InputPosition = (IsisCube, Archive) + OutputName = Keyword4 + OutputPosition = (Group, SerialNumberKeywords) + Translation = (*, *) +End_Group +End diff --git a/isis/src/mex/apps/hrsc2isis/MexHrscArchive.trn b/isis/src/mex/apps/hrsc2isis/MexHrscArchive.trn new file mode 100644 index 0000000000..892406a68e --- /dev/null +++ b/isis/src/mex/apps/hrsc2isis/MexHrscArchive.trn @@ -0,0 +1,62 @@ +# +# The group names listed here are the native names used by +# applications to get the foreign names and values +# +# There is only one level of groups the groups are not +# allowed to be nested +# +# The Group names can NOT be repeated. +# +# InputGroup is a comma delimited list of objects and/or +# groups in the foreign label. Traversing this list will +# lead to the correct level to find the foreign keyword. +# +# InputKey is the keyword within the group which holds +# the information. +# +# InputDefault is the value used if there is no value for +# the keyword +# +# Translation is the native and corresponding foreign values. +# Translation may be repeated as needed. +# +Group = DataSetId + Auto + InputKey = DATA_SET_ID + OutputName = DataSetId + OutputPosition = (Group, Archive) + Translation = (*, *) +End_Group + +Group = DetectorId + Auto + InputKey = DETECTOR_ID + OutputName = DetectorId + OutputPosition = (Group, Archive) + Translation = (*, *) +End_Group + +Group = EventType + Auto + InputKey = EVENT_TYPE + OutputName = EventType + OutputPosition = (Group, Archive) + Translation = (*, *) +End_Group + +Group = OrbitNumber + Auto + InputKey = ORBIT_NUMBER + OutputName = OrbitNumber + OutputPosition = (Group, Archive) + Translation = (*, *) +End_Group + +Group = ProductId + Auto + InputKey = PRODUCT_ID + OutputName = ProductId + OutputPosition = (Group, Archive) + Translation = (*, *) +End_Group +End diff --git a/isis/src/mex/apps/hrsc2isis/MexHrscBandBin.trn b/isis/src/mex/apps/hrsc2isis/MexHrscBandBin.trn new file mode 100644 index 0000000000..2a9de3010c --- /dev/null +++ b/isis/src/mex/apps/hrsc2isis/MexHrscBandBin.trn @@ -0,0 +1,40 @@ +# +# The group names listed here are the native names used by +# applications to get the foreign names and values +# +# There is only one level of groups the groups are not +# allowed to be nested +# +# The Group names can NOT be repeated. +# +# InputGroup is a comma delimited list of objects and/or +# groups in the foreign label. Traversing this list will +# lead to the correct level to find the foreign keyword. +# +# InputKey is the keyword within the group which holds +# the information. +# +# InputDefault is the value used if there is no value for +# the keyword +# +# Translation is the native and corresponding foreign values. +# Translation may be repeated as needed. +# +Group = FilterWidth + Auto + InputKey = BANDWIDTH + OutputName = Width + OutputPosition = (Group, BandBin) + Translation = (*, *) + Translation = ("--- Illegal Value ---", *) +End_Group + +Group = FilterCenter + Auto + InputKey = CENTER_FILTER_WAVELENGTH + OutputName = Center + OutputPosition = (Group, BandBin) + Translation = (*, *) + Translation = ("--- Illegal Value ---", *) +End_Group +End diff --git a/isis/src/mex/apps/hrsc2isis/MexHrscInstrument.trn b/isis/src/mex/apps/hrsc2isis/MexHrscInstrument.trn new file mode 100644 index 0000000000..8f2633f3fd --- /dev/null +++ b/isis/src/mex/apps/hrsc2isis/MexHrscInstrument.trn @@ -0,0 +1,117 @@ +# +# The group names listed here are the native names used by +# applications to get the foreign names and values +# +# There is only one level of groups the groups are not +# allowed to be nested +# +# The Group names can NOT be repeated. +# +# InputGroup is a comma delimited list of objects and/or +# groups in the foreign label. Traversing this list will +# lead to the correct level to find the foreign keyword. +# +# InputKey is the keyword within the group which holds +# the information. +# +# InputDefault is the value used if there is no value for +# the keyword +# +# Translation is the native and corresponding foreign values. +# Translation may be repeated as needed. +# +Group = SpacecraftName + Auto + InputKey = INSTRUMENT_HOST_NAME + InputDefault = UNKNOWN + OutputName = SpacecraftName + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = InstrumentId + Auto + InputKey = INSTRUMENT_ID + OutputName = InstrumentId + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = StartTime + Auto + InputKey = START_TIME + OutputName = StartTime + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = StopTime + Auto + InputKey = STOP_TIME + OutputName = StopTime + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = SpacecraftClockStartCount + Auto + InputKey = SPACECRAFT_CLOCK_START_COUNT + OutputName = SpacecraftClockStartCount + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = SpacecraftClockStopCount + Auto + InputKey = SPACECRAFT_CLOCK_STOP_COUNT + OutputName = SpacecraftClockStopCount + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = MissionPhaseName + Auto + InputKey = MISSION_PHASE_NAME + OutputName = MissionPhaseName + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = TargetName + Auto + InputKey = TARGET_NAME + OutputName = TargetName + OutputPosition = (Group, Instrument) + Translation = (Mars, MARS) + Translation = (Phobos, PHOBOS) + Translation = (Deimos, DEIMOS) + Translation = (Cal, CAL) +End_Group + +Group = FocalPlaneTemperature + Auto + Optional + InputKey = FOCAL_PLANE_TEMPERATURE + OutputName = FocalPlaneTemperature + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = LensTemperature + Auto + Optional + InputKey = LENS_TEMPERATURE + OutputName = LensTemperature + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group + +Group = InstrumentTemperature + Auto + Optional + InputKey = INSTRUMENT_TEMPERATURE + OutputName = InstrumentTemperature + OutputPosition = (Group, Instrument) + Translation = (*, *) +End_Group +End diff --git a/isis/src/mex/apps/hrsc2isis/main.cpp b/isis/src/mex/apps/hrsc2isis/main.cpp index 8e8eab9ea8..bff78f365e 100644 --- a/isis/src/mex/apps/hrsc2isis/main.cpp +++ b/isis/src/mex/apps/hrsc2isis/main.cpp @@ -234,11 +234,10 @@ void WriteOutput(Isis::Buffer &buf) { void TranslateHrscLabels(Pvl &inLabels, Pvl &outLabel) { // Get the directory where the MRO HiRISE translation tables are. - PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory")); - QString transDir = (QString) dataDir["Mex"] + "/translations/"; + QString transDir = "$ISISROOT/appdata/translations/"; // Translate the Instrument group - FileName transFile(transDir + "hrscInstrument.trn"); + FileName transFile(transDir + "MexHrscInstrument.trn"); PvlToPvlTranslationManager instrumentXlater(inLabels, transFile.expanded()); instrumentXlater.Auto(outLabel); @@ -259,12 +258,12 @@ void TranslateHrscLabels(Pvl &inLabels, Pvl &outLabel) { outLabel.findGroup("Instrument", Pvl::Traverse)["StopTime"] = stopTime; // Translate the BandBin group - transFile = transDir + "hrscBandBin.trn"; + transFile = transDir + "MexHrscBandBin.trn"; PvlToPvlTranslationManager bandBinXlater(inLabels, transFile.expanded()); bandBinXlater.Auto(outLabel); // Translate the Archive group - transFile = transDir + "hrscArchive.trn"; + transFile = transDir + "MexHrscArchive.trn"; PvlToPvlTranslationManager archiveXlater(inLabels, transFile.expanded()); archiveXlater.Auto(outLabel);