Skip to content

Commit

Permalink
Moved Mex data files into source code (#3738)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
scsides authored Mar 5, 2020
1 parent 1ddeaf4 commit 05037b9
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 5 deletions.
42 changes: 42 additions & 0 deletions isis/appdata/serialnumbers/MexHrscSerialNumber.trn
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions isis/src/mex/apps/hrsc2isis/MexHrscArchive.trn
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions isis/src/mex/apps/hrsc2isis/MexHrscBandBin.trn
Original file line number Diff line number Diff line change
@@ -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
117 changes: 117 additions & 0 deletions isis/src/mex/apps/hrsc2isis/MexHrscInstrument.trn
Original file line number Diff line number Diff line change
@@ -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
9 changes: 4 additions & 5 deletions isis/src/mex/apps/hrsc2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 05037b9

Please sign in to comment.