pyorc.CrossSection#

class pyorc.CrossSection(camera_config, cross_section: Union[GeoDataFrame, List[List]])[source]#

Water Level functionality.

Initialize a cross-section representation.

The object is geographically aware through the camera configuration. If a GeoDataFrame is supplied as cross_section input, CRS consistency between the cross-section and camera configuration is guaranteed.

Parameters:
  • camera_config (object) – Defines the camera configuration, including potential CRS used for processing geographic data consistency.

  • cross_section (GeoDataFrame or list of lists) – Cross-sectional data representing coordinate information. Can either be a GeoDataFrame with CRS potentially set or a list-of-lists where each inner list contains [x, y, z] coordinates.

x#

Represents the x-coordinates of the cross-section. For GeoDataFrame input, these are converted into the CRS of the camera configuration if applicable.

Type:

list of float

y#

Represents the y-coordinates of the cross-section. For GeoDataFrame input, these are converted into the CRS of the camera configuration if applicable.

Type:

list of float

z#

Represents the z-coordinates of the cross-section.

Type:

list of float

s#

Represents the horizontal cumulative distances calculated between consecutive points in the cross-section, used primarily for spatial interpolation.

Type:

numpy.ndarray

l#

Represents the cumulative spatial coordinates, tracking both horizontal and vertical distances over the cross-section, from the left-most to the right-most section. used primarily for spatial interpolation and needed where pure horizontal or vertical lines are experienced.

Type:

numpy.ndarray

camera_config#

Associated camera configuration object indicating CRS and related configuration applied to handle projection and compatibility with cross-section data.

Type:

object

Raises:
  • ValueError – Raised if the CRS is defined for only one of camera_config or cross_section, as CRS for both or neither must be specified for consistency.

  • TypeError – Raised if cross_section is neither of type GeoDataFrame nor a list of lists structure.

__init__(camera_config, cross_section: Union[GeoDataFrame, List[List]])[source]#

Initialize a cross-section representation.

The object is geographically aware through the camera configuration. If a GeoDataFrame is supplied as cross_section input, CRS consistency between the cross-section and camera configuration is guaranteed.

Parameters:
  • camera_config (object) – Defines the camera configuration, including potential CRS used for processing geographic data consistency.

  • cross_section (GeoDataFrame or list of lists) – Cross-sectional data representing coordinate information. Can either be a GeoDataFrame with CRS potentially set or a list-of-lists where each inner list contains [x, y, z] coordinates.

x#

Represents the x-coordinates of the cross-section. For GeoDataFrame input, these are converted into the CRS of the camera configuration if applicable.

Type:

list of float

y#

Represents the y-coordinates of the cross-section. For GeoDataFrame input, these are converted into the CRS of the camera configuration if applicable.

Type:

list of float

z#

Represents the z-coordinates of the cross-section.

Type:

list of float

s#

Represents the horizontal cumulative distances calculated between consecutive points in the cross-section, used primarily for spatial interpolation.

Type:

numpy.ndarray

l#

Represents the cumulative spatial coordinates, tracking both horizontal and vertical distances over the cross-section, from the left-most to the right-most section. used primarily for spatial interpolation and needed where pure horizontal or vertical lines are experienced.

Type:

numpy.ndarray

camera_config#

Associated camera configuration object indicating CRS and related configuration applied to handle projection and compatibility with cross-section data.

Type:

object

Raises:
  • ValueError – Raised if the CRS is defined for only one of camera_config or cross_section, as CRS for both or neither must be specified for consistency.

  • TypeError – Raised if cross_section is neither of type GeoDataFrame nor a list of lists structure.

Methods

__init__(camera_config, cross_section)

Initialize a cross-section representation.

detect_water_level(img[, bank, bin_size, ...])

Detect water level optically from provided image.

get_bottom_surface([length, offset, camera, ...])

Retrieve a bottom surface polygon for the entire cross section, expanded over a length.

get_cs_waterlevel(h[, sz])

Retrieve LineString of water surface at cross-section at a given water level.

get_csl_line([h, l, length, offset, camera, ...])

Retrieve waterlines over the cross-section, perpendicular to the orientation of the cross-section.

get_csl_point([h, l, camera, swap_y_coords])

Retrieve list of points, where cross-section (cs) touches the land (l).

get_csl_pol([h, l, length, padding, offset, ...])

Get horizontal polygon from cross-section land-line towards water or towards land.

get_histogram_score(x, img[, bin_size, ...])

Retrieve a histogram score for a given l-value.

get_line_of_interest([bank])

Retrieve the points of interest within the cross-section for water level detection.

get_planar_surface(h[, length, offset, ...])

Retrieve a planar water surface for a given water level, as a geometry.Polygon.

get_wetted_surface(h[, camera, swap_y_coords])

Retrieve a wetted surface for a given water level, as a geometry.Polygon.

get_wetted_surface_sz(h)

Retrieve a wetted surface perpendicular to flow direction (SZ) for a water level, as a geometry.Polygon.

plot([h, length, offset, camera, ax, ...])

Plot the cross-section situation.

plot_bottom_surface([length, offset, ...])

Plot the bottom surface for a given water level.

plot_cs([ax, camera, swap_y_coords])

Plot the cross section.

plot_planar_surface(h[, length, offset, ...])

Plot the planar surface for a given water level.

plot_water_level(h[, length, offset, ...])

Plot the water level at user provided value h.

plot_wetted_surface(h[, camera, ...])

Plot the wetted surface for a given water level.

Attributes

cs_angle

Average angle orientation that cross-section makes in geographical space.

cs_linestring

Return cross-section as shapely.geometry.Linestring.

cs_linestring_sz

Return cross-section perpendicular to flow direction (SZ) as shapely.geometry.Linestring.

cs_points

Return cross-section as list of shapely.geometry.Point.

cs_points_sz

Return cross-section perpendicular to flow direction (SZ) as list of shapely.geometry.Point.

idx_closest_point

Determine index of point in cross-section, closest to the camera.

idx_farthest_point

Determine index of point in cross-section, farthest from the camera.

interp_d

Linear interpolation function for distances (d) to lens, using l as input.

interp_s_from_l

Linear interpolation function for s-coordinates, from left to right bank, using l as input.

interp_x

Linear interpolation function for x-coordinates, using l as input.

interp_x_from_s

Linear interpolation function for x-coordinates, using s as input.

interp_y

Linear interpolation function for y-coordinates, using l as input.

interp_y_from_s

Linear interpolation function for y-coordinates, using s as input..

interp_z

Linear interpolation function for z-coordinates, using l as input.

interp_z_from_s

Linear interpolation function for z-coordinates, using s as input..