wolfhece.Model1D
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
- class wolfhece.Model1D.fileExtensions[source]
Bases:
enum.Enum
File extensions used in this module.
- class wolfhece.Model1D.Creator_1D[source]
Class for the creation of 1D modelS. This object contains the methods operations performed in the creation of 1D models. They consist of the following operations:
Concatenation of information in 1 and 2 dimensions,
Extraction of information from 2D data if provided,
Creation of a 1D model (simulation).
- match_ends_2vectors(zones1: wolfhece.PyVertexvectors.Zones, zones2: wolfhece.PyVertexvectors.Zones, id1: int = 0, id2: int = 0) wolfhece.PyVertexvectors.Zones [source]
Aligns the vertices of 2 successive zone containing each 3 vectors (1 vector and its 2 parallels). The idea is to match the end of each vector with the beginning of its corresponding in the other zone.
- Parameters:
containing the vectors, defaults to 0
- Parameters:
id2 – Position in .myzones of the zone
containing the vectors, defaults to 0
- Returns:
The 2 zones with the aligned vertices.
- Return type:
- delete_overlaps_2vectors(zones1: wolfhece.PyVertexvectors.Zones, zones2: wolfhece.PyVertexvectors.Zones, id1: int = 0, id2: int = 0, buffer: int = None) wolfhece.PyVertexvectors.Zones [source]
Delete overlapping vertices of 2 successive Vectors, containng each 3 vectors (1 vector and its 2 parallels).
- Parameters:
containing the vectors, defaults to 0
- Parameters:
id2 – Position in .myzones of the zone
containing the vectors, defaults to 0
- Parameters:
buffer – number of vertices to process on each vector
starting from the end of the vector (None means all vertices are processed), defaults to None
- Returns:
The vectors with the deleted overlaps.
- Return type:
- connect_2vectors(zones1: wolfhece.PyVertexvectors.Zones, zones2: wolfhece.PyVertexvectors.Zones, id1: int = 0, id2: int = 0) wolfhece.PyVertexvectors.Zones [source]
Connect (link) 2 vectors extremity of 2 successive zones containing each 3 vectors (1 vectors and its 2 parallels) and, return a new zone with the concatenations.
- Parameters:
- Returns:
return a new vector which is the concatenation of the 2 first ones.
- Return type:
- concatenate_2_zones(zones1: wolfhece.PyVertexvectors.Zones, zones2: wolfhece.PyVertexvectors.Zones, id1: int = 0, id2: int = 0, buffer: int = None, save_as: str = None) wolfhece.PyVertexvectors.Zones [source]
Return the concatenation of 2 vectors file (Zones) containing each 3 vectors (1 vector and its 2 parallels) after:
matching their ends,
deleting the overlaps and,
connecting the vectors.
- Parameters:
this is the number of vertices to process on each vector starting from the end of the vector (None means all vertices are processed),defaults to None, defaults to None
- Parameters:
save_as (str, optional) – File path of the new vector, defaults to None
- Returns:
_description_
- Return type:
the vector containing the concatenation of the 2 first ones.
- read_zones_paths(file_list: list[str]) list[wolfhece.PyVertexvectors.Zones] [source]
Return a list of vectors(Zones) objects, from a list of given file paths of vectors(Zones).
- Parameters:
file_list (list[str]) – List of file paths of vectors,
- Returns:
the list of vectors(Zones) objects.
- Return type:
list[Zones]
- concatenate_listof_zones(file_list: list[str] = None, zones_list: list[wolfhece.PyVertexvectors.Zones] = None, id1: int = 0, id2: int = 0, buffer: int = None, save_as: str = None) wolfhece.PyVertexvectors.Zones [source]
Return a zones which is the concatenation of a sorted list of zones containing each 3 vectors (1 vector and its 2 parallels) after:
matching their ends,
deleting the overlaps and,
connecting the vectors.
- Parameters:
file_list (list[str], optional) – list of given file paths, defaults to None
zones_list (list[Zones], optional) – vectors(Zones) objects, defaults to None
id1 (int, optional) – Position in .myzones of the zone containing the vectors, defaults to 0
id2 (int, optional) – Position in .myzones of the zone containing the vectors, defaults to 0
buffer (While deleting overlaps, this is the number of vertices) – _description_, defaults to None
to process on each vector starting from the end of the vector (None means all vertices are processed),defaults to None
- Parameters:
save_as (File path of the new vector, optional) – _description_, defaults to None
- Raises:
Exception – With a GUI, to warn the user that the list of zones is missing.
Exception – Without GUI, to warn the user that the list of zones is missing.
- Returns:
A vector (Zones) containing the concatenation of all the vectors.
- Return type:
- create_Zonesfromzones(zone_list: list[wolfhece.PyVertexvectors.zone], save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Return a vector (Zones) from a list of zones (Zone).
- create_branches(zones_group: list[list[wolfhece.PyVertexvectors.Zones]], save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Create branches(Zone) from a list of vectors(‘Zones’). FIXME: This method is not used in the current version of the software. FIXME: It could be implemented in the future but with a dictionary instead of a list.
- create_branches_from_list_of_zones(zones_list: list[wolfhece.PyVertexvectors.Zones], id=1, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Generate branches from a list of vectors (Zones). The concept here is to loop on all vectors and then to add each zone contained in those vectors to a new zone that will be returned. FIXME: Remove Id from all methods and delete the parameter from the method signature.
- create_polygons(zones: wolfhece.PyVertexvectors.Zones, discretization: float = 1, howmanypoly: int = 1, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Return polygons created from parallels and vectors.
- Parameters:
zones (Zones) – The vector (‘Zones’),
discretization (float, optional) – discretization steps between profiles, defaults to 1
howmanypoly (int, optional) – Number of polygons, defaults to 1
save_as (str, optional) – Path to the new vector(Vector) file, defaults to ‘’
- Returns:
_description_
- Return type:
- create_branches_sections(zones: wolfhece.PyVertexvectors.Zones, discretization: float = 1, save_as='') wolfhece.PyVertexvectors.Zones [source]
Create sections on model skeleton (river branches) and return a Zones containing all sections per zone.
- create_river_sections(zones: wolfhece.PyVertexvectors.Zones, id: int = 0, discretization: float = 1, save_as: str = '', plot_check=False) wolfhece.PyVertexvectors.Zones [source]
From 2 parallels (river banks), a vector (river bed) and a discretization step this method generates and returns the corresponding profiles (river sections) as a Zones object. @The paralles and vectors shoulb stored in the same Zone and their index should follow this format:
0: Left bank
1: River bed
2: Right bank
- Parameters:
zones (Zones) – Zones containing the parallels
id (int, optional) – index of the object Zone containing vectors, defaults to 0
discretization (float, optional) – Distance between sections, defaults to 1
save_as (str, optional) – File path of the new Zones , defaults to ‘’
plot_check (bool, optional) – if the results should be plotted or not, defaults to False
- Returns:
The new Zones containing the profiles (sections).
- Return type:
- create_support_from_sections(sections: wolfhece.PyVertexvectors.Zones, save_as: str) wolfhece.PyVertexvectors.Zones [source]
Create supports from sections (midline). The supports are the midpoints of the sections.
- save_only_vec(zones: wolfhece.PyVertexvectors.Zones, id: int = 1, id_vec: int = 1, save_as: str = '', format: str = '') wolfhece.PyVertexvectors.Zones [source]
Save only one vector from a Zones object.
- Parameters:
zones (Zones) – Zones containing the vector
id (int, optional) – Index of the zone containing the vector, defaults to 1
id_vec (int, optional) – Index of the vector in the zone, defaults to 1
save_as (str, optional) – File path of the new vector, defaults to ‘’
format (str, optional) – Format of the new vector, defaults to ‘’
- Returns:
The new Zones containing the vector.
- Return type:
- refine_vector_from_2D(vect: wolfhece.PyVertexvectors.vector, discretization=1) list [source]
Refine a vector based on a given discretization step. Returns a python list.
- Parameters:
vect (vector) – Vector to refine
discretization (float) – Discret
- Returns:
List of points
- Return type:
list
- remove_zone(zones: wolfhece.PyVertexvectors.Zones, id: int = 0) wolfhece.PyVertexvectors.Zones [source]
Remove a zone from a Zones object.
- place_minimum_altitude(zones: wolfhece.PyVertexvectors.Zones, filename: str, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Return a Zones object in which all altitudes below a defined treshold for specific vectors (sections specified in a csv file) are raised to the new altitudes.
- Parameters:
zones (Zones) – Zones object containing the vectors
filename – .csv file containing the sections and their minimum altitudes,
first column is the section name and second column is the minimum altitude.
- Parameters:
save_as – path to the the file where the modified Zones will be saved
if no path is given the results is not saved but only returned , defaults to ‘’
- Returns:
New Zones object with the modified altitudes
- Return type:
- change_minimum_altitude(zones: wolfhece.PyVertexvectors.Zones, filename: str, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Return a Zones object in which all altitudes below a defined treshold for specific vectors (sections specified in a csv file) are raised to the new altitudes.
- Parameters:
zones (Zones) – Zones object containing the vectors
filename – .csv file containing the sections and their minimum altitudes,
first column is the section name and second column is the minimum altitude.
- Parameters:
save_as – path to the the file where the modified Zones will be saved
if no path is given the results is not saved but only returned , defaults to ‘’
- Returns:
New Zones object with the modified altitudes
- Return type:
- __change_minimum_altitude(zones: wolfhece.PyVertexvectors.Zones, filename: str, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Return a Zones object in which all altitudes below a defined treshold for specific vectors (sections specified in a csv file) are raised to the new altitudes.
- Parameters:
zones (Zones) – Zones object containing the vectors
filename – .csv file containing the sections and their minimum altitudes,
first column is the section name and second column is the minimum altitude.
- Parameters:
save_as – path to the the file where the modified Zones will be saved
if no path is given the results is not saved but only returned , defaults to ‘’
- Returns:
New Zones object with the modified altitudes
- Return type:
- reverse_sense_zones(zones: wolfhece.PyVertexvectors.Zones, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Reverse the sense of the vectors in a Zones object.
- Parameters:
zones (Zones) – Zones object containing the vectors
save_as – path to the the file where the modified Zones will be saved
if no path is given the results is not saved but only returned , defaults to ‘’
- Returns:
New Zones object with the reversed vectors
- Return type:
- v_shape_cross_section(cross_sections: wolfhece.PyCrosssections.crosssections, profile_name: str, increment: float = None, zmax: float = None, save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
Create a V shape profile from a given profile in a cross section object and return the new cross section object.
- v_shape(prof: wolfhece.PyCrosssections.profile, increment=None, zmax=None) wolfhece.PyCrosssections.profile [source]
- transform_to_rectangular_shape(prof: wolfhece.PyCrosssections.profile, nb_vertices: int, zmin: float = None, zmax: float = None)[source]
- rectangular_shape_cross_section(cross_sections: wolfhece.PyCrosssections.crosssections, profile_name: str, nb_vertices: int, zmin: float = None, zmax: float = None, save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
Create a rectangular shape profile from a given profile in a cross section object and return the new cross section object.
- v_shape_vector(prof: wolfhece.PyVertexvectors.vector, increment=None, zmax=None) wolfhece.PyVertexvectors.vector [source]
- _v_shape(prof: wolfhece.PyCrosssections.profile, increment=None, zmax=None) wolfhece.PyCrosssections.profile [source]
- plot_zones(zones_list: list[wolfhece.PyVertexvectors.Zones], id: int = 0) None [source]
Plot the vector objecs in a list of Zones on a matplotlib figure.
- Parameters:
zones_list (list[Zones]) – List of vector files (Zones)
id – Index of the zone containing the vector object
in all Zones, defaults to 0
- plot_separated_zones(zones_list: list[wolfhece.PyVertexvectors.Zones], id: int = 0) None [source]
Plot each vector`object ina list of `Zones on a specific graph of a matplotlib figure.
- Parameters:
zones_list (list[Zones]) – _description_
id (int, optional) – _description_, defaults to 0
- plot_parallels_width(zones: wolfhece.PyVertexvectors.Zones, id: int = 0, discretization: float = 1, Figure_title: str = 'Width between vectors', ticks_spacing: int = 1000, fig_width=30, fig_height=10, color='red', linewidth=2, x_unit='$m$', y_unit='$m$') None [source]
Plot the distance between 2 parallels (for instance river width) as a function of their mid-vector length.
Id : zone index
The discretization step is chosen by the user.
Note
The procedure is the following: - From the 3 vectors of the zone, the center vector is discretized based on the discretization step provided by the user (1 length unit by default). - The number of points is calculated as the length of the center vector divided by the discretization step. - The number of points selected is the smallest integer greater than the division result. - The newpoints are then projected on the left and right vectors. - The distance between the left and right vectors is then calculated, and plotted as a function of the distance along the center vector, after a postprocessing check using subtrings and vectors.
- Parameters:
zones (Zones) – Zones object containing the vectors,
id (int, optional) – Zones in which the vectors are stored, defaults to 0
discretization (float, optional) – After how many unit a disctance should be sampled, defaults to 1
Figure_title (str, optional) – Title to be displayed on the figure, defaults to ‘’
ticks_spacing (int, optional) – Discretization of the x axis, defaults to 1000
Note
FIXME Should be an option in GUI and check whether the substring step is necessary.
- refine_array_by_2(array: wolfhece.wolf_array.WolfArray) wolfhece.wolf_array.WolfArray [source]
Return a remeshed WolfArray in which the cells size is divided by 2. :param array: WolfArray to refine :type array: WolfArray :return: Remeshed WolfArray :rtype: WolfArray
- refine_array(array: wolfhece.wolf_array.WolfArray, discretize: int = 2) wolfhece.wolf_array.WolfArray [source]
Refine (divide) the cell size of a Wolfarray and return the new array. - @ The logarithm of discretize in base 2 must be an integer.
- concatenate_2_wolfarrays(array1: wolfhece.wolf_array.WolfArray, array2: wolfhece.wolf_array.WolfArray) wolfhece.wolf_array.WolfArray [source]
Return the concatenation of 2 WolfArrays.
- merge_wolfarrays(arrays: list[wolfhece.wolf_array.WolfArray], save_as: str = '') wolfhece.wolf_array.WolfArray [source]
” Return a wolfArray which is the concatenation of the given list of WolfArrays.
- new_array_from_vrt(array: wolfhece.wolf_array.WolfArray, vrt_file: str, file_out: str = '', wolfarray_not_tif=True, save: bool = True) wolfhece.wolf_array.WolfArray [source]
- Return a new WolfArray extracted from a VRT file.
The new array is extracted based on the bounds of the given WolfArray.
the new array is either saved on .tif or bin .format.
- Parameters:
array (WolfArray) – WolfArray from which the bounds are copied (mask)
vrt_file (str) – file path to the VRT file from which the new array is extracted
file_out – File path of the new WolfArray, file_out is provided (’’ by default)
a folder of the mask (given array) is used to store the output under the same name as the previous but with a prefix new_ added, defaults to ‘’
- Parameters:
load (bool, optional) – If the new WolfArray should be loaded or not, defaults to True
wolfarray_not_tif (bool, optional) – If the new WolfArray should be saved as a .bin file or .tif file, defaults to True
- Returns:
New WolfArray
- Return type:
- get_arrays_from_vrt(arrays: list[wolfhece.wolf_array.WolfArray], vrt_file: str, wolfarray_not_tif=True, save=True) list[wolfhece.wolf_array.WolfArray] [source]
Return a list of WolfArrays extracted from a VRT file. - The new arrays are extracted based on the bounds of the given WolfArrays. - The new arrays are either saved on .tif or bin .format.
! The new arrays are saved in the same folder as the previous one.
- Parameters:
arrays (list[WolfArray]) – List of WolfArrays from which the bounds are copied (masks)
vrt_file (str) – file path to the VRT file from which the new arrays are extracted
wolfarray_not_tif – If the new WolfArrays should be saved as a .bin file or .tif file,
defaults to True
- Returns:
List of new WolfArrays
- Return type:
list[WolfArray]
- get_values_from_array(zones: wolfhece.PyVertexvectors.Zones, array: wolfhece.wolf_array.WolfArray, save_as: str, filter_null=False, selection=True, tif=False) wolfhece.PyVertexvectors.Zones [source]
Get the values from an array based on a given Zones (vectors), - In each zone, the vector are first refined based on the array cells size. - a new Zones with its vectors value filled is returned.
- Parameters:
zones (Zones) – Zones containing the vectors
array (WolfArray) – WolfArray containing the values
save_as (str, optional) – File path of the new Zones, defaults to ‘’
filter_null (bool, optional) – If the null values should be filtered or not, defaults to False
selection (bool, optional) – If the values should be selected or not, defaults to True
tif (bool, optional) – If the array is a tif file or not, defaults to False
- Returns:
The new Zones with its vectors value filled.
- Return type:
- update_z_value(znes: wolfhece.PyVertexvectors.Zones, array: wolfhece.wolf_array.WolfArray, save_as: str) wolfhece.PyVertexvectors.Zones [source]
Update the z value of the vertices in a Zones object based on the values of a WolfArray.
- save_as_1D_crossections(zones: wolfhece.PyVertexvectors.Zones, format='zones', save_as: str = '', return_list=True) list[wolfhece.PyCrosssections.crosssections] [source]
Save each Zone in Zones as a cross sections file and, return a list of cross sections.
/!The Zones should contain the river sections to be transformed into cross sections.
- Parameters:
zones (Zones) – Zones containing the vectors
format (str, optional) – Format of the new cross sections file, defaults to ‘zones’
save_as (str, optional) – File path where the new cross sections are saved, defaults to ‘’
return_list (bool, optional) – If the method should return a list of cross sections or not, defaults to True
- Returns:
List of cross sections
- Return type:
list[crosssections]
- create_profiles(zones: wolfhece.PyVertexvectors.Zones, topo: wolfhece.wolf_array.WolfArray, discretization: int = 1, save_as: str = '', tif=False) wolfhece.PyVertexvectors.Zones [source]
Create profiles from river sections and topography. - The method creates the river sections from the Zones and discretization step. - It then creates the supports (midline vectors) from the sections. - It updates the z value of the supports based on the topography. - The method returns the profiles as a Zones. - The profiles are saved as a .vecz file. - The method also returns the profiles as a list of cross sections.
- Parameters:
zones (Zones) – Zones containing the vectors
topo (WolfArray) – WolfArray containing the topography
discretization (int, optional) – Distance between sections, defaults to 1
save_as (str, optional) – File path of the new Zones, defaults to ‘’
tif (bool, optional) – If the array is a tif file or not, defaults to False
- Returns:
The profiles as a Zones
- Return type:
- sort_crossections_list(crosses: list[wolfhece.PyCrosssections.crosssections], zones: wolfhece.PyVertexvectors.Zones, vector_id: int = 1) list[list[wolfhece.PyCrosssections.profile]] [source]
This methods sort cross sections. - The method returns a list of list of profiles. - The profiles are sorted based on the given vectors in the Zones.
- Parameters:
crosses (list[crosssections]) – List of cross sections
zones (Zones) – Zones containing the vectors
vector_id (int, optional) – Index of the vector in the zone, defaults to 1
- Returns:
List of list of profiles
- Return type:
list[list[profile]]
- sort_all_cross_section_in_one_list(mycross: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, id: int = 1) list [source]
Return all sorted profiles based on the given vectors in only one list.
- Parameters:
mycross (crosssections) – crosssections containing the profiles
zones (Zones) – Zones containing the vectors
id (int, optional) – Index of the vector in the zone, defaults to 1
- Returns:
List of all profiles sorted based on the given vector
- Return type:
list
- get_sorted_cross_sections_name(mycross: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, id: int = 1) list [source]
Return a list of names of all profiles sorted based on the given vector.
- Parameters:
mycross (crosssections) – crosssections containing the profiles
zones (Zones) – Zones containing the vectors
id (int, optional) – Index of the vector in the zone, defaults to 1
- Returns:
List of all profiles names sorted based on the given vector
- Return type:
list
- get_sorted_cells_name(mycross: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, id: int = 1) list [source]
Return a list of names of all profiles sorted based on the given vector.
- Parameters:
mycross (crosssections) – crosssections containing the profiles
zones (Zones) – Zones containing the vectors
id (int, optional) – Index of the vector in the zone, defaults to 1
- Returns:
List of all profiles names sorted based on the given vector
- Return type:
list
- crossection_from_list(profiles: list[list[wolfhece.PyCrosssections.profile]], save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
Create and return a cross section object crosssections from a list of profiles.
- Parameters:
profiles (list[list[profile]]) – List of profiles
save_as (str, optional) – File path of the new cross section object, defaults to ‘’
- Returns:
New cross section
- Return type:
- add_2_crossections(crosssections1: wolfhece.PyCrosssections.crosssections, crosssections2: wolfhece.PyCrosssections.crosssections, prefixes: list[str, str] = ['1', '2'], save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
Concatenate 2 cross sections and return the concatenation as a new cross section file.
- Parameters:
crosssections1 (crosssections) – First cross section
crosssections2 (crosssections) – Second cross section
prefixes (list[str,str], optional) – Prefixes for the cross sections, defaults to [“1”,”2”]
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
New cross section
- Return type:
- create_Zones_from_vectors(vectors: list[wolfhece.PyVertexvectors.vector]) wolfhece.PyVertexvectors.Zones [source]
Return a Zones from a list of vectors.
- create_cross_sections_from_vectors(profiles: list[wolfhece.PyCrosssections.profile]) wolfhece.PyCrosssections.crosssections [source]
Create and Return a cross section object (crosssections) from a list of profiles.
- Parameters:
profiles (list[profile]) – List of profiles
- Returns:
New cross section
- Return type:
- extrapolate_extremities(crossections: wolfhece.PyCrosssections.crosssections, added_height: float = 0, save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
Return a new cross section with the extremities of each profile extrapolated.
- Parameters:
crossections (crosssections) – crosssections containing the profiles
added_height (float, optional) – Height to add to the extremities, defaults to 0
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
New cross section with the extremities extrapolated
- Return type:
- delete_profile(mycross: wolfhece.PyCrosssections.crosssections, profile_keys: list, save_as: str = '')[source]
- Return a new cross section file were the given profiles have been removed.
The profile keys are the names of the profiles to remove.
- Parameters:
mycross (crosssections) – crosssections containing the profiles
profile_keys (list) – List of profiles keys to remove
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
New cross section with the given profiles removed
- Return type:
- roughness_from_polygons(array: wolfhece.wolf_array.WolfArray, zones: wolfhece.PyVertexvectors.Zones, mode: Literal[mean, median, min, max, Creator_1D.roughness_from_polygons.value] = 'mean', value: float = 0.04) list[list[float]] [source]
Associate a roughness (friction) value to each cross section.
The value is selected from the 2D cells in between the cross section of interest and the next one, according to the chosen mode and the polygon file Zones.
- The different modes are:
mean,
median,
min,
max,
value.
If value is selected, the given value is forced on all crossections.
- Parameters:
- Returns:
List of lists of roughnesses value
- Return type:
list[list[float]]
- roughness_from_profiles(array: wolfhece.wolf_array.WolfArray, crosses: list[list[wolfhece.PyCrosssections.profile]], mode: Literal[mean, median, min, max, Creator_1D.roughness_from_profiles.value] = 'mean', value: float = 0.04) list[list[float]] [source]
Associate a roughness (friction) value to each cross section.
The value is selected from the cells under the cross section of interest according to the chosen mode.
- The different modes are:
mean,
median,
min,
max,
value.
If value is selected, the given value is forced on all crossections.
- Parameters:
- Returns:
List of lists of roughnesses value
- Return type:
list[list[float]]
- roughness_from_value(crosses: list[list[wolfhece.PyCrosssections.profile]], value: float = 0.04) list[list[float]] [source]
Return a list of lists of roughnesses value.
The method forces the given value on all crossections.
- Parameters:
crosses (list[list[profile]]) – List of cross sections
value (float, optional) – Value to force, defaults to 0.04
- Returns:
List of lists of roughnesses value
- Return type:
list[list[float]]
- ic_relations_hspw(crosses: list[list[wolfhece.PyCrosssections.profile]], h: float = None, zval: float = None) numpy.ndarray [source]
Return the HSPW relations (Initial Conditions) of all profiles as a numpy arrray for a given water depth or a given altitude. np.array
- Parameters:
crosses (list[list[profile]]) – List of cross sections
h (float, optional) – Water depth, defaults to None
zval (float, optional) – Altitude, defaults to None
- Returns:
HSPW relations (Initial Conditions) of all profiles
- Return type:
np.ndarray
- plot_graph_crossections(mycross: wolfhece.PyCrosssections.crosssections, vect: wolfhece.PyVertexvectors.vector = None, profile_name=1, width=30, height=15)[source]
Return a graph on the GraphNotebook format. The graph contains the profile characteristics (Spatial location, sections, discharges relations, HSPW relations, etc.).
- Parameters:
mycross (crosssections) – crosssections containing the profiles
vect – vector containing the profiles
in case the profiles should be sorted, defaults to None
- Parameters:
profile_name (int, optional) – Index of the profile, defaults to 1
- Returns:
Figure containing a plot of the profile charactersitics.
- Return type:
Figure
- create_directory(save_as: str, directory_name: str) str [source]
- Creates and return a directory based on the inputs:
save_as: a computer path and,
directory_name: a desired directory name.
- Parameters:
save_as (str) – Computer path
directory_name (str) – Desired directory name
- Returns:
Directory path
- Return type:
str
- create_simulation_directory(save_as: str, directory_name: str = 'simul') str [source]
Create and return a simulation directory.
- Parameters:
save_as (str) – Computer path
directory_name (str) – Desired directory name
- Returns:
Simulation directory
- Return type:
str
- initialize_file(save_as: str, format: str, directory_name: str = 'simul') str [source]
- Create a new file based on:
The provided directory or self.directory and,
the given extension.
- Parameters:
save_as (str) – Computer path
format (str) – File extension
directory_name (str, optional) – Desired directory name, defaults to ‘simul’
- Returns:
File path
- Return type:
str
- count_lists_in_list(lst: list[list], nodes_1D=False) int [source]
- Return the sum of lengths of lists in a list.
/!Attention for 1D nodes (nodes_1D),
the number of nodes is the number of crossections minus one.
- Parameters:
lst (list[list]) – List of lists
nodes_1D (bool, optional) – If the nodes are 1D, defaults to False
- Returns:
Sum of lengths of lists in a list
- Return type:
int
- write_file_from_listof_profiles(file: str, data: list[list[wolfhece.PyCrosssections.profile]], index: list[int], force_last=False) None [source]
Writer of a file from a list of profiles. Wolf Template for writing file based on a list of profiles.
#FIXME ackward method :param file: File path :type file: str :param data: List of profiles :type data: list[list[profile]] :param index: Index of the profiles :type index: list[int] :param force_last: If the last profile should be forced, defaults to False :type force_last: bool, optional :return: None :rtype: None
- _write_relations_profiles(crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str) None [source]
/!Has been deprecated.
Write the HSPW (Heigh, wetted Section, wetted Perimeter, top Width)relations
of each profile in each cross section as a file; - Write one corresponding .ptv file (matches profile index to the corresponding profile number); - Write one corresponding .gtv file (maches profile number to the correponding relation files).
- Parameters:
crosses (list[list[profile]]) – List of cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- __write_relations_profiles(crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str) None [source]
/!Has been deprecated.
Write the HSPW (Height, wetted Section, wetted Perimeter, top Width)relations
of each profile in each cross section as a file; - Write one corresponding .ptv file (matches profile index to the corresponding profile number); - Write one corresponding .gtv file (maches profile number to the correponding relation files).
- write_relations_profiles(crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str) None [source]
Write the HSPW (Heigh, wetted Section, wetted Perimeter, top Width)relations
of each profile in each cross section as a file; - Write one corresponding .ptv file (matches profile index to the corresponding profile number); - Write one corresponding .gtv file (maches profile number to the correponding relation files).
- Parameters:
crosses (list[list[profile]]) – List of cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
None
- Return type:
None
- write_banks_file(crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str) list[list[wolfhece.PyCrosssections.profile]] [source]
- write banks (.banks) file in the given directory.
if a directory is not provided, a file named simul.banks is created.
- param crosses:
List of cross sections
- type crosses:
list[list[profile]]
- param save_as:
File path of the new cross section, defaults to ‘’
- type save_as:
str, optional
- return:
List of cross sections
- rtype:
list[list[profile]]
- write_file_from_np_array(file: str, data: numpy.ndarray, index: list[int], desc='Writing:', force_last=False, q: float = 0.0, nb_updates: int = 0) None [source]
Write a file from a numpy array. Wolf Template for writing file based on a numpy array.
- Parameters:
file (str) – File path
data (np.ndarray) – Numpy array
index (list[int]) – Index of the array
desc (str, optional) – Description, defaults to ‘Writing:’
force_last (bool, optional) – If the last value should be forced, defaults to False
q (float, optional) – Discharge, defaults to 0.
nb_updates (int, optional) – Number of updates, defaults to 0
- Returns:
None
- Return type:
None
- write_ini_files(ic: numpy.ndarray, save_as: str, q: float = None, nb_updates: int = 0, file_choice: list[str] = ['.hini', '.zini', '.aini']) None [source]
- Write all the intial condition files (.aini, .zini, .hini),
if a discharge (q) is provided, .qini is also writen.
- Parameters:
ic (np.ndarray) – Initial conditions
save_as (str, optional) – File path of the new cross section, defaults to ‘’
q (float, optional) – Discharge, defaults to None
nb_updates (int, optional) – Number of updates, defaults to 0
file_choice (list[str], optional) – List of file extensions, defaults to [‘.hini’, ‘.zini’, ‘.aini’]
- Returns:
None
- Return type:
None
- write_lengthsvecz_file(crosses: list[list[wolfhece.PyCrosssections.profile]], discretization: float, save_as: str) wolfhece.PyVertexvectors.Zones [source]
Write the length vecz file. The file is mainly use for plotting purposes.
- delete_line_in_txt_file(file_path: str, line_to_delete: str)[source]
Delete a known line in a text file.
- Parameters:
file_path (str) – File path
line_to_delete (str) – Line to delete
- write_line_in_txt_file(file_path: str, line_to_write: str)[source]
Write a line in a text file.
- Parameters:
file_path (str) – File path
line_to_write (str) – Line to write
- correct_parameters(directory='', from_steady=False)[source]
Correct the parameters files by deleting the line ‘Limiteur 7’ in the .param file and ‘Limiteur 7 Type de limitation des reconstruction en lineaire (integer1)’ in the .param.default file.
- Parameters:
directory (str, optional) – Directory path, defaults to ‘’
Note
FIXME delete from_steady arguments wherever it’s still implemented in this module.
- write_parameters(save_as: str, max_iter: int = 100000000, max_time: float = 255600.0, round_time: float = 0.0, local_time_step: int = 0, start_time: float = 0.0, write_freq: int = 3600, write_type: int = 2, reconstruction: int = 1, rk_model: int = 2, rk_coeff: float = 0.5, courant_number: float = 0.25, froude_max: float = 20, friction_law: int = 3, Verbosity: int = 1) None [source]
Write the file containing the simulation parameters of a wolf 1D model.
Note
with the implementation of Pyparams object in the Wolf module, this method is deprecating.
- Parameters:
save_as (str, optional) – File path of the new cross section, defaults to ‘’
max_iter (int, optional) – Maximum iteration, defaults to 100000000
max_time (float, optional) – Maximum time, defaults to 255600.0
round_time (float, optional) – Round time, defaults to 0.00000000000000000000e-02
local_time_step (int, optional) – Local time step, defaults to 0
start_time (float, optional) – Start time, defaults to 0.00000000000000000000e-02
write_freq (int, optional) – Write frequency, defaults to 3600
write_type (int, optional) – Write type, defaults to 2
reconstruction (int, optional) – Reconstruction, defaults to 1
rk_model (int, optional) – RK model, defaults to 2
rk_coeff (float, optional) – RK coefficient, defaults to 0.5
courant_number (float, optional) – Courant number, defaults to 0.25
froude_max (float, optional) – Froude max, defaults to 20
friction_law (int, optional) – Friction law, defaults to 3
Verbosity (int, optional) – Verbosity, defaults to 1
- _read_hydrograph_from_textfile(file: str) list[list[list, list]] [source]
Read a hydrograph from a text file.
- Parameters:
file (str) – File path
- Returns:
Hydrograph
- Return type:
list[list[list,list]]
- _write_infiltrations(selected_profiles: list[str], crosses: list[list[wolfhece.PyCrosssections.profile]], hydrographs: list[list[list, list]], save_as: str, writing_method: Literal[continuous, stepwise] = 'continuous', epsilon: float = 0.01)[source]
Write the infiltration files (.inf, .infil, .tv). - if a writing method is not provided, the default is continuous.
Note
FIXME a dict combining hydrographs and selected profiles could be more useful.
- Parameters:
selected_profiles (list[str]) – Selected profiles
crosses (list[list[profile]]) – List of cross sections
hydrographs (list[list[list,list]]) – Hydrographs
save_as (str, optional) – File path of the new cross section, defaults to ‘’
writing_method (Literal['continuous', 'stepwise'], optional) – Writing method, defaults to ‘continuous’
epsilon (float, optional) – Epsilon, defaults to 0.01
- read_hydrograph_from_textfile(file: str) list[list[list, list]] [source]
Return a hydrograph from a text file. /!The file should be on the wolf hydrograph format.
- Parameters:
file (str) – File path
- Returns:
Hydrograph
- Return type:
list[list[list,list]]
- write_infiltrations_from_dict(crosses: list[list[wolfhece.PyCrosssections.profile]], hydrographs: dict[str, wolfhece.PyHydrographs.Hydrograph | list | tuple], save_as: str, writing_method: Literal[continuous, stepwise] = 'continuous', epsilon: float = 0.01)[source]
Write the infiltration files (.inf, .infil, .tv).
Note
FIXME a dict combining hydrographs and selected profiles could be more useful.
- Parameters:
crosses (list[list[profile]]) – List of cross sections
hydrographs (dict[str, Union[Hydrograph, list,tuple]]) – Hydrographs
save_as (str, optional) – File path of the new cross section, defaults to ‘’
writing_method (Literal['continuous', 'stepwise'], optional) – Writing method, defaults to ‘continuous’
epsilon (float, optional) – Epsilon, defaults to 0.01
- write_infiltrations(selected_profiles: list[str], crosses: list[list[wolfhece.PyCrosssections.profile]], hydrographs: list[wolfhece.PyHydrographs.Hydrograph] | list[list[list, list]], save_as: str, writing_method: Literal[continuous, stepwise] = 'continuous', epsilon: float = 0.01)[source]
Write the infiltration files (.inf, .infil, .tv) and,
Apply the preprocessing mode to the hydrographs before writing them.
/! if a writing method is not provided, the default is continuous.
- Parameters:
selected_profiles (list[str]) – Selected profiles
crosses (list[list[profile]]) – List of cross sections
hydrographs (Union[list[Hydrograph], list[list[list,list]]]) – Hydrographs
save_as (str, optional) – File path of the new cross section, defaults to ‘’
writing_method (Literal['continuous', 'stepwise'], optional) – Writing method, defaults to ‘continuous’
epsilon (float, optional) – Epsilon, defaults to 0.01
- select_one_profile(profile_name: str, crosses: list[list[wolfhece.PyCrosssections.profile]]) list[int, int, int] [source]
Return the selected profile. :raise: if the profile is not found, an exception is raised.
- Parameters:
profile_name (str) – Profile name
crosses (list[list[profile]]) – List of cross sections
- Returns:
Selected profile
- Return type:
list[int,int,int]
- select_profiles(profiles_names: list[str], crosses: list[wolfhece.PyCrosssections.profile]) list[list[int, int, int]] [source]
Return a list of lists containing the respective indices of the selected profiles.
- Parameters:
profiles_names (list[str]) – Profiles names
crosses (list[profile]) – List of cross sections
- Returns:
Selected profiles
- Return type:
list[list[int, int,int]]
- write_cvg_file(selected_profiles: list[str], crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str) None [source]
Specify the node for the code verbosity in the shell (.cvg_file).
Note
with the implementation of Pyparams object in the Wolf module, this method is deprecating.
- Parameters:
selected_profiles (list[str]) – Selected profiles
crosses (list[list[profile]]) – List of cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- write_cvgn_file(selected_profiles: list[str], crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str)[source]
Write the file for Code verbosity on nodes (cvgn.file).
Note
with the implementation of Pyparams object in the Wolf module, this method is deprecating.
- Parameters:
selected_profiles (list[str]) – Selected profiles
crosses (list[list[profile]]) – List of cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- write_vector_files(cross: list[list[wolfhece.PyCrosssections.profile]], save_as: str, banksbed: wolfhece.PyVertexvectors.Zones = None, which_type: Literal[vec, vecz, both] = 'both')[source]
- Write 3 vectors files.
A 3D vector connecting all profiles bed in each zone,
A 2D vector connecting all profiles bed in each zone,
A length file (for plotting purpose)
- Parameters:
- Returns:
Zones
- Return type:
- set_banksbed_vertex_from_ls(prof: wolfhece.PyCrosssections.profile, ls: tuple[shapely.ops.LineString])[source]
Set the banks and bed from a LineString.
- Parameters:
prof (profile) – Profile
ls (tuple[LineString]) – LineString
- set_banksbed_vectors(zones: wolfhece.PyVertexvectors.Zones) tuple[shapely.ops.LineString] [source]
Set the banks and bed from a Zones.
- Parameters:
zones (Zones) – Zones
- Returns:
tuple[LineString]
- Return type:
tuple[LineString]
- find_banksbed(prof: wolfhece.PyCrosssections.profile, banks: wolfhece.PyVertexvectors.Zones)[source]
Find the banks and bed (vector) from a profile (profile) and a Zones. The banks and bed points are the intersection between the profile and the bed and banks .
- write_lengths_file(crosses: list[list[wolfhece.PyCrosssections.profile]], discretization: float, save_as: str) None [source]
Write the lengths file .lengths of a 1D model.
- Parameters:
crosses (list[list[profile]]) – List of cross sections
discretization (float) – Discretization
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- write_roughnesses(roughnesses: list[list[float]], save_as) None [source]
Write the roughnesses file .rough of 1D model.
- Parameters:
roughnesses (list[list[float]]) – Roughnesses
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- save_sorted_crosssesctions(sorted_cross: list[list[wolfhece.PyCrosssections.profile]], save_as: str)[source]
Save the sorted cross sections.
- Parameters:
sorted_cross (list[list[profile]]) – Sorted cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- test_intersection_linestring_and_profile(ls: shapely.ops.LineString, prof: wolfhece.PyCrosssections.profile)[source]
Test the intersection between a LineString and a profile.
- Parameters:
ls (LineString) – LineString
prof (profile) – Profile
- Returns:
True if there is no intersection, False otherwise
- Return type:
bool
- delete_intesections_profile_vectors(cross_sections: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, save_as: str = '', id_zone=0) wolfhece.PyCrosssections.crosssections [source]
Delete the profiles in cross-sections file that are intersecting the vectors contained in a Zones.
- Parameters:
cross_sections (crosssections) – Cross sections
zones (Zones) – Zones
save_as (str, optional) – File path of the new cross section, defaults to ‘’
id_zone (int, optional) – Id of the zone, defaults to 0
- create_profile_from_vector(vect: wolfhece.PyVertexvectors.vector, topo_array: wolfhece.wolf_array.WolfArray) wolfhece.PyCrosssections.profile [source]
Create a new profile from a vector and a topographic array.
- insert_profiles_from_2D_zones(cross_sections: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, topo_array: wolfhece.wolf_array.WolfArray, save_as='') wolfhece.PyCrosssections.crosssections [source]
Concatenate a Zones of 2D vectors to a crosssections file and return a new crosssections file as the result of the concatenation.
- Parameters:
cross_sections (crosssections) – Cross sections
zones (Zones) – Zones
topo_array (WolfArray) – Topography array
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
Cross sections
- Return type:
- insert_cross_sections_from_zones(cross_sections: wolfhece.PyCrosssections.crosssections, zones: wolfhece.PyVertexvectors.Zones, topo_array: wolfhece.wolf_array.WolfArray, save_as='') wolfhece.PyCrosssections.crosssections [source]
Concatenate a Zones of 2D vectors to a crosssections file after deleting the profiles that are intersecting the vectors contained in the Zones. Return a new crosssections file which is the result of the concatenation.
- Parameters:
cross_sections (crosssections) – Cross sections
zones (Zones) – Zones
topo_array (WolfArray) – Topography array
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- Returns:
Cross sections
- Return type:
- extend_parallels(vect: wolfhece.PyVertexvectors.vector, left_distance: float, right_distance: float, save_as: str = '') wolfhece.PyVertexvectors.Zones [source]
Extend the distance between parallels of a vector and return a new Zones file.
- write_generic_file(save_as)[source]
Write a generic file for the 1D model. The generic file is an essential pre-requiste for the Fortran code inorder to read the model files.
- Parameters:
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- convert_type_boundary_condition(type_bc: int | str)[source]
Convert the type of boundary conditions written as string into integer readable by the FORTRAN code (executable). - Type of BC, value
waterdepth -> 1
waterlevel -> 2
discharge -> 3
froude -> 4
free -> 5
impervious -> 99
junction -> 100
mobile_dam -> 127
- write_cl_file(crosses: list[list[wolfhece.PyCrosssections.profile]], cl_value: dict[str:(str, str, float)], save_as: str)[source]
Write the file of boundary conditions (.cl file). cl value(profile name: (upstream or downstream, type of boundary condition , value of boundary condition))
Type of BC, value
waterdepth -> 1
waterlevel -> 2
discharge -> 3
froude -> 4
free -> 5
impervious -> 99
junction -> 100
mobile_dam -> 127
- Parameters:
crosses (list[list[profile]]) – List of cross sections
cl_value (dict[str:(str,str,float)]) – Boundary conditions values
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- write_width_file(crosses: list[list[wolfhece.PyCrosssections.profile]], width: float, save_as: str)[source]
Write the width file (.width file). - The width is constant for all the profiles
Only used for rectangular channels. /!The width is the same for all the profiles /!The width is the same for all the zones :param crosses: List of cross sections :type crosses: list[list[profile]] :param width: Width :type width: float :param save_as: File path of the new cross section, defaults to ‘’ :type save_as: str, optional
- write_top_file(crosses: list[list[wolfhece.PyCrosssections.profile]], save_as: str)[source]
Write the topographic file (.top).
- Parameters:
crosses (list[list[profile]]) – List of cross sections
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- write_batch_simulations(directory_of_executable: str, simulations_path: list[str], batch_name: str = 'batch_all_simuls', wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.write_batch_simulations.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli') str [source]
Write a bat file (.bat) for all simulations. A .bat file contains a small commmand used to call the executable and run the simulations.
- Parameters:
directory_of_executable (str) – Directory of the executable
simulations_path (list[str]) – Simulations paths
batch_name (str, optional) – Batch name, defaults to ‘batch_all_simuls’
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
- Returns:
Batch file
- Return type:
str
- write_batch_file(directory_of_executable: str, directory_simulation: str, simulation_name: str, wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.write_batch_file.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', different_names=False, new_name: str = '') str [source]
Write a batch file (.bat file). A .bat file contains a small commmand used to call the executable and run the simulations.
- Parameters:
directory_of_executable (str) – Directory of the executable
directory_simulation (str) – Directory of the simulation
simulation_name (str) – Simulation name
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
different_names (bool, optional) – Different names, defaults to False
new_name (str, optional) – New name, defaults to ‘’
- Returns:
Batch file
- Return type:
str
- run_bat_files(batch_file: str, communicate=False)[source]
Run the .bat file in a windows shell to start the computations (simulation).
- Parameters:
batch_file (str) – Batch file
communicate (bool, optional) – Communicate, defaults to False
- _run_batch_file(batch_file: str, communicate=False)[source]
Run the .bat file in a windows shell to start the computations (simulation).
- Parameters:
batch_file (str) – Batch file
communicate (bool, optional) – Communicate, defaults to False
FIXME Deprecated.
- run_batch_file_multiprocess(communicate=False)[source]
Run the .bat file in a windows shell to start the computations (simulation).
FIXME still not working. .. note:: Find a way to implement it.
- Parameters:
batch_file (str) – Batch file
communicate (bool, optional) – Communicate, defaults to False
- _run_batch_file(batch_file: str)[source]
Run the .bat file in a windows shell to start the computations (simulation).
- Parameters:
batch_file (str) – Batch file
- run_everything(batch_file)[source]
Run the .bat file in a windows shell to start the computations (simulation).
- Parameters:
batch_file (str) – Batch file
- _run_bat_files(bat_file, force_cwd=False, initial_condition=False)[source]
Run the .bat file in a windows shell to start the computations (simulation).
- Parameters:
batch_file (str) – Batch file
force_cwd (bool, optional) – Force current working directory, defaults to False
- write_help_file(save_as: str) None [source]
Write the help file. Contains the list of mandatory and optional files to create a 1D model.
- Parameters:
save_as (str, optional) – File path of the new cross section, defaults to ‘’
- remove_directory(directory: str) None [source]
Delete a directory (folder).
- Parameters:
directory (str) – Directory path
- find_1D_binary_results(directory: str) tuple[str] [source]
/!This method has been deprecated. Return a tuple containing the paths to the model:
Head file (binary file containing the necessary information to interpret the results -> number of time steps, coordinates, simulated times, real times);
Depth file (binary file containing the computed depths at each time step);
Discharge file (binary file containing the computed discharges at each time step);
Wetted sections file (binary file containing the wetted sections for each time step).
- Parameters:
directory (str) – Directory
- Returns:
Paths to the model
- Return type:
tuple[str]
- read_1D_binary_results(results: list[str]) tuple[numpy.ndarray] [source]
/!This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation. Return a tuple containing the simulated results as numpy arrays in this order:
Nodes coordinates (np.ndarray),
Water depths (np.ndarray),
Discharges (np.ndarray),
Wetted sections (np.ndarray),
real times
Simulated times
- plot_1D_results(results: tuple[numpy.ndarray], save_as: str = '', figure_size=(20, 10), first_time_step=1, animations=True, max_ylimits=(0.9, 0.9, 2.5, 1.5, 1, 1), landmark: wolfhece.PyVertexvectors.Zones = None, banks: wolfhece.PyVertexvectors.Zones = None, dpi: float = Constants.DPI.value) None [source]
/!This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation. Plot the results of 1D model either:
as a gif (evolution of all parameters)
Starting from a particular time step (firt_time_step) or, - As a picture (only the first time step).
@ The counting of time steps starts from 1, and negative counting (from the back) works too.
@ In case a bad time steps is passed, the last time step will be plotted.
- @ max_ylimits allows the resizing of the maximum y limits of each of the 4 plots respectively.
For instance, the maximum ylim for discharges (third plot) =
max(discharges) + (2.5 * max(discharges))
- Parameters:
results (tuple[np.ndarray]) – Results
save_as (str, optional) – File path of the new cross section, defaults to ‘’
figure_size (tuple, optional) – Figure size, defaults to (20,10)
first_time_step (int, optional) – First time step, defaults to 1
animations (bool, optional) – Animations, defaults to True
max_ylimits (tuple, optional) – Maximum y limits, defaults to (0.9, 0.9, 2.5, 1.5, 1, 1)
landmark (Zones, optional) – Landmark, defaults to None
banks (Zones, optional) – Banks, defaults to None
dpi (float, optional) – Dpi, defaults to Constants.DPI.value
- plot_hydrograph_nodes(results: tuple[numpy.ndarray], which_nodes: list[int] = [0, -1], save_as: str = '', figure_size=(20, 10))[source]
/!This method has been deprecated. Check the the class` Wolfresults_1D` for the new implementation.
Plot the hydrographs of the nodes.
- Parameters:
results (tuple[np.ndarray]) – Results
which_nodes (list[int], optional) – Which nodes, defaults to [0,-1]
save_as (str, optional) – File path of the new cross section, defaults to ‘’
figure_size (tuple, optional) – Figure size, defaults to (20,10)
- write_simulation_files_from_crosssections(folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], hydrographs: list[list[list]], exe_file: str, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, Creator_1D.write_simulation_files_from_crosssections.times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.write_simulation_files_from_crosssections.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', writing_type_infiltration: Literal[continuous, stepwise] = 'continuous', epsilon_infiltration: float = 0.01, new_directory='', force_steady=True) tuple [source]
Write the simulation files (the 1D model) from the cross sections and the other parameters with one line of code.
- Parameters:
folder_path (str) – Folder path
cross_sections (crosssections) – Cross sections
parallels (Zones) – Parallels
banks (Zones) – Banks
boundary_conditions (dict) – Boundary conditions
roughness (Union[float,WolfArray]) – Roughness
hydrographs (list[list[list]]) – Hydrographs
exe_file (str) – Exe file
topography (WolfArray, optional) – Topography, defaults to None
initial_discharge (float, optional) – Initial discharge, defaults to None
simulation_name (str, optional) – Simulation name, defaults to ‘simul’
discretisation (float, optional) – Discretisation, defaults to 10.
extrapolation_of_extremities (float, optional) – Extrapolation of extremities, defaults to 100.
initial_depth (float, optional) – Initial depth, defaults to 1.
write_in (Literal['iterations', 'times'], optional) – Write in, defaults to ‘times’
output_frequency (int, optional) – Output frequency, defaults to 900
polygon_number (int, optional) – Polygon number, defaults to 1
code_verbosity_profile (list, optional) – Code verbosity profile, defaults to [1]
simulation_time (int, optional) – Simulation time, defaults to None
roughness_option (Literal['under_profile', 'under_polygons'], optional) – Roughness option, defaults to ‘under_profile’
roughness_selection (Literal['min','mean','median','max'], optional) – Roughness selection, defaults to ‘mean’
file_type_initial_cond (Literal['.aini','.hini','.zini'], optional) – File type initial cond, defaults to ‘.aini’
infiltration_profiles (list, optional) – Infiltration profiles, defaults to [‘1’]
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
run_simulation (Literal['yes', 'no'], optional) – Run simulation, defaults to ‘no’
writing_type_infiltration (Literal['continuous', 'stepwise'], optional) – Writing type infiltration, defaults to ‘continuous’
epsilon_infiltration (float, optional) – Epsilon infiltration, defaults to 0.01
new_directory (str, optional) – New directory, defaults to ‘’
force_steady (bool, optional) – Force steady, defaults to True
- Returns:
tuple
- Return type:
tuple
- find_file_from_extension(directory: str, file_extension: str) str [source]
Return a file in a directory based on its extension.
- Parameters:
directory (str) – file path to the folder
file_extension (str) – file extension
- Returns:
file path
- start_from_steady_state(directory: str, plot=True)[source]
Compute the steady state solution and update the initial conditions based on the results.
- Parameters:
directory (str) – directory (simulation folder)
plot – wheter the process should open a matplotlib figure
containing the steady state solution or not, defaults to True
- update_initial_conditions_from_results(directory: str, time_step: int = 1, plot: bool = True)[source]
- create_multiple_simulations_from_csv(csv_filename: str, folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], hydrographs: list[list[list]], exe_file: str, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.create_multiple_simulations_from_csv.steady] = 'steady', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', force_steady=True)[source]
Create multiple simulations from a csv file.
- Parameters:
csv_filename (str) – Csv filename
folder_path (str) – Folder path
cross_sections (crosssections) – Cross sections
parallels (Zones) – Parallels
banks (Zones) – Banks
boundary_conditions (dict) – Boundary conditions
roughness (Union[float,WolfArray]) – Roughness
hydrographs (list[list[list]]) – Hydrographs
exe_file (str) – Exe file
topography (WolfArray, optional) – Topography, defaults to None
initial_discharge (float, optional) – Initial discharge, defaults to None
simulation_name (str, optional) – Simulation name, defaults to ‘simul’
discretisation (float, optional) – Discretisation, defaults to 10.
extrapolation_of_extremities (float, optional) – Extrapolation of extremities, defaults to 100.
initial_depth (float, optional) – Initial depth, defaults to 1.
write_in (Literal['iterations', 'times'], optional) – Write in, defaults to ‘times’
output_frequency (int, optional) – Output frequency, defaults to 900
polygon_number (int, optional) – Polygon number, defaults to 1
code_verbosity_profile (list, optional) – Code verbosity profile, defaults to [1]
simulation_time (int, optional) – Simulation time, defaults to None
roughness_option (Literal['under_profile', 'under_polygons'], optional) – Roughness option, defaults to ‘under_profile’
roughness_selection (Literal['min','mean','median','max'], optional) – Roughness selection, defaults to ‘mean’
file_type_initial_cond (Literal['.aini','.hini','.zini'], optional) – File type initial cond, defaults to ‘.aini’
infiltration_profiles (list, optional) – Infiltration profiles, defaults to [‘1’]
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘steady’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
run_simulation (Literal['yes', 'no'], optional) – Run simulation, defaults to ‘no’
force_steady (bool, optional) – Force steady, defaults to True
- read_csv_as_dataframe(filename: str, column_names: list = None, sep=',', header: int = 0) pandas.DataFrame [source]
Read a csv file and return a pandas dataframe.
- Parameters:
filename (str) – Filename
column_names (list, optional) – Column names, defaults to None
sep (str, optional) – Separator, defaults to ‘,’
header (int, optional) – Header, defaults to 0
- Returns:
Pandas dataframe
- Return type:
pd.DataFrame
- read_csv_as_infiltrations(filename: str, sep=',', header: int = 0) list[dict] [source]
Read a csv file and return a list containing the infiltrations(hydrographs and profiles).
- Parameters:
filename (str) – Filename
sep (str, optional) – Separator, defaults to ‘,’
header (int, optional) – Header, defaults to 0
- Returns:
List of infiltrations
- Return type:
list[dict]
- create_simulations_from_csv(csv_filename: str, folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], exe_file: str, hydrographs: list[list[list]] = None, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.create_simulations_from_csv.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', writing_type_infiltration: Literal[continuous, stepwise] = 'continuous', epsilon_infiltration: float = 0.01, force_steady=True) None [source]
Create simulations from a csv file.
- Parameters:
csv_filename (str) – Csv filename
folder_path (str) – Folder path
cross_sections (crosssections) – Cross sections
parallels (Zones) – Parallels
banks (Zones) – Banks
boundary_conditions (dict) – Boundary conditions
roughness (Union[float,WolfArray]) – Roughness
exe_file (str) – Exe file
hydrographs (list[list[list]], optional) – Hydrographs, defaults to None
topography (WolfArray, optional) – Topography, defaults to None
initial_discharge (float, optional) – Initial discharge, defaults to None
simulation_name (str, optional) – Simulation name, defaults to ‘simul’
discretisation (float, optional) – Discretisation, defaults to 10.
extrapolation_of_extremities (float, optional) – Extrapolation of extremities, defaults to 100.
initial_depth (float, optional) – Initial depth, defaults to 1.
write_in (Literal['iterations', 'times'], optional) – Write in, defaults to ‘times’
output_frequency (int, optional) – Output frequency, defaults to 900
polygon_number (int, optional) – Polygon number, defaults to 1
code_verbosity_profile (list, optional) – Code verbosity profile, defaults to [1]
simulation_time (int, optional) – Simulation time, defaults to None
roughness_option (Literal['under_profile', 'under_polygons'], optional) – Roughness option, defaults to ‘under_profile’
roughness_selection (Literal['min','mean','median','max'], optional) – Roughness selection, defaults to ‘mean’
file_type_initial_cond (Literal['.aini','.hini','.zini'], optional) – File type initial cond, defaults to ‘.aini’
infiltration_profiles (list, optional) – Infiltration profiles, defaults to [‘1’]
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
run_simulation (Literal['yes', 'no'], optional) – Run simulation, defaults to ‘no’
writing_type_infiltration (Literal['continuous', 'stepwise'], optional) – Writing type infiltration, defaults to ‘continuous’
epsilon_infiltration (float, optional) – Epsilon infiltration, defaults to 0.01
force_steady (bool, optional) – Force steady, defaults to True
- copy_simulation_files(simulation: str, save_as: str, ignore_filetype: Literal[.*qini, *.aini, *.zini, *.hini, *.cl, *.rough, infil*, *.inf*.infil, *.param, *.top, *.ptv, *.gtv, .log, .count*.HEAD, *.RA, *.RB, *.RQ, *.RS, *.vecz, *.vec, *.txt, *.bat] = '') str [source]
Copy simulation files.
- Parameters:
simulation (str) – Simulation
save_as (str) – Save as
ignore_filetype (str, optional) – Ignore filetype, defaults to ‘’
- Returns:
Copied directory
- Return type:
str
- copy_multiple_simulations_from_csv(csv_filename: str, simulation: str) None [source]
Copy multiple simulations from a csv file.
- Parameters:
csv_filename (str) – Csv filename
simulation (str) – Simulation
- distribute_values_as_sum(array: numpy.ndarray) numpy.ndarray [source]
Return a 1D array were the 0 are filled with the previous value in the table, and the existing values are replaced by their summed with the previous value in the table.
- Parameters:
array (np.ndarray) – Array(1D) containing the vaalues of the initial discharge at specific profiles
- Returns:
Updated array
- Return type:
np.ndarray
- find_qini_values_from_infiltration_dict(infiltration: dict) dict [source]
Return a dictionnary containing the infiltration profiles and their initial discharge (first value).
These dictionnary can be used
- Parameters:
infiltration (dict) – Infiltration
- Returns:
Initial infiltrations
- Return type:
dict
- compute_qini_values_from_infiltrations_dict(infiltrations: dict, nb_cells: int) numpy.ndarray [source]
Compute the initial discharge from a dictionary of infiltrations. The method returns an array of initial discharges. The array values are distributed from the distribution (linear sum) of the first infiltration values.
- Parameters:
infiltrations (dict) – Infiltrations (dictionnary of hydrographs)
nb_cells (int) – Number of cells
- Returns:
Initial discharges
- Return type:
np.ndarray
- update_qini_file_from_infiltration_dict(infiltrations: dict, directory: str)[source]
Upadte the qini file from a dictionary of infiltrations.
- Parameters:
infiltrations (dict) – Infiltrations
directory (str) – Directory (folder)
- read_ini_file_as_dataframe(ini_file: str)[source]
Read an ini file and return a pandas dataframe.
- Parameters:
ini_file (str) – File of initial conditions
- Returns:
Pandas dataframe
- Return type:
pd.DataFrame
- update_ini_file(ini_file: str, new_values: numpy.ndarray) None [source]
Update the initial condition file with new values. The method reads the initial condition file as a pandas dataframe, then replace old the values by the new values.
- Parameters:
ini_file (str) – File of initial condition
new_values (np.ndarray) – New values
- __write_batch_file(directory_of_executable: str, directory_simulation: str, simulation_name: str, wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.__write_batch_file.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', different_names=False, new_name: str = '') str [source]
- match_ends_2vectors_outdated(zones1: wolfhece.PyVertexvectors.Zones, zones2: wolfhece.PyVertexvectors.Zones, id1: int = 0, id2: int = 0) wolfhece.PyVertexvectors.Zones [source]
Aligns the vertices of 2 successive zone containing each 3 vectors (1 vector and its 2 parallels), so that, the end of each vector matches the begining of its corresponding in the other zone.
id1: zone id in zones1.myzones,
id2: zone id in zones2.myzones.
- __save_as_1D_crossections(zones: wolfhece.PyVertexvectors.Zones, format='vecz', save_as: str = '') wolfhece.PyCrosssections.crosssections [source]
- __update_qini_file_from_infiltration_dict(infiltrations: dict, directory: str)[source]
Deprecating due to the last for loop (it’s obviously a code duplication).
- _create_simulations_from_csv(csv_filename: str, folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], hydrographs: list[list[list]], exe_file: str, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D._create_simulations_from_csv.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', writing_type_infiltration: Literal[continuous, stepwise] = 'continuous', epsilon_infiltration: float = 0.01, force_steady=True) None [source]
Deprecated
- _start_from_steady_state(profile: str, infiltrations: dict, list_of_sorted_cross: list, directory, plot=True)[source]
- __write_simulation_files_from_crosssections(folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], hydrographs: list[list[list]], exe_file: str, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, Creator_1D.__write_simulation_files_from_crosssections.times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.__write_simulation_files_from_crosssections.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', writing_type_infiltration: Literal[continuous, stepwise] = 'continuous', epsilon_infiltration: float = 0.01, new_directory='', force_steady=True) tuple [source]
Write the simulation files (the 1D model) from the cross sections and the other parameters with one line of code.
- Parameters:
folder_path (str) – Folder path
cross_sections (crosssections) – Cross sections
parallels (Zones) – Parallels
banks (Zones) – Banks
boundary_conditions (dict) – Boundary conditions
roughness (Union[float,WolfArray]) – Roughness
hydrographs (list[list[list]]) – Hydrographs
exe_file (str) – Exe file
topography (WolfArray, optional) – Topography, defaults to None
initial_discharge (float, optional) – Initial discharge, defaults to None
simulation_name (str, optional) – Simulation name, defaults to ‘simul’
discretisation (float, optional) – Discretisation, defaults to 10.
extrapolation_of_extremities (float, optional) – Extrapolation of extremities, defaults to 100.
initial_depth (float, optional) – Initial depth, defaults to 1.
write_in (Literal['iterations', 'times'], optional) – Write in, defaults to ‘times’
output_frequency (int, optional) – Output frequency, defaults to 900
polygon_number (int, optional) – Polygon number, defaults to 1
code_verbosity_profile (list, optional) – Code verbosity profile, defaults to [1]
simulation_time (int, optional) – Simulation time, defaults to None
roughness_option (Literal['under_profile', 'under_polygons'], optional) – Roughness option, defaults to ‘under_profile’
roughness_selection (Literal['min','mean','median','max'], optional) – Roughness selection, defaults to ‘mean’
file_type_initial_cond (Literal['.aini','.hini','.zini'], optional) – File type initial cond, defaults to ‘.aini’
infiltration_profiles (list, optional) – Infiltration profiles, defaults to [‘1’]
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
run_simulation (Literal['yes', 'no'], optional) – Run simulation, defaults to ‘no’
writing_type_infiltration (Literal['continuous', 'stepwise'], optional) – Writing type infiltration, defaults to ‘continuous’
epsilon_infiltration (float, optional) – Epsilon infiltration, defaults to 0.01
new_directory (str, optional) – New directory, defaults to ‘’
force_steady (bool, optional) – Force steady, defaults to True
- Returns:
tuple
- Return type:
tuple
- ____write_simulation_files_from_crosssections(folder_path: str, cross_sections: wolfhece.PyCrosssections.crosssections, parallels: wolfhece.PyVertexvectors.Zones, banks: wolfhece.PyVertexvectors.Zones, boundary_conditions: dict, roughness: Union[float, wolfhece.wolf_array.WolfArray], hydrographs: list[list[list]], exe_file: str, topography: wolfhece.wolf_array.WolfArray = None, initial_discharge: float = None, simulation_name: str = 'simul', discretisation: float = 10.0, extrapolation_of_extremities: float = 100.0, initial_depth: float = 1.0, write_in: Literal[iterations, Creator_1D.____write_simulation_files_from_crosssections.times] = 'times', output_frequency: int = 900, polygon_number: int = 1, code_verbosity_profile: list = [1], simulation_time: int = None, roughness_option: Literal[under_profile, under_polygons] = 'under_profile', roughness_selection: Literal[min, mean, median, max] = 'mean', file_type_initial_cond: Literal[.aini, .hini, .zini] = '.aini', infiltration_profiles: list = ['1'], wetdry: Literal[fixed, evolutive] = 'evolutive', steady: Literal[no precomputation, precomputation, Creator_1D.____write_simulation_files_from_crosssections.steady] = 'precomputation', executable_type: Literal[wolfcli, wolfclid] = 'wolfcli', run_simulation: Literal[yes, no] = 'no', writing_type_infiltration: Literal[continuous, stepwise] = 'continuous', epsilon_infiltration: float = 0.01, new_directory='', steady_state_profile='', force_steady=True, start_from_steady_state=False, plot_steady_state=True) tuple [source]
Write the simulation files (the 1D model) from the cross sections and the other parameters with one line of code.
- Parameters:
folder_path (str) – Folder path
cross_sections (crosssections) – Cross sections
parallels (Zones) – Parallels
banks (Zones) – Banks
boundary_conditions (dict) – Boundary conditions
roughness (Union[float,WolfArray]) – Roughness
hydrographs (list[list[list]]) – Hydrographs
exe_file (str) – Exe file
topography (WolfArray, optional) – Topography, defaults to None
initial_discharge (float, optional) – Initial discharge, defaults to None
simulation_name (str, optional) – Simulation name, defaults to ‘simul’
discretisation (float, optional) – Discretisation, defaults to 10.
extrapolation_of_extremities (float, optional) – Extrapolation of extremities, defaults to 100.
initial_depth (float, optional) – Initial depth, defaults to 1.
write_in (Literal['iterations', 'times'], optional) – Write in, defaults to ‘times’
output_frequency (int, optional) – Output frequency, defaults to 900
polygon_number (int, optional) – Polygon number, defaults to 1
code_verbosity_profile (list, optional) – Code verbosity profile, defaults to [1]
simulation_time (int, optional) – Simulation time, defaults to None
roughness_option (Literal['under_profile', 'under_polygons'], optional) – Roughness option, defaults to ‘under_profile’
roughness_selection (Literal['min','mean','median','max'], optional) – Roughness selection, defaults to ‘mean’
file_type_initial_cond (Literal['.aini','.hini','.zini'], optional) – File type initial cond, defaults to ‘.aini’
infiltration_profiles (list, optional) – Infiltration profiles, defaults to [‘1’]
wetdry (Literal['fixed', 'evolutive'], optional) – Wetdry, defaults to ‘evolutive’
steady (Literal['no precomputation', 'precomputation', 'steady'], optional) – Steady, defaults to ‘precomputation’
executable_type (Literal['wolfcli', 'wolfclid'], optional) – Executable type, defaults to ‘wolfcli’
run_simulation (Literal['yes', 'no'], optional) – Run simulation, defaults to ‘no’
writing_type_infiltration (Literal['continuous', 'stepwise'], optional) – Writing type infiltration, defaults to ‘continuous’
epsilon_infiltration (float, optional) – Epsilon infiltration, defaults to 0.01
new_directory (str, optional) – New directory, defaults to ‘’
force_steady (bool, optional) – Force steady, defaults to True
- Returns:
tuple
- Return type:
tuple
- class wolfhece.Model1D.Wolfresults_1D(simulation_directory: str = None)[source]
Read the results of a Wolf 1D model and enable the visualization (plots) of variables namely water level, water depth, discharge, wetted sections, velocity and Froude number.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- update_ic_from_time_steps(time_step: int = -1) numpy.ndarray [source]
- Return the simulated conditions (a,q,h, r) at a given time step as a np.ndarray.
a: Wetted section (index 0),
s: Wetted perimeter (index 1),
w: Top width (index 2),
r: Hydraulic radius (index 3).
- Parameters:
time_step (int, optional) – the desired time steps, defaults to -1
- Returns:
the conditions at the specified time step
- Return type:
np.ndarray
- update_ini_file(ini_file: str, new_values: numpy.ndarray) None [source]
Update the initial condition file with new values.
- plot_water_level(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, show=True)[source]
Plot the water level and return the information associated with the the figure’s axis.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Axe
- Return type:
Axes
- _plot_water_level(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, show=True)[source]
Deprecated method
- plot_line_water_level(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the water level as a continous line and return the information associated with the axe.
Landmarks are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Water level
- Return type:
Line2D
- plot_water_depth(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 0.5, convert_step=True, steps_limit=False, show=True)[source]
Plot the water depth and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to .5
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Water depth
- Return type:
Line2D
- plot_line_water_depth(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the water depth as a line and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Water depth
- Return type:
Line2D
- plot_discharges(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = None, convert_step=True, steps_limit=False, show=True)[source]
Plot the discharges and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to None
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Water discharge
- Return type:
Line2D
- plot_line_discharges(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the discharges as a line and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Water discharge
- Return type:
Line2D
- plot_wetted_sections(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x: float = 1000.0, grid_y: float = None, convert_step=True, steps_limit=False, show=True)[source]
Plot the wetted sections and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x (float, optional) – Grid x, defaults to 1000.
grid_y (float, optional) – Grid y, defaults to None
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Wetted sections
- Return type:
Line2D
- plot_line_wetted_sections(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the wetted sections as a line and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Wetted sections
- Return type:
Line2D
- plot_velocities(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x: float = 1000.0, grid_y: float = None, convert_step=True, steps_limit=False, show=True)[source]
Plot the velocities and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x (float, optional) – Grid x, defaults to 1000.
grid_y (float, optional) – Grid y, defaults to None
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Velocity
- Return type:
Line2D
- plot_line_velocities(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the velocities as a line and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Velocity
- Return type:
Line2D
- plot_froudes(figax: tuple = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x: float = 1000.0, grid_y: float = None, convert_step=True, steps_limit=False, show=True)[source]
Plot the Froude numbers and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x (float, optional) – Grid x, defaults to 1000.
grid_y (float, optional) – Grid y, defaults to None
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
show (bool, optional) – Show, defaults to True
- Returns:
Froude number
- Return type:
Line2D
- plot_line_froudes(figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, time_step: int = 1, banksbed: str | wolfhece.PyVertexvectors.Zones = '', landmark: str | wolfhece.PyVertexvectors.Zones = '', save_as: str = '', figsize: tuple = (20, 10), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False, label: str = '', color: str = 'blue', linestyle='solid', linewidth=0.7, show=True)[source]
Plot the Froude numbers as a line and return the information associated with the axe.
Landmarks: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
figax (tuple, optional) – Figure and axe
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x_m, defaults to 1000.
grid_y_m (float, optional) – Grid y_m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
label (str, optional) – Label, defaults to ‘’
color (str, optional) – Color, defaults to ‘blue’
linestyle (str, optional) – Linestyle, defaults to ‘solid’
linewidth (float, optional) – Linewidth, defaults to 0.7
show (bool, optional) – Show, defaults to True
- Returns:
Froude number
- Return type:
Line2D
- create_axis(figures: list)[source]
Return the predefined matplolib index(es) used to create the figure’s axes based on their number.
- Parameters:
figures (list) – List of figures
- Returns:
List of axes
- Return type:
list
- plot_variables(figures: list[Literal[water level, Wolfresults_1D.plot_variables.discharge, wetted section, water depth, Wolfresults_1D.plot_variables.velocity, Wolfresults_1D.plot_variables.froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'], time_step: int = 1, banksbed: Union[str, wolfhece.PyVertexvectors.Zones] = '', landmark: Union[str, wolfhece.PyVertexvectors.Zones] = '', save_as: str = '', figsize: tuple = (30, 10), alpha: float = 0.3, show=True, steps_limit=True, grid_x_m=1000, grid_y_m=10) list[tuple[matplotlib.lines.Line2D, matplotlib.axes.Axes, matplotlib.figure.Figure]] [source]
Plot the selected variables in figures and return the information associated with their axes.
- Parameters:
figures – List of spefic figures to be plotted,
defaults to [‘water level’, ‘discharge’, ‘wetted section’,’water depth’, ‘velocity’, ‘froude’] :type figures: list :param time_step: Desired results (time step) to be plotted, defaults to 1 :type time_step: int, optional :param banksbed: Bed and banks of the river, defaults to ‘’ :type banksbed: Union[str, Zones], optional :param landmark: are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river, defaults to ‘’ :type landmark: Union[str,Zones], optional :param save_as: Save as, defaults to ‘’ :type save_as: str, optional :param figsize: Size of the figure, defaults to (30,10) :type figsize: tuple, optional :param alpha: figure transparency, defaults to 0.3 :type alpha: float, optional :param show: Should the figure be shown, defaults to True :type show: bool, optional :param steps_limit: Steps limit, defaults to True :type steps_limit: bool, optional :return: List of axes :rtype: list
- animate_1D_plots(figures: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'], time_step: int = 1, banksbed: Union[str, wolfhece.PyVertexvectors.Zones] = '', landmark: Union[str, wolfhece.PyVertexvectors.Zones] = '', figsize: tuple = (20, 10), alpha: float = 0.3, save_as: str = '', grid_x=1000, grid_y=10)[source]
Animate the selected variables in figures, save them as a file and return the information associated with their axes.
FIXME: implement multiprocesses to speed up the process.
- Parameters:
figures (list) – List of figures
time_step (int, optional) – Time step, defaults to 1
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
figsize (tuple, optional) – Figsize, defaults to (20,10)
alpha (float, optional) – Alpha, defaults to 0.3
save_as (str, optional) – Save as, defaults to ‘’
- Returns:
List of axes
- Return type:
list
- _animate_1D_plots(figures: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'], time_step: int = 1, banksbed: Union[str, wolfhece.PyVertexvectors.Zones] = '', landmark: Union[str, wolfhece.PyVertexvectors.Zones] = '', figsize: tuple = (20, 10), alpha: float = 0.3, save_as: str = '')[source]
/!Deprecating Animate the selected variables in figures, save them as a file and return the information associated with their axes.
- convert_time_step(time_step)[source]
Convert entry into a unique time step format usable by other methods. Return the real time step.
- Parameters:
time_step (int) – Time step
- Returns:
Real time step
- Return type:
int
- _vector_from_coordinates() wolfhece.PyVertexvectors.vector [source]
Create a vector from the lowest points of each section (coordinates).
- Returns:
Vector
- Return type:
- _landmark(landmark: Union[wolfhece.PyVertexvectors.Zones, str], ax: matplotlib.axes.Axes, time_step: int, text=True, variable: Literal[water level, water depth, discharge, wetted sections, velocity, froude] = 'water level', alpha=0.7, rotation=30, ymax: float = None)[source]
Plot landmarks which are hydraulic structures (bridges, culverts, weirs, etc.) or any other point of interest in the river.
- Parameters:
landmark (Union[Zones,str]) – Landmark
ax (Axes) – Axes
time_step (int) – Time step
text (bool, optional) – Text, defaults to True
variable (Literal['water level', 'water depth', 'discharge', 'wetted sections','velocity', 'froude'], optional) – Variable, defaults to ‘water level’
alpha (float, optional) – Alpha, defaults to 0.7
rotation (int, optional) – Rotation, defaults to 30
ymax (float, optional) – Ymax, defaults to None
- _river_banksbed(bedbanks: wolfhece.PyVertexvectors.Zones | str, zone_id: int = 0)[source]
Set the river banks (left and right) and update the curviligne coordinates (self.s_coords) used for plotting (projections).
self.s_curvi = projections of lowest bed points on the mid-river bed vector (from _banksbed.vec),
self.left_bank_curvi = projections of left bank on the mid_river bed vector,
self.right_bank_curvi = projections of right bank on the mid_river bed vector.
- Parameters:
bedbanks (Union[Zones,str]) – Bedbanks
zone_id (int, optional) – Zone id, defaults to 0
- Update_curviline_coordinates()[source]
Update initial curviligne coordinates of the river bed (self.s_coords) projected curviligne coordinate (self.s_curvi).
- _yticks_update(y_max)[source]
Update the yticks of the graph.
- Parameters:
y_max (float) – Y max
- Returns:
Grid y
- Return type:
float
- _xticks_update(x_max)[source]
Update the xticks of the graph.
- Parameters:
x_max (float) – x max
- Returns:
Grid x
- Return type:
float
- _xticks_update_time(x_max)[source]
Update the xticks of the graph.
- Parameters:
x_max (float) – X max
- Returns:
Grid x
- Return type:
float
- return_only_width(depth: float, prof: wolfhece.PyCrosssections.profile) float [source]
Return the width of the profile for a given depth.
- Parameters:
depth (float) – Depth
prof (profile) – Profile
- Returns:
Width
- Return type:
float
- find_width_from_sz(depth: float, s: list, z: list) float [source]
Find the width from the s and z coordinates.
- Parameters:
depth (float) – Depth
s (list) – S
z (list) – Z
- Returns:
Width
- Return type:
float
- find_breadth_file(index)[source]
Find the breadth file.
- Parameters:
index (int) – Index
- Returns:
Relations
- Return type:
np.array
- create_widths_and_froudes()[source]
Create the widths and Froudes. Write the .RWIDTH file which contains the simulated top widths by the model. This file is used to compute the Froude number.
- _compute_froude(cross_sections: wolfhece.PyCrosssections.crosssections, riverbed: wolfhece.PyVertexvectors.vector | wolfhece.PyVertexvectors.Zones | str = vector, zone_index: int = 0, vector_index: int = 0)[source]
Deprecated
- find_max(array: numpy.ndarray) float [source]
Find the maximum value of an array.
- Parameters:
array (np.ndarray) – Array
- Returns:
Maximum
- Return type:
float
- update_yaxis(ax: matplotlib.axes.Axes, ymax: float, ymin=None)[source]
Update the y-axis.
- Parameters:
ax (Axes) – Axes
ymax (float) – Y max
ymin (Union[float, None], optional) – Y min, defaults to None
- find_figures_characteristics(axes_for_updates: list[tuple[matplotlib.lines.Line2D, matplotlib.axes.Axes, matplotlib.figure.Figure]], figures: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'])[source]
Return the right index of axes to be plotted.
- Parameters:
axes_for_updates (list[tuple[Line2D, Axes,Figure]]) – Axes for updates
figures (list[Literal['water level', 'discharge', 'wetted section','water depth', 'velocity', 'froude']], optional) – Figures, defaults to [‘water level’, ‘discharge’, ‘wetted section’,’water depth’, ‘velocity’, ‘froude’]
- Returns:
Indices
- Return type:
dict
- plot_nodes_evolution(which_nodes: list[int] = [0, -1], variable_name: Literal[water level, discharge, wetted section, water depth, velocity, froude] = 'discharge', save_as: str = '', figure_size=(25, 15), linewidth=2.0, plotting_style: Literal[scatter, line, combined] = 'line')[source]
Plot the evolution in time of specified nodes for a variable.
- Parameters:
which_nodes (list[int], optional) – nodes for which the results will be displayed on the hydrograph,defaults to [0,-1]
variable_name (Literal['water level', 'discharge', 'wetted section','water depth', 'velocity', 'froude'], optional) – the variable to plot , defaults to ‘discharge’
save_as (str, optional) – File path where the figure is saved, defaults to ‘’
figure_size (tuple, optional) – Figure size, defaults to (25,15)
linewidth (float, optional) – Linewidth on the graph (matplotlib format), defaults to 2.
plotting_style (Literal['scatter','line', 'combined'], optional) – Plotting style (matplotlib format), defaults to ‘line’
- plot_hydrograph_nodes(which_nodes: list[int] = [0, -1], save_as: str = '', figure_size=(25, 15))[source]
This method is deprecating. Plot nodes evolution provides more flexibility Plot the evolution in time of the discharge.
- Parameters:
which_nodes (list[int], optional) – _description_, defaults to [0,-1]
save_as (str, optional) – file path, defaults to ‘’
figure_size (tuple, optional) – Figure size, defaults to (25,15)
- class wolfhece.Model1D.MultipleWolfresults_1D(simulations: list[str], model_index: int = 0, figures: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'], time_step: int = -1, banksbed: Union[str, wolfhece.PyVertexvectors.Zones] = '', landmark: Union[str, wolfhece.PyVertexvectors.Zones] = '', save_as: str = '', figsize: tuple = (25, 15), alpha=0.3, line_width=2.0, show=False)[source]
This class is used to plot multiple Wolf 1D results on the same figure.
It is a wrapper around Wolfresults_1D class.
The main goal is to plot the temporal and spatial evolution of the water level, discharge, wetted section, water depth, velocity and Froude Number for different simulations.
- create_graph(show_landmarks=False)[source]
Create the initial figure on which other simulated results will be added.
- Parameters:
show_landmarks (bool, optional) – Show landmarks, defaults to False
- __plot_variable_lines(names: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'])[source]
Plot variable lines.
- Parameters:
names (list[Literal['water level', 'discharge', 'wetted section','water depth', 'velocity', 'froude']], optional) – Names, defaults to [‘water level’, ‘discharge’, ‘wetted section’,’water depth’, ‘velocity’, ‘froude’]
- _update_landmark(ax: matplotlib.axes.Axes, name: str, ymax: float)[source]
Update the landmark.
- Parameters:
ax (Axes) – Axes
name (str) – Name
ymax (float) – Y max
- plot_one_results(model_index: int = 0, time_step: int = -1, figures: list[Literal[water level, discharge, wetted section, water depth, velocity, froude]] = ['water level', 'discharge', 'wetted section', 'water depth', 'velocity', 'froude'], banksbed: Union[str, wolfhece.PyVertexvectors.Zones] = '', landmark: Union[str, wolfhece.PyVertexvectors.Zones] = '', save_as: str = '', figsize: tuple = (25, 15), alpha=0.3, grid_x_m: float = 1000.0, grid_y_m: float = 10.0, convert_step=True, steps_limit=False)[source]
Plot one results.
- Parameters:
model_index (int, optional) – Model index, defaults to 0
time_step (int, optional) – Time step, defaults to -1
figures (list[Literal['water level', 'discharge', 'wetted section','water depth', 'velocity', 'froude']], optional) – Figures, defaults to [‘water level’, ‘discharge’, ‘wetted section’,’water depth’, ‘velocity’, ‘froude’]
banksbed (Union[str, Zones], optional) – Banksbed, defaults to ‘’
landmark (Union[str,Zones], optional) – Landmark, defaults to ‘’
save_as (str, optional) – Save as, defaults to ‘’
figsize (tuple, optional) – Figure size, defaults to (25,15)
alpha (float, optional) – Alpha, defaults to 0.3
grid_x_m (float, optional) – Grid x m, defaults to 1000.
grid_y_m (float, optional) – Grid y m, defaults to 10.
convert_step (bool, optional) – Convert step, defaults to True
steps_limit (bool, optional) – Steps limit, defaults to False
- class wolfhece.Model1D.ModifyParams(simulation_folder: str = '')[source]
Modify the parameters of an existing simulation using the Wolf_Param module.
- find_simulation_file(file_extension: str, folder: str = '')[source]
Find a simulation file in a simulation folder based on the file extension.
Note
FIXME: Insert a checking test for double files with the same extension.
- Parameters:
file_extension (str) – File extension
folder (str, optional) – Folder, defaults to ‘’
- Returns:
File path
- Return type:
str
- modify_params_existing_simulation(simulation_folder: str = '', parent=None, w: int = 460, h: int = 560, ontop: bool = False, to_read: bool = True, withbuttons: bool = True, DestroyAtClosing: bool = True, toShow: bool = True, init_GUI: bool = True, force_even_if_same_default: bool = False)[source]
Modify the parameters of an existing simulation using the Wolf_Param module.
- Parameters:
simulation_folder (str, optional) – Simulation folder, defaults to ‘’
parent (None, optional) – Parent, defaults to None
w (int, optional) – Width, defaults to 460
h (int, optional) – Height, defaults to 560
ontop (bool, optional) – Ontop, defaults to False
to_read (bool, optional) – To read, defaults to True
withbuttons (bool, optional) – Withbuttons, defaults to True
DestroyAtClosing (bool, optional) – DestroyAtClosing, defaults to True
toShow (bool, optional) – To show, defaults to True
init_GUI (bool, optional) – Init GUI, defaults to True
force_even_if_same_default (bool, optional) – Force even if same default, defaults to False
- run_simulation(simulation_folder: str = '')[source]
Run a wolf model with the .bat file in the simulation folder.
- Parameters:
simulation_folder (str, optional) – Simulation folder, defaults to ‘’