7k2orientation
Description
7k2orientation is a utility designed to extract vessel orientation data (roll, pitch, heading, heave) from Reson 7k (.s7k) files and convert it into the OMG-HDCS attitude file format. It processes specific 7k records: 7k_1012_Orientation (roll, pitch, heave), 7k_1013_Heading (heading), and 7k_1016_Attitude (roll, pitch, heading, heave time series).
This tool is essential for providing motion and heading data for various downstream processing steps within the OMG toolkit, such as motion compensation and data georeferencing.
Usage
7k2orientation -s7k <input_name> -omg <omg_file_prefix> [-v] [-debug]
Arguments
| Option | Description | |—|—| | -s7k <input_name> | Required. Path to the input Reson 7k .s7k file. | | -omg <omg_file_prefix> | Required. Prefix for the output OMG-HDCS files. The tool will generate: * <omg_file_prefix>.orientation_1012 (if 7k_1012 records exist): OMG-HDCS attitude file for roll, pitch, heave. * <omg_file_prefix>.heading (if 7k_1013 records exist): OMG-HDCS attitude file for heading. * <omg_file_prefix>.orientation_1016 (if 7k_1016 records exist): OMG-HDCS attitude file for roll, pitch, heading, heave time series. | | -v | Enable verbose output. | | -debug | Enable debug output. |
How It Works
- Initialization: Parses command-line arguments to get input
.s7kfilename and output prefix. Initializes Reson 7k data structures (Reson_7K_Index,Reson_7K_DRF,Reson_7K_1012_Orientation,Reson_7K_1013_Heading,Reson_7K_1016_Attitude) and OMG-HDCS attitude structures (OMG_HDCS_summary_attitude,OMG_HDCS_attitude). - 7k Indexing: Calls
build_Reson_7K_Index()(an external function) to create an index of all packet types within the.s7kfile. - File Opening: Opens the input
.s7kfile for reading. - Process 7k_1012_Orientation Records (Roll, Pitch, Heave):
- If
7k_1012_Orientationrecords are found in the index:- Creates an output file named
<omg_file_prefix>.orientation_1012. - Initializes
OMG_HDCS_summary_attitudefor this file. - Reads the first 7k_1012 record to determine
refTimefor the summary. - Writes the summary to the output file.
- Iterates through each 7k_1012 record:
- Seeks to the record’s file offset, reads DRF and
Reson_7K_1012_Orientationdata. - Calls
convert_7K_orientation()(an external function) to convert 7k orientation data toOMG_HDCS_attitude. - Writes the
OMG_HDCS_attituderecord to the output file.
- Seeks to the record’s file offset, reads DRF and
- Creates an output file named
- If
- Process 7k_1013_Heading Records (Heading):
- If
7k_1013_Headingrecords are found in the index:- Creates an output file named
<omg_file_prefix>.heading. - Initializes
OMG_HDCS_summary_attitudefor this file. - Reads the first 7k_1013 record to determine
refTimefor the summary. - Writes the summary to the output file.
- Iterates through each 7k_1013 record:
- Seeks to the record’s file offset, reads DRF and
Reson_7K_1013_Headingdata. - Calls
convert_7K_heading()(an external function) to convert 7k heading data toOMG_HDCS_attitude. - Writes the
OMG_HDCS_attituderecord to the output file.
- Seeks to the record’s file offset, reads DRF and
- Creates an output file named
- If
- Process 7k_1016_Attitude Records (Roll, Pitch, Heading, Heave time series):
- If
7k_1016_Attituderecords are found in the index:- Creates an output file named
<omg_file_prefix>.orientation_1016. - Initializes
OMG_HDCS_summary_attitudefor this file. - Reads the first 7k_1016 record to determine
refTimefor the summary. - Writes the summary to the output file.
- Iterates through each 7k_1016 record:
- Reads DRF and
Reson_7K_1016_Attitudedata. - For each sample within the
7k_1016_Attituderecord (which can contain multiple samples per record):- Calls
convert_7K_attitude()(an external function) to convert 7k attitude sample data toOMG_HDCS_attitude. - Writes the
OMG_HDCS_attituderecord to the output file.
- Calls
- Reads DRF and
- Creates an output file named
- If
- Cleanup: Closes all open files.
Output Files
<omg_file_prefix>.orientation_1012: Binary attitude file (roll, pitch, heave) if7k_1012records exist.<omg_file_prefix>.heading: Binary attitude file (heading) if7k_1013records exist.<omg_file_prefix>.orientation_1016: Binary attitude file (roll, pitch, heading, heave time series) if7k_1016records exist.