Class Tools

core.Tools.Convert_sections(XS_shp)[source]

convert imported section if needed

:param XS_shp : imported section :type XS_shp: GeoDataFrame :return: - XS in the right format (MultiLineString)

core.Tools.Verify_type_geometry(geometry)[source]

check format of geometry for import or dig channel

:param geometry : input geometry to check :type geometry: shapely geometry :return: - list of LineString (list)

core.Tools.X_abscissa(line)[source]

compute distance between a line and a point on the X,Y plane

Parameters:

line (LineString) – Linestring for which abscissa is computed

Returns:

curvilinear abscissa (List)

core.Tools.angle_from_line(line_int, line_temp, neighbours, ii)[source]

Compute angle between line_int and line_temp

:param line_int : line with new section center as point :type line_int: LineString :param line_temp : line with original point but between 2 sections :type line_temp: LineString :param neighbours : list of nearest point of line_int to point of line_temp :type neighbours: list :param ii : index of the nearest point of intersection between the 2 lines :type neighbours: int

core.Tools.compute_distance(coords)[source]

compute curvilinear distance with list of coordinate

Parameters:

coord – list of coord (tuple (x,y,z)

core.Tools.distance_along_line(line1, line2)[source]

Give the distance of point in line2 considering curvilinear distance along line1.

Parameters:
  • line1 (LineString) – reference LineString

  • line2 (LineString) – Line containing point to evaluate

Returns:

  • list of distance for all point in line 2 (list)

core.Tools.export_as_csv_for_HECRASgeometry(BV, outfile_path)[source]

export xs in a HEC RAS format

Parameters:
  • BV (ModelCatchment) – Watershed

  • outfile_path (str) – folder in which export

core.Tools.export_result_as_csv(BV, param)[source]

export result in ascii format

Parameters:
core.Tools.find_LCA_triangle(X, section)[source]

compare the measured section with a double triangular section.

Parameters:
  • X (list) – parameter to optimize

  • section (Section Class) – section with z data

Returns:

  • the residual between double triangle section and real section

core.Tools.find_pixels_in_neighborhood(image, DEM_X, DEM_Y, X, Y, window_size)[source]

Find point at the vicinity of point (X,Y)

Parameters:
  • image (numpy.ndarray) – Raster of searching value

  • DEM_X (numpy.ndarray) – grid of X position (np.meshgrid)

  • DEM_Y (numpy.ndarray) – grid of Y position (np.meshgrid)

  • X (float) – X position of the reference point

  • Y (float) – Y position of the reference point

  • window_size (int) – number of pixel for the search area

Returns:

TODO

core.Tools.map_model(BV)[source]

2D mapping of DEM and cross section. Value of water surface or width can be vizualise as colored point.

Parameters:

BV (ModelCatchment) – Watershed

core.Tools.plot_Morpho(reach, type_comp)[source]

plot of the inline profile of elevation and water surface (WS variable of the section object) for the entire reach

Parameters:
  • reach (str) – Reach

  • type_comp – ntype of computation to plot

core.Tools.plot_longProfile(reach)[source]

plot of the inline profile of elevation and water surface (WS variable of the section object) for the entire reach

Parameters:

reach (Reach) – Reach

core.Tools.plot_section(reach, Nsection, type_comp, value)[source]

plot of the section with the water surface associated :param reach: Reach :type reach: Reach :param Nsection: number of the sectin to plot in the reach :type reach: int :param type_comp: ntype of computation to plot :type reach: str :param value: hydraulic parameter to plot :type reach: str

core.Tools.projOnDEM(X, Y, DEM, type_proj, interpolation_method)[source]

Projection of a X Y list of points using DEM.

Parameters:
  • X (float array) – X coordinate of line points

  • Y (float array) – Y coordinate of line points

  • type_proj (str) – Projection method (raster/interpolation)

  • DEM (XYZ dict-grid (interpolation) or rasterio object (raster)) – Digital Elevation Model

  • interpolation_method (str) – Interpolation method (nearest, linear, cubic)

Returns:

list of elevations for (X,Y) points

core.Tools.remove_intersection(xs_lines, angles, Xinterp, side, length, point_inter)[source]

Modify XS directions to avoid intersection between XS.

Parameters:
  • xs_lines (list) – list of start and end point of all XS in the reach

  • angles (list) – angles of XS sections

:param Xinterp:curvilinear abscissa of XS :type Xinterp: list :param side: part of river considered (overbank or main channel) :type side: str :param length: half width of xs :type length: float :param point_inter: interection with banks :type point_inter: list

Returns:

  • list of new xslines (list)

  • list of new angles (list)