refoOptech
Description
refoOptech is a utility designed to convert raw Optech ASCII data into the OMG-HDCS merged file format. It processes these ASCII files, extracts individual laser shots (zaps) with their geographic coordinates, depths, and other parameters, organizes them into scan lines (swaths), and then writes each scan line as a profile into separate OMG-HDCS merged files.
The tool handles different ASCII formats (-fmt), determines scan direction, and creates auxiliary navigation (.nav) and debug (.debug) files for each generated merged line.
Usage
refoOptech <infile> <outfile_prefix> [-fmt <val>] [-dont_break_lines] [-v]
Arguments
| Option | Description | |—|—| | <infile> | Required. The path to the input raw ASCII Optech data file. | | <outfile_prefix> | Required. The base name for the output files. The tool will generate multiple merged files (e.g., <outfile_prefix>_0000.merged), .nav files, and .debug files. | | -fmt <val> | Specifies the format of the input ASCII file. * 1: Standard format. * 2: A different format with julian date. * 3: Missing waveform file format (uses inter_shot_azi). | 1 | | -dont_break_lines | Prevents the tool from breaking continuous scan lines into multiple merged files based on time gaps or scan direction changes. | | -v | Enable verbose output. | |
Data Structures
optech_ascii_beam: A custom structure to hold parsed data for each LASer shot (zap), including geographic coordinates, depths, waveform parameters, and flightline information.
How It Works
- Initialization: Initializes various global variables, file handles, and structures for storing Optech data (
optech_ascii_beam). - Argument Parsing: Parses command-line arguments to set input/output filenames, ASCII format (
-fmt), and flags for line breaking. - File Opening: Opens the input ASCII file for reading.
- Merged File Structure Initialization: Initializes an
OMG_HDCS_summary_headerstructure with default values fortoolType(Optech_Laser),fileVersion, and other parameters. - Record Processing Loop: Reads the ASCII input file line by line:
- Parsing: Parses the current line of the ASCII file into an
optech_ascii_beamstructure (ozap[zaps_in_scan]) based on the specified-fmt. - Scan Line Segmentation:
- Scan Direction Detection: It determines the scan direction (
SCAN_PLUSorSCAN_MINUS) by comparingozap[zaps_in_scan].scan_azimuth(forfmt 1and2) orinter_shot_azi(forfmt 3) with the previous scan’s azimuth. - Scan Line Break: When a change in scan direction is detected, or a time gap exceeds 10 seconds (if
dont_break_linesis not set), it signals the end of a scan line and triggers the processing of the accumulatedzaps_in_scanas a single scan line/swath.
- Scan Direction Detection: It determines the scan direction (
- Scan Line Processing (
calculate_scan_pseudo_swath,dump_swath):calculate_scan_pseudo_swath():- Calculates the geographic center (lat/lon) of the accumulated zaps for the current scan.
- Performs a least-squares fit on the projected X/Y coordinates to determine the
scan_headingof the scan line. - Transforms the geographic coordinates into across-track (
across) and along-track (along) offsets relative to the scan line’s heading.
dump_swath():- Initializes
OMG_HDCS_profile_headerwith scan line information (timestamp, lat/lon offsets, heading, heave, pitch, roll, tide, etc.). - Populates
OMG_HDCS_beamstructures for each zap in the scan line, converting extracted Optech ASCII parameters into beam fields (depth, across, along, scan_azimuth, wave_height, Intensity). - Writes the
summary,profile, andbeamsdata into a new merged file (e.g.,<outfile_prefix>_0000.merged) and a corresponding.navfile. It also writes to a.debugfile for debugging purposes.
- Initializes
- Parsing: Parses the current line of the ASCII file into an
- Cleanup: Closes all open files.
Output Files
- Multiple merged files (e.g.,
<outfile_prefix>_0000.merged), one for each scan line. - Corresponding
.navfiles for navigation. - Corresponding
.debugfiles for debugging information.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.j_proj.h: For coordinate projection functions.jcu_nav.h: For JCU NAV data structures.
Notes
refoOptech is a crucial tool for integrating raw Optech ASCII data into the OMG-HDCS processing pipeline. It handles the complex conversion from ASCII point data to multibeam profiles, including managing scan line segmentation and various data formats. The output merged files can then be processed by other OMG tools for DTM generation, quality control, and visualization. The tool creates multiple output files based on scan lines, preserving the integrity of individual flight lines.