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] - 1data points:xval yval(float, float).
How It Works
- Initialization: Parses command-line arguments to set input/output filenames, plot size, and
scalebar_flag. - File Opening: Opens the input ASCII file (
-infile). If not inscalebar_flagmode, it also opens an auxiliary.coordsfile for outputting geographic coordinates. - Data Loading (
-scalebarvs. Profiles):- If
scalebar_flagis not set:- Reads all profile metadata and data points from the input file.
- Calculates
totdist(total cumulative distance along all profiles). - Sets
xminto0andxmaxtototdist.
- If
scalebar_flagis set:- Sets
dx = 1.0,dy = 5.0,xmin = 0,xmax = 2.0. This configures for a minimal plot space for the scale bar.
- Sets
- If
- Plot Setup: Initializes the
plotlibPostScript output (plot.meta). Sets up the overall plot dimensions (xlength,ylength,xoff). - Interactive Y-Range: Prompts the user for Y-axis range (
ymin,ymax). - Plot Frame: Draws the main plot border.
- 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
jwithin the profile:- Calculates
xpos(cumulative distance) andypos(profile value). - If
yposis within the specified Y-range (orshowspikesis active), it plots the data point as a line segment.
- Calculates
- 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 (ifscalebar_flagis not set).
Dependencies
plotlib.h: Forplotlibfunctions.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.