plotProf

Description

plotProf is a specialized plotting utility designed to visualize concatenated profiles, typically generated by tools like jview or swatheditor. It takes ASCII input containing multiple profiles (each with X/Y data) and plots them sequentially along a simulated trackline.

The tool can display long profiles, indicate geographic coordinates at profile boundaries, and is particularly useful for visualizing along-track bathymetric sections or other continuous measurements. It supports both standard profile plotting and a “scalebar” mode.

Usage

plotProf -infile <file1> [-outfile <filename.meta>] [-size <dx> <dy>] [-xrange <min> <max>] [-yrange <min> <max>] [-scalebar] [-showspikes]

Arguments

Option Description  
-infile <file1> Required. Specifies an input ASCII file containing concatenated profile data.  
-outfile <filename.meta> Specifies the output PostScript metafile name. plot.meta
-size <dx> <dy> Specifies the plot size in centimeters. 100.0 15.0
-xrange <min> <max> Sets the X-axis range (along-track distance). Auto-determined.
-yrange <min> <max> Required. Sets the Y-axis range for the profile values.  
-scalebar Changes the plotting mode to only display a scalebar with geographic information.  
-showspikes (Present in USAGE but not fully implemented in provided code) Intended to show spikes in the data.  

Input File Format (ASCII)

The input ASCII file for concatenated profiles is expected to contain:

  • For each profile noprof:
    • north[0][noprof] east[0][noprof] (double, double): Start Northing and Easting.
    • lat[0][noprof] lon[0][noprof] (double, double): Start Latitude and Longitude.
    • latdeg[0][noprof] latmin[0][noprof] (int, float): Start Latitude in degrees and minutes.
    • londeg[0][noprof] lonmin[0][noprof] (int, float): Start Longitude in degrees and minutes.
    • north[1][noprof] east[1][noprof] (double, double): End Northing and Easting.
    • lat[1][noprof] lon[1][noprof] (double, double): End Latitude and Longitude.
    • latdeg[1][noprof] latmin[1][noprof] (int, float): End Latitude in degrees and minutes.
    • londeg[1][noprof] lonmin[1][noprof] (int, float): End Longitude in degrees and minutes.
    • nopts[noprof] (int): Number of points in this profile.
    • interval[noprof] (float): Distance interval between points in this profile.
    • Then, for nopts[noprof] - 1 data points: xval yval (float, float).

How It Works

  1. Initialization: Parses command-line arguments to set input/output filenames, plot size, and scalebar_flag.
  2. File Opening: Opens the input ASCII file (-infile). If not in scalebar_flag mode, it also opens an auxiliary .coords file for outputting geographic coordinates.
  3. Data Loading (-scalebar vs. Profiles):
    • If scalebar_flag is not set:
      • Reads all profile metadata and data points from the input file.
      • Calculates totdist (total cumulative distance along all profiles).
      • Sets xmin to 0 and xmax to totdist.
    • If scalebar_flag is set:
      • Sets dx = 1.0, dy = 5.0, xmin = 0, xmax = 2.0. This configures for a minimal plot space for the scale bar.
  4. Plot Setup: Initializes the plotlib PostScript output (plot.meta). Sets up the overall plot dimensions (xlength, ylength, xoff).
  5. Interactive Y-Range: Prompts the user for Y-axis range (ymin, ymax).
  6. Plot Frame: Draws the main plot border.
  7. Profile Plotting (!scalebar_flag):
    • Adds a title indicating the section name and total length.
    • Draws Y-axis grid lines and labels.
    • For each profile k:
      • Draws vertical lines marking the start and end of each profile.
      • Adds geographic coordinate annotations (Lat/Lon, Northing/Easting) at profile boundaries.
      • Iterates through each data point j within the profile:
        • Calculates xpos (cumulative distance) and ypos (profile value).
        • If ypos is within the specified Y-range (or showspikes is active), it plots the data point as a line segment.
  8. Cleanup: Closes all open files.

Output Files

  • <outfile.meta>: A PostScript metafile (.meta) containing the concatenated profile plot or a scalebar.
  • <infile_prefix>.coords: An ASCII file containing start and end geographic coordinates for each profile (if scalebar_flag is not set).

Dependencies

  • plotlib.h: For plotlib functions.
  • support.h: For general utility functions.
  • j_proj.h: For coordinate projection functions.

Notes

plotProf is a powerful tool for visualizing long bathymetric profiles or other linear data extracted from gridded datasets. The ability to concatenate multiple profiles and annotate them with geographic coordinates makes it suitable for detailed spatial analysis and presentation. The “scalebar” mode provides a convenient way to generate simple scale references for maps. The --showspikes option is present in usage but not implemented.