edsumm
Description
edsumm (Editor Summary) is an interactive utility designed to directly edit the header information of an OMG-HDCS merged data file. It provides a menu-driven interface allowing users to modify various fields within the OMG_HDCS_summary_header structure.
This tool is useful for correcting metadata errors, adjusting file parameters, or updating descriptive labels after data acquisition or processing.
Usage
edsumm <file> [-verbose] [-addtag]
Arguments
| Option | Description |
|---|---|
<file> | Required. The path to the OMG-HDCS merged file whose header is to be edited. |
-verbose | (Present in USAGE but not explicitly used in the provided code) Intended to provide more detailed output. |
-addtag | (Present in USAGE but not explicitly used in the provided code) Intended to add a tag. |
Interactive Menu
After launching, edsumm will enter an infinite loop, displaying the current header information and presenting a menu of fields that can be modified:
no records(summary.numProfiles)rows(JHChead.dy)tlat(JHChead.ymax)blat(JHChead.ymin)tlon(JHChead.xmin)blon(JHChead.xmax)xstep(JHChead.xstep)ystep(JHChead.ystep)datatype(JHChead.data_type)rgb_bw(JHChead.rgb_bw)projection(JHChead.projection)ellipsoid(JHChead.ellipsoid)proj_merid(JHChead.proj_merid)sun_elev(JHChead.sun_elev)sun_azi(JHChead.sun_azi)sun_exag(JHChead.sun_exag)view_elev(JHChead.view_elev)view_azi(JHChead.view_azi)view_exag(JHChead.view_exag)min_value(JHChead.min_value)max_value(JHChead.max_value)label_1(JHChead.label_1)label_2(JHChead.label_2)nothing(Exit)
The user enters a number corresponding to the field they wish to edit, then provides the new value. The tool updates the header and redisplays the menu.
How It Works
- File Opening: Opens the specified OMG-HDCS merged file for reading and writing (
r+). - Interactive Loop: Enters a
while (!done)loop:- Reads the current
OMG_HDCS_summary_headerfrom the file usingOMG_HDCS_read_summary. - Prints the current header contents to the console using
OMG_HDCS_write_summary(this function likely prints to stdout, not to the file, despite its name). - Presents a menu of editable fields.
- Prompts the user for a
choice. - Field Modification: Based on the user’s
choice:- If
choice == 1, it prompts for a newnumProfilesand updatessummary.numProfiles. - If
choice == 22orchoice == 23, it prompts for a new label string and updatesJHChead.label_1orJHChead.label_2respectively. - Note: In the provided code, only
choice == 1andchoice == 22/23are implemented to modify thesummaryorJHCheadfields. All other choices currently do nothing or only read user input without applying changes tosummary.
- If
- Write Changes: If a field is modified,
OMG_HDCS_dump_summary(infile, &summary)(orwrite_JHC_header(infile, JHChead)for labels) is called to write the updated header back to the file.
- Reads the current
- Exit: The loop terminates when the user chooses
0(nothing/exit). - Cleanup: Closes the input file.
Output Files
The input merged file (<file>) is modified in-place.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.array.h: ForJHC_headerstructure and functions.support.h: For general utility functions and error handling.
Notes
edsumm provides a direct interface for correcting metadata issues in OMG-HDCS merged files without needing to reprocess the entire dataset. This can be crucial for fixing corrupted headers or updating survey information. Users should be cautious when modifying header fields manually, as incorrect values can lead to data misinterpretation. The interactive menu could be expanded to allow editing of more fields.