plotAng2

Description

plotAng2 is a specialized plotting utility designed to visualize angular response data from multibeam sonars. It reads ASCII data files, typically generated by tools like jackTool or swathed, which contain angle and corresponding backscatter strength values. The tool then generates a PostScript plot of these angular responses.

It allows for plotting multiple datasets, defining custom plot ranges, and provides basic visualization for comparing angular response curves.

Usage

plotAng2 <infile(s)> [-outfile <filename.meta>] [-size <dx> <dy>] [-yrange <min> <max>] [OPTIONS]

Arguments

Option Description  
<infile(s)> Required. One or more paths to input ASCII files containing angular response data.  
-outfile <filename.meta> Specifies the output PostScript metafile name. plot.meta
-size <dx> <dy> Specifies the total plot size in centimeters (X and Y dimensions). 15.0 22.0
-yrange <min> <max> Sets the Y-axis range (backscatter strength in dB). -50.0 to 0.0

File Format Selection (Choose one)

| Option | Description | |—|—| | -jackTool | Interprets the input file as being from jackTool. | | -swathed | Interprets the input file as being from swathed. | | -delayed | (Present in USAGE but not implemented). |

Plot Customization

| Option | Description | |—|—| | -together | Plots multiple datasets on the same graph, overlapping. | | -sparse | (Not fully implemented) Intended for sparse plotting. | | -tit1 <string> / -tit2 <string> | Sets titles for the plot. | | -v | Enable verbose output (not explicitly used in provided code). | |

Input File Formats

  • JACKTOOL format:
    • 8 header lines (read into Stuff[]).
    • Then, for each of NOVALS points: angle both rough (double, double, double).
      • angle: Angle in degrees.
      • both: Combined angular response.
      • rough: Roughness.
  • SWATHED format:
    • Various header lines (skipped by fscanf).
    • Then, for each of 90 points: angle both (double, double). This is read for both positive and negative angles.

How It Works

  1. Initialization: Parses command-line arguments to set plotting options, file formats, and ranges. Initializes a plotlib PostScript output (plot.meta).
  2. Plot Area Setup: Sets up the overall plot dimensions (xlength, ylength, xoff, yoff). Draws the main plot border.
  3. Title and Labels: If titles are provided, they are added to the plot.
  4. File Reading Loop: Loops through each input file specified:
    • Opens the input ASCII file.
    • Data Loading: Based on file_format:
      • If JACKTOOL: Reads 8 header lines and then NOVALS (100) data points, each with angle, both, and rough. Converts angle to relative to vertical (-90 to 90).
      • If SWATHED: Reads several header lines, then 90 data points for positive angles (angle, both), and then mirrors them for negative angles.
    • Closes the input file.
  5. Plot Generation (using plotlib library):
    • Draws the main plot border.
    • If file_format == JACKTOOL and not sparse_flag, it prints header information to the plot.
    • Axis and Labels: Draws X and Y axes with labels for “Backscatter Strength (dB)” and “Grazing Angle (degrees)”.
    • Data Plotting:
      • Iterates through the NOVALS data points.
      • If together_flag is not set, it plots all data from the current file. If together_flag is set, it only plots positive angles.
      • Plots xval (angle) vs. yval (backscatter strength), drawing lines between valid data points.
      • For SWATHED format, it plots points as diamonds.
      • For JACKTOOL format, it also plots rough data if applicable.
  6. Cleanup: Calls plot_close to finalize the PostScript output.

Output Files

  • <outfile.meta>: A PostScript metafile (.meta) containing plots of angular response curves.

Dependencies

  • plotlib.h: For plotlib functions.
  • support.h: For general utility functions.
  • math.h: For mathematical functions.

Notes

This tool is effective for comparing the angular response of different sonar systems or of the same system under different environmental conditions. The ability to plot multiple curves on a single graph allows for easy visual comparison of different datasets. The --delayed option is present in usage but not implemented.