RCAIDE.Library.Plots.Topography.plot_elevation_contours
plot_elevation_contours#
- plot_elevation_contours(topography_file, number_of_latitudinal_points=100, number_of_longitudinal_points=100, use_lat_long_coordinates=True, save_figure=False, show_legend=True, save_filename='Elevation_Contours', file_type='.png', width=11, height=7)[source]#
Creates a contour plot visualization of terrain elevation data.
- Parameters:
topography_file (str) –
- Path to file containing topographical data in format:
Column 1: Longitude [degrees]
Column 2: Latitude [degrees]
Column 3: Elevation [meters]
number_of_latitudinal_points (int, optional) – Number of interpolation points in latitude direction (default: 100)
number_of_longitudinal_points (int, optional) – Number of interpolation points in longitude direction (default: 100)
use_lat_long_coordinates (bool, optional) – If True, plot in lat/long coordinates If False, plot in distance coordinates (default: True)
save_figure (bool, optional) – Flag for saving the figure (default: False)
show_legend (bool, optional) – Flag to display elevation legend (default: True)
save_filename (str, optional) – Name of file for saved figure (default: “Elevation_Contours”)
file_type (str, optional) – File extension for saved figure (default: “.png”)
width (float, optional) – Figure width in inches (default: 11)
height (float, optional) – Figure height in inches (default: 7)
- Returns:
fig
- Return type:
matplotlib.figure.Figure
Notes
Creates visualization showing terrain elevation contours, color-coded elevation levels, geographic or distance-based coordinates, and a custom terrain-specific colormap.
When use_lat_long_coordinates is True the X-axis is Longitude [degrees] and the Y-axis is Latitude [degrees]. When use_lat_long_coordinates is False the X-axis is Longitudinal Distance [nmi] and the Y-axis is Latitudinal Distance [nmi].
- Major Assumptions
Earth is approximated as spherical for distance calculations
Linear interpolation between data points
Sea level reference at 0 elevation
Positive elevations above sea level
Negative elevations below sea level
Definitions
- ‘Elevation’
Height above sea level
- ‘Contour’
Line of constant elevation
- ‘Great Circle Distance’
Shortest distance between points on sphere
- ‘Terrain’
Surface topography of land
See also
RCAIDE.Framework.Analyses.Geodesics.Geodesics.Calculate_Distance
Distance calculation
- class FixPointNormalize(vmin=None, vmax=None, sealevel=0, col_val=0.21875, clip=False)[source]#
Bases:
Normalize
Inspired by https://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib Subclassing Normalize to obtain a colormap with a fixpoint somewhere in the middle of the colormap. This may be useful for a terrain map, to set the “sea level” to a color in the blue/turquise range.
- __init__(vmin=None, vmax=None, sealevel=0, col_val=0.21875, clip=False)[source]#
- Parameters:
vmin (float or None) – Values within the range
[vmin, vmax]
from the input data will be linearly mapped to[0, 1]
. If either vmin or vmax is not provided, they default to the minimum and maximum values of the input, respectively.vmax (float or None) – Values within the range
[vmin, vmax]
from the input data will be linearly mapped to[0, 1]
. If either vmin or vmax is not provided, they default to the minimum and maximum values of the input, respectively.clip (bool, default: False) –
Determines the behavior for mapping values outside the range
[vmin, vmax]
.If clipping is off, values outside the range
[vmin, vmax]
are also transformed, resulting in values outside[0, 1]
. This behavior is usually desirable, as colormaps can mark these under and over values with specific colors.If clipping is on, values below vmin are mapped to 0 and values above vmax are mapped to 1. Such values become indistinguishable from regular boundary values, which may cause misinterpretation of the data.
Notes
If
vmin == vmax
, input data will be mapped to 0.