wolfhece.PyCrosssections ======================== .. py:module:: wolfhece.PyCrosssections .. autoapi-nested-parse:: Author: HECE - University of Liege, Pierre Archambeau, Utashi Ciraane Docile Date: 2024 Copyright (c) 2024 University of Liege. All rights reserved. This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited. Module Contents --------------- .. py:data:: example_largesect :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """-138 100 -114 90 -70 80 -45 70 -32 62 0 61.5 32 62 60 70 80 80 98 84 120 87""" .. raw:: html
.. py:data:: example_smallsect :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """0 68 10 67 12 65 15 63 20 62 24 61.5 30 62 35 64 40 66 42 66.5 50 68""" .. raw:: html
.. py:data:: example_diffsect1 :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """0 10 10 5 12 5 15 6 16 6 17 5 20 3 25 3 30 5 42 7 50 10""" .. raw:: html
.. py:function:: INTERSEC(x1: float, y1: float, x2: float, y2: float, el: float) Procédure de calcul de l'abscisse d'intersection d'une altitude donnée el dans un segment défini par ses coordonnées (x1,y1) et (x2,y2) .. py:function:: _shift_np(base: numpy.ndarray, x: float, y: float) Copy a Numpy array and translate it by (x,y) in the XY plane .. py:function:: _find_shift_at_xy(section: numpy.ndarray, x3: float, y3: float) Find the Delta X and Delta Y to shift a section to be parallel to itself at point (x3,y3) .. py:class:: postype(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.PyCrosssections.postype :parts: 1 :private-bases: Mode de stockage des points de référence (berges, fond lit) .. py:attribute:: BY_VERTEX :value: 0 .. py:attribute:: BY_S3D :value: 1 .. py:attribute:: BY_INDEX :value: 2 .. py:class:: profile(name: str, data_sect: str | numpy.ndarray | list | wolfhece.PyVertexvectors.vector = '', parent=None) Bases: :py:obj:`wolfhece.PyVertexvectors.vector` .. autoapi-inheritance-diagram:: wolfhece.PyCrosssections.profile :parts: 1 :private-bases: Subclass of a vector to define a river profile/cross-section. Some attributes are added to manage specific points of the profile (banks, bed). The bankleft, bankright, bed, bankleft_down, bankright_down attributes can be wolfvertex, index of vertex or s3D position depending on banksbed_postype. If a profile is part of a croossection object, the parent attribute points to it. If the profiles are ordered along a river, the up and down attributes point to the upstream and downstream profiles. sdatum and zdatum are offsets to be added to the curvilinear abscissa and altitudes of the profile. The stored coordinates are in 3D (x, y, z). If data_sect is provided at initialization, we expect (X, Z) data. The x coordinate is the curvilinear abscissa along the section and z is the altitude (y is set to 0). .. attention:: Normally, a profile is a succession of points in a vertical plane, aligned along a trace. In this implementation, the points can be in 3D space, not necessarily aligned. Some routines have a 'cumul' parameter to compute the curvilinear abscissa along the section. If 'cumul' is True, the real curvilinear abscissa is computed. If 'cumul' is False, the distance **between each point and the first point** is computed. .. py:attribute:: _bankleft :value: None .. py:attribute:: _bankright :value: None .. py:attribute:: _bed :value: None .. py:attribute:: _bankleft_down :value: None .. py:attribute:: _bankright_down :value: None .. py:attribute:: banksbed_postype .. py:attribute:: refpoints .. py:attribute:: s :value: 0.0 .. py:attribute:: up :type: profile :value: None .. py:attribute:: down :type: profile :value: None .. py:attribute:: laz :value: False .. py:attribute:: parent :value: None .. py:attribute:: orient :value: None .. py:attribute:: sz :value: None .. py:attribute:: sz_bankbed :value: None .. py:attribute:: s3d_bankbed :value: None .. py:attribute:: prepared :value: False .. py:attribute:: smin :value: -99999 .. py:attribute:: smax :value: -99999 .. py:attribute:: zmin :value: -99999 .. py:attribute:: zmax :value: -99999 .. py:attribute:: q_slope :value: None .. py:attribute:: q_down :value: 0.0 .. py:attribute:: q_up :value: 0.0 .. py:attribute:: q_centered :value: 0.0 .. py:attribute:: wetarea :value: None .. py:attribute:: wetperimeter :value: None .. py:attribute:: hydraulicradius :value: None .. py:attribute:: waterdepth :value: None .. py:attribute:: localwidth :value: None .. py:attribute:: criticaldischarge :value: None .. py:attribute:: _linestring_sz :value: None .. py:attribute:: _linestring_s3dz :value: None .. py:property:: linked_arrays Return the linked arrays from parent crosssection if any. Useful to plot associated data along the section. .. py:property:: bankleft Return the bankleft reference point in its raw format (wolfvertex, index or s3D) .. py:property:: bankright Return the bankright reference point in its raw format (wolfvertex, index or s3D) .. py:property:: bankleft_down Return the bankleft_down reference point in its raw format (wolfvertex, index or s3D) .. py:property:: bankright_down Return the bankright_down reference point in its raw format (wolfvertex, index or s3D) .. py:property:: bed Return the bed reference point in its raw format (wolfvertex, index or s3D) .. py:property:: bankleft_vertex Return the bankleft reference point as a wolfvertex whatever the storage format .. py:property:: bankright_vertex Return the bankright reference point as a wolfvertex whatever the storage format .. py:property:: bankleft_down_vertex Return the bankleft_down reference point as a wolfvertex whatever the storage format .. py:property:: bankright_down_vertex Return the bankright_down reference point as a wolfvertex whatever the storage format .. py:property:: bed_vertex Return the bed reference point as a wolfvertex whatever the storage format .. py:property:: bankleft_s3D Return the bankleft reference point as a s3D position whatever the storage format .. py:property:: bankright_s3D Return the bankright reference point as a s3D position whatever the storage format .. py:property:: bankleft_down_s3D Return the bankleft_down reference point as a s3D position whatever the storage format .. py:property:: bankright_down_s3D Return the bankright_down reference point as a s3D position whatever the storage format .. py:property:: bed_s3D Return the bed reference point as a s3D position whatever the storage format .. py:property:: bankleft_sz Return the bankleft reference point as a (s,z) tuple whatever the storage format .. py:property:: bankright_sz Return the bankright reference point as a (s,z) tuple whatever the storage format .. py:property:: bed_sz Return the bed reference point as a (s,z) tuple whatever the storage format .. py:property:: bankleft_down_sz Return the bankleft_down reference point as a (s,z) tuple whatever the storage format .. py:property:: bankright_down_sz Return the bankright_down reference point as a (s,z) tuple whatever the storage format .. py:method:: verif() .. py:method:: triangulation_gltf(zmin: float) Génération d'un info de triangulation pour sortie au format GLTF --> Blender La triangulation est constituée de la section et d'une base plane à l'altitude zmin, a priori sous le lit de la rivière. :param zmin: position d'altitude minimale de la triangulation .. py:method:: triangulation_ponts(x: float, y: float, zmax: float) Triangulation d'une section de pont :param x: coordonnée X du point de référence du pont :param y: coordonnée Y du point de référence du pont :param zmax: altitude du tablier du pont .. py:method:: _set_orient() Calcul du vecteur directeur de la section sur base des points extrêmes .. py:property:: trace_increments Return the orientation vector of the section (unit vector in the XY plane) .. py:method:: get_xy_from_s(s: float) -> tuple[float, float] Récupération d'un tuple (x,y) sur base d'une distance 2D 's' orientée dans l'axe de la section :param s: distance curviligne 2D le long de la section supposée plane étant donné l'utilisation de l'orientation .. py:method:: set_vertices_sz_orient(sz: numpy.ndarray | tuple | list, xy1: numpy.ndarray | list | tuple, xy2: numpy.ndarray | list | tuple) Ajout de vertices depuis : - une matrice numpy (s,z) -- shape = (nb_vert,2) ou une liste ou un tuple convertibles en numpy array - un point source [x,y] - un point visé [x,y] Le point source correspond au vertex de s=0. Le point visé sert uniquement à définir l'orientation de la section. :param sz: matrice numpy (s,z) -- shape = (nb_vert,2) :param xy1: point source [x,y] :param xy2: point visé [x,y] .. py:method:: get_laz_around(length_buffer: float = 10.0) Récupération de points LAZ autour de la section :param length_buffer: distance latérale [m] autour de la section pour la récupération des points LAZ .. py:method:: plot_laz(length_buffer: float = 5.0, fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, show=False) Dessin des points LAZ sur le graphique Matplotlib :param length_buffer: distance latérale [m] autour de la section pour la récupération des points LAZ :param fig: figure Matplotlib :param ax: axes Matplotlib :param show: if True, show the figure .. py:method:: slide_vertex(s: float) Glissement des vertices d'une constante 's' :param s: distance de glissement dans l'axe de la section .. py:method:: movebankbed_index(which: Literal['left', 'right', 'bed', 'left_down', 'right_down'], orientation: Literal['left', 'right']) -> None Déplacement des points de référence sur base d'un index. Le cas échéant, adaptation du mode de stockage. :param which: point à déplacer ('left', 'right', 'bed', 'left_down', 'right_down') :param orientation: direction du déplacement ('left' ou 'right') .. py:method:: update_sdatum(new_sdatum: float) Mise à jour de la position de la section selon sa trace :param new_sdatum: nouvelle valeur de sdatum .. py:method:: update_zdatum(new_zdatum: float) Mise à jour de l'altitude de référence de la section :param new_zdatum: nouvelle valeur de zdatum .. py:method:: update_banksbed_from_s3d(which: Literal['left', 'right', 'bed', 'left_down', 'right_down'], s: float) Mise à jour des points de référence depuis une coordonnée curvi 3D :param which: point à modifier ('left', 'right', 'bed', 'left_down', 'right_down') :param s: nouvelle position curvi 3D du point .. py:method:: save(f) Surcharge de l'opération d'écriture :param f: fichier ouvert en écriture .. py:method:: get_s_from_xy(xy: wolfhece.PyVertex.wolfvertex, cumul: bool = False) -> float Retourne la coordonnée curviligne (ou distance euclidienne selon l'orientation de la section) du point xy donné en tant qu'objet wolfvertex. Dans cette routine, 'cumul' est à False par défaut pour être rétro-compatible avec les versions précédentes. ATTENTION: Cette valeur par défaut n'est pas identique à celle utilisée dans 'get_sz'. :param xy: vertex dont on veut la coordonnée curvi 2D :param cumul: si True, la coordonnée curvi 2D est cumulée (distance le long de la section) si False, la coordonnée curvi 2D est la distance euclidienne au point de départ .. py:method:: set_sz(sz: numpy.ndarray, trace: list[tuple[float, float]]) Calcule les positions des vertices sur base d'une matrice sz et d'une trace. :param s: colonne 0 :param z: colonne 1 :param trace: liste de 2 couples xy -> [[x1,y1], [x2,y2]] FIXME: Vérifier la possibilité de fusionner avec set_vertices_sz_orient .. py:method:: get_sz_banksbed(cumul=True, force: bool = False) -> tuple[float, float, float, float, float, float, float, float, float, float] Retourne les positions des points de référence mais avec la coordonnée curvi 2D - (sleft, sbed, sright, zleft, zbed, zright, sbankleft_down, sbankright_down, zbankleft_down, zbankright_down) :param cumul: si True, la coordonnée curvi 2D est cumulée (distance le long de la section) si False, la coordonnée curvi 2D est la distance euclidienne au point de départ :param force: si True, force le recalcul même si la section est déjà préparée .. py:method:: get_s3d_banksbed(force: bool = False) -> tuple[float, float, float, float, float] Retourne les coordonnée curvi 3D des points de référence - (sleft, sleft_down, sbed, sright_down, sright) .. py:method:: asshapely_sz() -> shapely.geometry.LineString Retroune la section comme objet shapely - polyligne selon la trace avec altitudes .. py:property:: linestring_sz :type: shapely.geometry.LineString Retroune la section comme objet shapely - polyligne selon la trace avec altitudes .. py:method:: asshapely_s3dz() -> shapely.geometry.LineString Retroune la section comme objet shapely - polyligne selon la trace 3D avec altitudes .. py:property:: s3dz :type: numpy.ndarray Retroune la section comme matrice numpy (s3d,z) .. py:property:: linestring_s3dz :type: shapely.geometry.LineString Retroune la section comme objet shapely - polyligne selon la trace 3D avec altitudes .. py:method:: prepare(cumul=True) Pre-Compute sz, sz_banked and shapely objects to avoid multiple computation .. py:method:: _reset_linestring_sz_s3dz() .. py:method:: reset_prepare() Réinitialisation de la préparation de la section .. py:method:: get_min() -> wolfhece.PyVertex.wolfvertex Return the vertex with minimum elevation .. py:method:: get_max() -> wolfhece.PyVertex.wolfvertex Return the vertex with maximum elevation .. py:method:: get_minz() -> float Return the minimum elevation .. py:method:: get_maxz() -> float Return the maximum elevation .. py:method:: relation_oneh(cury: float, x: float = None, y: float = None) Compute the hydraulic characteristics for a given water elevation 'cury' :param cury: water elevation :param x: optional x coordinates of the section (if None, use the section's coordinates) :param y: optional y coordinates of the section (if None, use the section's coordinates) :return: a,s,w,r (wetted area, wetted perimeter, top width, hydraulic radius) .. py:method:: relations(discretize: int = 100, plot=True) This method returns 6 numpy arrays each containing the evolution of a specific hydraulic characteristic with respect to the water depth in the profile (wetted area, wetted perimeter, top width, water detph, hydraulic radius, critical discharge). .. py:method:: slopes() Compute the slopes of the section with respect to the upstream and downstream sections .. py:method:: ManningStrickler_Q(slope: float = 0.001, nManning: float = 0.0, KStrickler: float = 0.0) Procédure générique pour obtenir une relation uniforme Q-H sur base d'une pente et d'un coefficient de frottement. :param slope: une pente :param nManning: un coefficient de frottement :param KStrickler: un coefficient de frottement (if nManning > 0.0, KStrickler is ignored) .. py:method:: ManningStrickler_oneQ(slope: float = 0.001, nManning: float = 0.0, KStrickler: float = 0.0, cury: float = 0.0) Procédure générique pour obtenir une relation uniforme Q-H sur base :param slope: une pente :param nManning: un coefficient de frottement :param KStrickler: un coefficient de frottement (if nManning > 0.0, KStrickler is ignored) :param cury: une hauteur d'eau :return: le débit Q .. py:method:: deepcopy_profile(name: str = None, appendstr: str = '_copy') This method returns a deepcopy of the active profile. The profile features are individually transferred, therefore, only the necessary features are copied. :param name: name of the copied profile (if None, the current profile's name + appendstr is used) :param appendstr: string to append to the current profile's name if no new name is given (default: '_copy') :return: the copied profile .. py:method:: color_active_profile(width: float = 3.0, color: list = [255, 0, 0], plot_opengl: bool = True) This method colors and thickens the active profile (default width : 3, default color: red). :param width: width of the profile :param color: color of the profile as a list of RGB values (0-255) :param plot_opengl: if True, update the OpenGL plot of the parent zone .. py:method:: highlighting(width: float = 3.0, color: list = [255, 0, 0], plot_opengl: bool = True) Alias for color_active_profile .. py:method:: uncolor_active_profile(plot_opengl=True) This method resets the width and the color of the active profile to 1 and black. .. py:method:: withdrawing(plot_opengl: bool = True) Alias for uncolor_active_profile .. py:method:: ManningStrickler_profile(slope: float = 0.001, nManning: float = 0.0, KStrickler: float = 0.0) Procédure générique pour obtenir une relation uniforme Q-H d'un profile :param slope: une pente :param nManning: un coefficient de frottement :param KStrickler: un coefficient de frottement (if nManning > 0.0, KStrickler is ignored) ainsi que les relations correspondant aux pentes aval(slope down), amont(slopeup), et amont-aval (centered). :return: le débit Q maximum parmi les 4 relations .. py:method:: plotcs_profile(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, compare: profile = None, vecs: list = [], col_structure: str = 'none', fwl: float = None, fwd: float = None, simuls: list = None, show: bool = False, forceaspect: bool = True, plotlaz: bool = True, clear: bool = True, redraw: bool = True) This method plots the physical geometry of the current cross section (profile). - If a reference profile (compare) is given, the method hatchs the differences with resepect to cuts and fills. - If forceaspect is activated, the x and y axes are plotted using the same scale, otherwise, the figure is anamorphosed. - fwl (for water level) and fwd (for water depth) allow the visualisation of a specific water level on the graph. - idsimul: list of available numerical simulations containing this profile, - zsimul: list of water level in the simulations. - col_structure colors the structure displayed. :param fig: Matplotlib figure :param ax: Matplotlib axes :param compare: reference profile to compare with :param vecs: list of vector objects to plot on the section (e.g. levees, dikes, ...) :param col_structure: color of the structures (default: 'none') :param fwl: water level to plot (if None, no water level is plotted) :param fwd: water depth to plot (if None, no water level is plotted) :param simuls: list of simulations containing the profile (id, name, date, time, water level) :param show: if True, show the figure :param forceaspect: if True, force aspect ratio :param plotlaz: if True, plot LAZ points if available :param clear: if True, clear the axis before plotting :param redraw: if True, redraw the figure after plotting .. py:method:: plotcs_discharges(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, fwl: float = None, fwd: float = None, fwq: float = None, simuls: list = None, show: bool = False, clear: bool = True, labels: bool = True, redraw: bool = True, force_label_to_right: bool = True) This method plots the discharges relationship computed with the methods: relations and ManningStrcikler_profile. - fwl: for water level, - fwd: for water depth, - fwq: for water discharge, - idsimul: list of available numerical models. - qsimul: list of discharges in the available numerical models, - hsimul: list of water depth in the available numerical models. :param fig: Matplotlib figure :param ax: Matplotlib axes :param fwl: water level to plot (if None, no water level is plotted) :param fwd: water depth to plot (if None, no water level is plotted) :param fwq: discharge to plot (if None, no discharge is plotted) :param simuls: list of simulations containing the profile (id, name, date, time, discharge, water level) :param show: if True, show the figure :param clear: if True, clear the axis before plotting :param labels: if True, show the legend :param redraw: if True, redraw the figure after plotting .. py:method:: plot_discharges_UnCr(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, fwl: float = None, fwd: float = None, fwq: float = None, simuls: list = None, show: bool = False, clear: bool = True, labels: bool = True, redraw: bool = True, force_label_to_right: bool = False) .. py:method:: plotcs_hspw(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, fwl: float = None, fwd: float = None, fwq: float = None, show: bool = False, clear: bool = True, labels: bool = True, redraw: bool = True, force_label_to_right: bool = True) This method plots the hydraulic geometries computed by the relations method (Hydraulic radius, wetted area, wetted perimeter, Top width). - fwl: for water level, - fwd: for water depth, - fwq: for water discharge. :param fig: Matplotlib figure :param ax: Matplotlib axes :param fwl: water level to plot (if None, no water level is plotted) :param fwd: water depth to plot (if None, no water level is plotted) :param fwq: discharge to plot (if None, no discharge is plotted) :param show: if True, show the figure :param clear: if True, clear the axis before plotting :param labels: if True, show the legend :param redraw: if True, redraw the figure after plotting .. py:method:: plotcs_relations(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, fwl: float = None, fwd: float = None, fwq: float = None, show: bool = False, clear: bool = True, labels: bool = True, redraw: bool = True, force_label_to_right: bool = False) This method plots the cross section relations (geometry, hydraulic geometries) It is the same than 'plotcs_hspw' but with (force_label_to_right = False) by default .. py:method:: plot_linked(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, linked_arrays: dict, colors: list = ['red', 'blue', 'green']) Plot linked arrays on the section plot .. py:method:: _plot_only_cs(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, label='', alpha=0.8, lw=1.0, style: str = 'dashed', centerx=0.0, centery=0.0, grid=True, col_ax: str = 'black') Plot only the cross section line on an existing axis .. py:method:: _plot_only_cs_min_at_x0(fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, label='', alpha=0.8, lw=1.0, style: str = 'dashed', grid=True, col_ax: str = 'black') Plot only the cross section line on an existing axis. We assume that the minimum elevation is at x=0. .. py:method:: plot_cs(fwl: float = None, show: bool = False, forceaspect: bool = True, fig: matplotlib.figure.Figure = None, ax: matplotlib.axes.Axes = None, plotlaz: bool = True, clear: bool = True, linked_arrays: dict = {}) Plot the cross section with matplotlib - with options :param fwl: fill water level - if None, no filling :param show: if True, show the figure :param forceaspect: if True, force aspect ratio :param fig: figure Matplotlib :param ax: axes Matplotlib :param plotlaz: if True, plot LAZ points if available :param clear: if True, clear the axis before plotting :param linked_arrays: dictionary of linked arrays to plot on the section .. py:method:: _plot_extremities(ax: matplotlib.pyplot.Axes, s: int = 50, colors: tuple[str, str] = ('blue', 'green')) -> None Plot the extremities of the cross-section on the given axes. .. py:method:: _plot_extremities_sz(ax: matplotlib.pyplot.Axes, s: int = 10, colors: tuple[str, str] = ('blue', 'green')) -> None Plot the extremities of the cross-section on the given axes. .. py:class:: crosssections(fn_or_Zones: str | pathlib.Path | wolfhece.PyVertexvectors.Zones = '', format: Literal['2000', '2022', '2025_xlsx', 'vecz', 'sxy', 'zones'] = '2022', dirlaz: Union[str, wolfhece.lazviewer.laz_viewer.xyz_laz_grids] = 'D:\\OneDrive\\OneDrive - Universite de Liege\\Crues\\2021-07 Vesdre\\CSC - Convention - ARNE\\Data\\LAZ_Vesdre\\2023', mapviewer=None, idx='', plotted=True, from_zones: wolfhece.PyVertexvectors.Zones = None, force_unique_name: bool = False) Bases: :py:obj:`wolfhece.drawing_obj.Element_To_Draw` .. autoapi-inheritance-diagram:: wolfhece.PyCrosssections.crosssections :parts: 1 :private-bases: Gestion de sections en travers pour différents formats - SPW 2000 --> format ='2000' - SPW 2022 --> format ='2022' - SPW_2025 --> format ='2025_xlsx' - WOLF vecz --> format ='vecz' - WOLF sxy --> format ='sxy' - WOLF zones --> format ='zones' L'objet stocke ses informations dans un dictionnaire : self.myprofiles Les clés de chaque entrée sont: ['index'] : integer ['left'] : wolfvertex ['bed'] : wolfvertex ['right'] : wolfvertex ['left_down'] : wolfvertex ['right_down']: wolfvertex ['cs'] : profile (surcharge de vector) Pour le moment, il est possible de lire les fichiers et d'effectuer certains traitements (tri selon vecteur, export gltf...). Une instance de cet objet peut être ajouté à une instance graphique WOLF pour affichage. Pour ce faire: - une propriété "myzones" de type "Zones" est présente pour stocker les sections sous forme WOLF "ZONES/ZONE/VECTOR/VERTICES". --> "crosssections" n'est donc pas une extension de "Zones" !! - deux instances de "cloud_vertices" contiennent les vertices des sections : - cloud - cloud_all :attention: !! La classe n'est pas encore prévue pour créer des sections en travers!! .. py:attribute:: myprofiles :type: dict[str | int:dict['cs':profile, 'index':int, 'left':wolfvertex, 'bed':wolfvertex, 'right':wolfvertex, 'left_down':wolfvertex, 'right_down':wolfvertex]] .. py:attribute:: mygenprofiles :type: dict .. py:attribute:: dirlaz :value: None .. py:attribute:: gridlaz :value: None .. py:attribute:: myzones :value: None .. py:attribute:: myzone :value: None .. py:attribute:: format :value: None .. py:attribute:: linked_zones :value: None .. py:attribute:: cloud :value: None .. py:attribute:: cloud_all :value: None .. py:attribute:: multils :value: None .. py:attribute:: sorted :type: dict[str, dict['sorted':list[vector], 'support':LineString]] .. py:attribute:: plotted :value: False .. py:property:: nb_profiles Return the number of profiles in the cross-sections. .. py:method:: init_cloud() Initialiaze cloud points for cross-sections. .. py:method:: add(newprofile: profile | wolfhece.PyVertexvectors.vector) Add a new profile or vector to the cross-sections. :param newprofile: A profile or vector to be added. :type newprofile: profile | vector .. py:method:: get_linked_arrays() Passerelle pour obntenir les matrices liées .. py:method:: get_profile(which_prof, which_dict: str = None) Recherche et renvoi d'un profil sur base du nom ou de son index et éventuellement de la liste triée. :param which_prof: Nom du profil ou index du profil à rechercher. :type which_prof: str | int :param which_dict: Nom du dictionnaire trié à utiliser, si applicable. :type which_dict: str | None .. py:method:: fillin_cloud_all() Fill the cloud_all with all vertices from all profiles. .. py:method:: update_cloud() Update the cloud with vertices from all profiles. .. py:method:: create_vector_from_centers(which_dict: str = None) Create a vector from the centers of the cross-sections. .. py:method:: create_vector_from_lefts(copy: bool = True, which_dict: str = None) Create a vector from the left (first vertex) of the cross-sections. :param copy: If True, create a copy of the left vertices. If False, use the original vertices. :type copy: bool .. py:method:: create_vector_from_rights(copy: bool = True, which_dict: str = None) Create a vector from the right (last vertex) of the cross-sections. :param copy: If True, create a copy of the right vertices. If False, use the original vertices. :type copy: bool .. py:method:: check_left_right_coherence() Check the coherence of left and right banks in the cross-sections. :return: -2 if both banks intersect the center line, -1 if only left bank intersects, 1 if only right bank intersects, 0 if no intersection. :rtype: int .. py:method:: create_zone_from_banksbed() Create a zone from the banks and bed of the cross-sections. .. py:method:: link_external_zones(mylink: wolfhece.PyVertexvectors.Zones) Link the cross-sections to external zones. .. py:method:: find_intersect_with_link_zones() Find intersections between the cross-sections and linked zones. .. py:method:: export_gltf(zmin, fn='') Export the cross-sections to a GLTF file. .. py:method:: export_gltf_gen(points, triangles, fn='') Export generated cross-sections to a GLTF file. .. py:method:: set_zones(forceupdate: bool = False) Set/Prepare the zones for the cross-sections. .. py:method:: showstructure(parent=None, forceupdate=False) Show the structure of the cross-sections in the zones. .. py:method:: get_upstream() -> dict['cs':profile, 'index':int, 'left':wolfvertex | None, 'bed':wolfvertex | None, 'right':wolfvertex | None, 'left_down':wolfvertex | None, 'right_down':wolfvertex | None] Get the upstream profile of the cross-sections. .. py:method:: get_downstream() -> dict['cs':profile, 'index':int, 'left':wolfvertex | None, 'bed':wolfvertex | None, 'right':wolfvertex | None, 'left_down':wolfvertex | None, 'right_down':wolfvertex | None] Get the downstream profile of the cross-sections. .. py:method:: rename(fromidx: int, updown: bool = True) " Rename the cross-sections starting from a given index. :param fromidx: The index from which to start renaming. :type fromidx: int :param updown: If True, renames upstream sections; if False, renames all sections. :type updown: bool .. py:method:: saveas(filename: str | pathlib.Path = None) Save the cross-sections to a file in the specified format. .. py:method:: get_label(profile_dict: dict, vertex: wolfhece.PyVertex.wolfvertex) Get the label for a vertex based on its type. :param profile_dict: Dictionary containing the profile information. :type profile_dict: dict :param vertex: The vertex for which to get the label. :type vertex: wolfvertex :return: The label for the vertex. :rtype: str .. py:method:: verif_bed() Verification de l'existence du point lit mineur sinon attribution de l'altitude minimale .. py:method:: get_min(whichname: str = '', whichprofile: profile = None) Get the minimum vertex of a profile or cross-section. .. py:method:: asshapely_ls() Convert the cross-sections to a MultiLineString using Shapely. .. py:method:: prepare_shapely() Prepare the cross-sections for Shapely operations. .. py:method:: sort_along(vecsupport: shapely.geometry.LineString | wolfhece.PyVertexvectors.vector, name: str, downfirst=True) Sélectionne les sections qui intersectent un vecteur support et les trie selon l'abscisse curviligne .. py:method:: find_minmax(update: bool = False) Find the minimum and maximum coordinates of the cross-sections. :param update: If True, updates the min/max values based on the current profiles. :type update: bool .. py:method:: plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None) Plotting cross-sections .. py:method:: _prep_listogl() Prepare list of GL objects .. py:method:: saveas_wolfvec(filename: str) Save the cross-sections as a WOLF vector file. .. py:method:: select_profile(x: float, y: float) -> profile Select the profile closest to the given coordinates (x, y). :param x: X coordinate of the point. :param y: Y coordinate of the point. .. py:class:: Interpolator(vec1: wolfhece.PyVertexvectors.vector, vec2: wolfhece.PyVertexvectors.vector, supports: list[wolfhece.PyVertexvectors.vector], ds: float = 1.0, epsilon: float = 0.05) Objet d'interpolation sur sections en travers - self.interpolants est une liste de listes - chaque élément de self.interpolants est également une liste de listes - chaque liste de self.interpolants[k] contient les wolfvertex de la section discrétisée .. py:attribute:: interpolants :value: [] .. py:method:: get_xyz_for_viewer(nbsub=10) Get the XYZ coordinates for the viewer. :param nbsub: Number of subdivisions for each segment, default is 10. :type nbsub: int :return: A numpy array of shape [(nb-1)*nbsub, 4] containing the XYZ coordinates. :rtype: np.ndarray .. py:method:: add_triangles_to_zone(myzone: wolfhece.PyVertexvectors.zone) Add triangles to the specified zone based on the interpolants. :param myzone: The zone to which the triangles will be added. :type myzone: zone .. py:method:: get_triangles(forgltf=True) Get the triangles and points for the interpolants. ATTENTION : gltf format coordinates as [x, z, -y] and "forgltf" is True by default. It is not the case in "get_points" where forgltf is False by default. :param forgltf: If True, formats the points for glTF export, default is True. :type forgltf: bool :return: A tuple containing the number of points, points array, and triangles array. :rtype: tuple[int, np.ndarray, np.ndarray] .. py:method:: get_points(forgltf=False) Get the points for the interpolants. ATTENTION : gltf format coordinates as [x, z, -y] and "forgltf" is False by default. It is not the case in "get_triangles" where forgltf is True by default. :param forgltf: If True, formats the points for glTF export, default is False. :type forgltf: bool :return: A tuple containing the number of points and the points array. :rtype: tuple[int, np.ndarray] .. py:method:: export_gltf(points=None, triangles=None, fn: str | pathlib.Path = None) Export the interpolated sections as a glTF file. GLTF can be opened in many 3D viewers, including Blender, Cesium, and others. :param points: Optional points array, if None, it will be generated from the interpolants. :type points: np.ndarray | None :param triangles: Optional triangles array, if None, it will be generated from the interpolants. :type triangles: np.ndarray | None :param fn: The filename to save the glTF file, if None, a file dialog will be shown. :type fn: str | Path | None :return: None :rtype: None .. py:method:: get_xy_z_for_griddata() Get the XY and Z coordinates for griddata interpolation (Scipy). .. py:class:: Interpolators(banks: wolfhece.PyVertexvectors.Zones, cs: crosssections, ds: float = 1.0) Classe de gestion des interpolations sur sections en travers. La préparation de la triangulation est faite sur base de vecteurs supports (instance de type "Zones") et de sections en travers stockées dans une instance de type "crosssections". .. py:attribute:: points :value: None .. py:attribute:: triangles :value: None .. py:attribute:: mybanks .. py:attribute:: myinterp :type: list[Interpolator] :value: [] .. py:method:: add_interpolators(parent) Ajout d'objets 'Interpolators' pour affichage/stockage .. py:method:: export_gltf(fn: str | pathlib.Path = None) Export the interpolated sections as a glTF file. .. py:method:: viewer_interpolator() Display the interpolated sections in a viewer. .. py:property:: points_xyz Get the XYZ coordinates of the interpolated points. Points are stored as [x,z,-y] for glTF compatibility. Convert them to [x,y,z] for other uses. .. py:method:: interp_on_array(myarray, method: Literal['nearest', 'linear', 'cubic'], use_cloud: bool = True, mask_outside_polygons: bool = False) Interpolate the sections on a WolfArray. :param myarray: The WolfArray to interpolate on. :type myarray: WolfArray :param method: The interpolation method to use, default is "linear". :type method: str :param use_cloud: If True, uses cloud interpolation, otherwise triangulation, default is True. :type use_cloud: bool .. py:method:: saveas(fn: str | pathlib.Path) Save the interpolators to files. Each interpolator will be saved as a separate file with a .tri extension. :param fn: The filename to save the interpolators. :type fn: str | Path