wolfhece.scenario.config_manager

Author: HECE - University of Liege, Pierre Archambeau 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

wolfhece.scenario.config_manager.delete_folder(pth: pathlib.Path)[source]
class wolfhece.scenario.config_manager.GPU_2D_file_extensions[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.scenario.config_manager.GPU_2D_file_extensions

Generic enumeration.

Derive from this class to define new enumerations.

TIF = '.tif'[source]
TIFF = '.tiff'[source]
PY = '.py'[source]
NPY = '.npy'[source]
BIN = '.bin'[source]
JSON = '.json'[source]
TXT = '.txt'[source]
class wolfhece.scenario.config_manager.IC_scenario[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.scenario.config_manager.IC_scenario

Generic enumeration.

Derive from this class to define new enumerations.

WATERDEPTH = 'h.npy'[source]
DISCHARGE_X = 'qx.npy'[source]
DISCHARGE_Y = 'qy.npy'[source]
BATHYMETRY = 'bathymetry.npy'[source]
wolfhece.scenario.config_manager.ALL_EXTENSIONS[source]
wolfhece.scenario.config_manager.WOLF_UPDATE = 'Wolf update'[source]
wolfhece.scenario.config_manager.WOLF_BC = 'Wolf boundary conditions'[source]
wolfhece.scenario.config_manager.OTHER_SCRIPTS = 'Other scripts'[source]
wolfhece.scenario.config_manager.IS_SIMUL = 'is_simul'[source]
wolfhece.scenario.config_manager.IS_SCENARIO = 'is_scenario'[source]
wolfhece.scenario.config_manager.IS_RESULTS = 'is_results'[source]
wolfhece.scenario.config_manager.HAS_RESULTS = 'has_results'[source]
wolfhece.scenario.config_manager.MISSING = 'missing'[source]
wolfhece.scenario.config_manager.SUBDIRS = 'subdirs'[source]
wolfhece.scenario.config_manager.DISCHARGES = 'discharges'[source]
wolfhece.scenario.config_manager.INITIAL_CONDITIONS = 'initial_conditions'[source]
wolfhece.scenario.config_manager._gpu_file[source]
class wolfhece.scenario.config_manager.GPU_2D_file[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.scenario.config_manager.GPU_2D_file

Generic enumeration.

Derive from this class to define new enumerations.

PARAMETERS[source]
BATHYMETRY[source]
WATER_DEPTH[source]
DISCHARGE_X[source]
DISCHARGE_Y[source]
MANNING[source]
COMPUTATION_MASK[source]
INFILTRATION[source]
wolfhece.scenario.config_manager.RESULT_DIR = 'simul_gpu_results'[source]
class wolfhece.scenario.config_manager.Hydrograph_scenario(fname: pathlib.Path, sep: str = '\t', decimal='.')[source]

Hydrograph for a scenario

property name: str[source]
property data: pandas.DataFrame[source]
plot(figax=None)[source]
class wolfhece.scenario.config_manager.InitialConditions_scenario(dir: pathlib.Path)[source]

Initial conditions for a scenario

property z_elevation: numpy.ndarray[source]

Return the elevation of the water surface

set_h_from_z(z: numpy.ndarray)[source]

Set the water depth from the elevation of the water surface

save(dir: pathlib.Path)[source]

Save the initial conditions

class wolfhece.scenario.config_manager.Config_Manager_2D_GPU(workingdir: str = '', mapviewer: wolfhece.PyDraw.WolfMapViewer = None)[source]

Gestionnaire de configurations 2D - code GPU

property epsilon[source]
property filter_independent[source]
property txtctrl[source]
load_data()[source]

Chargement/Rechargement des données

_scan_dir(wd: pathlib.Path, curdict: dict)[source]

Scan récursif d’un répertoire de base et création de sous-dictionnaires

scan_wdir()[source]

Récupération de tous les répertoires et sous-répertoires et placement dans le dictionnaire self.configs

get_header() wolfhece.wolf_array.header_wolf[source]

Get header from .tif file

_get_header(filearray: pathlib.Path) wolfhece.wolf_array.header_wolf[source]

Get header from .tif file

get_all_numpy() list[pathlib.Path][source]

Get all numpy files

get_all_tif() list[pathlib.Path][source]

Get all tif files

get_all_sims() list[pathlib.Path][source]

Get all simulation files

_flatten_configs() list[dict][source]

flatten configs

check_consistency() str[source]

Check consistency of all files

All numpy files must have the same shape as the tif file in the root directory All hydrographs must have the same number of columns

_find_files_subdirs(wd: pathlib.Path, curdict: dict)[source]

Recherche des fichiers de simulation/scenario dans un répertoire

_recursive_find_files(wd: pathlib.Path, curdict: dict)[source]

Recherche récursive des fichiers de simulation/scenario dans les répertoires dont la structure a été traduite en dictionnaire

_prefill_dict(curdict: dict)[source]

Création des listes pour toutes les extensions

_test_is_simul(curdict: dict)[source]

Teste si le répertoire contient des fichiers de simulation

_test_is_scenario(curdict: dict)[source]

Teste si le répertoire contient des fichiers de scénario

_test_is_results(curdict: dict)[source]

Teste si le répertoire contient des fichiers de résultats

find_files()[source]

Recehrche des fichiers de simulation/scenario dans les répertoires dont la structure a été traduite en dictionnaire

get_tree(from_path: pathlib.Path) list[pathlib.Path][source]

Get tree from a path

Fnd all directories from the current path to the working directory

get_dicts(from_tree: list[pathlib.Path]) list[dict][source]

Get dicts from a tree

_select_tif_partname(curdict: dict, tifstr: Literal[bath, mann])[source]

Select tif files with a ‘str’ in their name

check_nodata(from_path: pathlib.Path)[source]

Check nodata in a path

create_vrt(from_path: pathlib.Path)[source]

Create a vrt file from a path

create_vec(from_path: pathlib.Path, which: Literal[bath, mann, infil] = 'bath') wolfhece.PyVertexvectors.Zones[source]

Create a vec file from a path

translate_vrt2tif(from_path: pathlib.Path)[source]

Translate vrt to tif

_import_scripts_topo_manning(from_path: pathlib.Path) list[types.ModuleType][source]

find all scripts from/up a path

_apply_scripts_update_topo_maning_inf(modules: list[types.ModuleType], array_bat: wolfhece.wolf_array.WolfArray, array_mann: wolfhece.wolf_array.WolfArray, array_inf: wolfhece.wolf_array.WolfArray)[source]

Apply all scripts from a list of modules

_import_scripts_bc(from_path: pathlib.Path) list[types.ModuleType][source]

find all scripts from/up a path

_apply_scripts_bc(modules: list[types.ModuleType], sim: wolfgpu.simple_simulation.SimpleSimulation)[source]

Apply all scripts from a list of modules

load_hydrograph(path: pathlib.Path, toplot=True) tuple[Hydrograph_scenario, matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Load hydrograph from a path

load_ic(path: pathlib.Path) InitialConditions_scenario[source]

Load initial conditions from a path

get_hydrographs() list[wolfhece.PyHydrographs.Hydrograph][source]

Get all hydrographs

get_initial_conditions() list[InitialConditions_scenario][source]

Get all initial conditions

get_names_hydrographs() list[str][source]
get_name_initial_conditions() list[str][source]
create_void_infil()[source]

create void infiltration_zones file

create_simulation(dir: pathlib.Path, idx_hydros: list[int] = [-1], delete_existing: bool = False, preserve_ic: bool = False) list[pathlib.Path][source]

Create a simulation from different hydrographs

create_batch(path: pathlib.Path, allsims: list[pathlib.Path]) str[source]

Create a batch file

run_batch(batch: pathlib.Path)[source]

run a batch file in a subprocess

get_mapviewer()[source]

Get the mapviewer object

transfer_ic(dir1: pathlib.Path, dir2: pathlib.Path)[source]

Transfer IC from one sim to another

extract_tif(from_path: pathlib.Path, to_path: pathlib.Path)[source]

Extract tif files from IC

class wolfhece.scenario.config_manager.UI_Manager_2D_GPU(data: dict, parent: Config_Manager_2D_GPU)[source]

User Interface for scenario 2D GPU

refill_data(data: dict)[source]

Fill tree with data

create_UI()[source]

Création de l’interface graphique

Partie latérale gauche - arbre des simulations Partie latérale droite - boutons d’actions Partie inférieure - affichage des informations

onchange_epsilon(e: wx.KeyEvent)[source]

Change epsilon value

onchange_filter(e: wx.MouseEvent)[source]

Change filter independent zones value

onupdate_structure(e: wx.MouseEvent)[source]

Mise à jour de la structure

oncreate_void_infil(e: wx.MouseEvent)[source]

Création d’un fichier d’infiltration vide

oncreate_void_scripts(e: wx.MouseEvent)[source]

Création d’un script vide

oncreatevrt(e: wx.MouseEvent)[source]

Création d’un fichier vrt

oncreatevec(e: wx.MouseEvent)[source]

Création d’un fichier vec

ontranslatevrt2tif(e: wx.MouseEvent)[source]

Traduction d’un fichier vrt en tif

oncheck_consistency(e: wx.MouseEvent)[source]

Vérification de la cohérence des fichiers

choice_hydrograph() list[int][source]
onextract_tif(e: wx.MouseEvent)[source]

Extraction des fichiers tif

ontransfer_ic(e: wx.MouseEvent)[source]

Transfert des conditions initiales

oncreate_simulation(e: wx.MouseEvent)[source]

Creation d’une simulation

onrun_batch(e: wx.MouseEvent)[source]

run batch file

onlist_simulation(e: wx.MouseEvent)[source]

List all simulations and print infos in text control

get_sims_only(force=False)[source]

Get paths to all or selected simulations

OnCheckItem(e)[source]

All levels under the item are checked/unchecked

_callbackwp()[source]

Callback for wolfparam

_callbackwp_destroy()[source]

Callback for wolfparam

OnActivateTreeElem(e)[source]

If you double click on a tree element

filter_independent_zones(n_largest: int = 1, icpath: pathlib.Path = None)[source]

Filtre des zones indépendantes et conservation des n plus grandes

clear_text()[source]

Reset txt control

_open_script(mydata: pathlib.Path, wolf: bool = False)[source]

Open the script in the editor

_append_configs2tree(curdict: dict, root: wx.dataview.TreeListItem)[source]

Ajout des éléments du dictionnaire dans l’arbre sur base de la racine fournie