wolfhece.pyGui1D

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.pyGui1D.Constants[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pyGui1D.Constants

Constants used by this module.

BANK_WIDTH = 1[source]
CENTERED_TEXT[source]
DPI = 60[source]
FRAMESIZE = (460, 560)[source]
GENERAL_FONTSIZE = 'small'[source]
GRAVITATION = 9.81[source]
GRIDSIZE = (280, 540)[source]
NULL[source]
NUMBER_OF_PAGES = 4[source]
POLYGONE_NUMBER = 1[source]
PRECISION = ':#.20F'[source]
SEPARATOR = '\t'[source]
BATHYMETRY = 'Bathymetry'[source]
BED_AND_BANKS = 'bank and bed'[source]
CROSS_SECTIONS = 'cross sections'[source]
FRICTIONS = 'frictions'[source]
GUI_ID_BATHYMETRY[source]
GUI_ID_BED_AND_BANKS[source]
GUI_ID_CROSS_SECTION[source]
GUI_ID_FRICTION[source]
GUI_ID_LANDMARK[source]
LANDMARK = 'Landmarks'[source]
NAME_PREFIX[source]
MAPVIEWER_SELECT_NEAREST_PROFILE = 'Select nearest profile'[source]
MAPVIEWER_SET_1D_PROFILE = 'Set 1D profile'[source]
class wolfhece.pyGui1D.Titles[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pyGui1D.Titles

Titles (string names) of buttons, menus, etc, used by this module and seen in the interface.

@ the sign _() enclosing strings is required for translation purposes (see .pytranslate).

ADD[source]
ADD_BATHYMETRY[source]
ADD_BED_AND_BANKS[source]
ADD_CROSS_SECTIONS[source]
ADD_FRICTIONS[source]
ADD_LANDMARKS[source]
AVAILABLE_DATA[source]
BATHYMETRIC_DATA[source]
BC_CONDITIONS[source]
BC_DISCHARGE_3[source]
BC_DOWNSTREAM[source]
BC_FREE_5[source]
BC_FROUDE_4[source]
BC_IMPERVIOUS_99[source]
BC_JUNCTION_100[source]
BC_MOBILE_DAM_127[source]
BC_UPSTREAM[source]
BC_VALUE[source]
BC_WATER_DEPTH_1[source]
BC_WATER_LEVEL_2[source]
BED_BANKS[source]
BETWEEN_PROFILES[source]
BRANCH[source]
COMPUTATION_DATA[source]
COMPUTATION_MODE[source]
CROSS_SECTIONS_CATEGORY[source]
CROSS_SECTIONS_DATA[source]
EPSILON[source]
EVOLUTIVE[source]
EXECUTABLE[source]
FIXED[source]
FORCE_VALUE[source]
FRICTION_DATA[source]
GUI_GRID_BOUNDARY_CONDITIONS[source]
HYDROGRAPH_PREPROCESS[source]
INFILTRATIONS[source]
LANDMARK_DATA = 'Landmarks'[source]
MAIN = 'Main'[source]
MAXIMUM[source]
MEAN[source]
MEDIAN[source]
MESSAGE_AGGLOMERATION_FRICTIONS[source]
MESSAGE_BUTTON_PARAMETERS[source]
MESSAGE_BUTTON_SAVE[source]
MESSAGE_COMPUTATION_MODE[source]
MESSAGE_DATA[source]
MESSAGE_DISCHARGE[source]
MESSAGE_EPSILON[source]
MESSAGE_EXECUTABLE = 'Left double click -> To provide the wolf executable.'[source]
MESSAGE_EXTREMITIES[source]
MESSAGE_FILE_FORMAT[source]
MESSAGE_FORCED_VALUE[source]
MESSAGE_HYDROGRAPH_PREPROCESS[source]
MESSAGE_MODE_FRICTIONS = 'The frictions values are forced or collected from the 2D array of frictions.'[source]
MESSAGE_RUN[source]
MESSAGE_STEADINESS[source]
MESSAGE_WATER_DEPTH[source]
MINIMUM[source]
NO_PRECOMPUTATION[source]
NO_PREPROCESSING[source]
PARAMETERS[source]
PRECOMPUTATION[source]
PREPROCESS_OPTIONS[source]
RAISE_EXTREMITIES[source]
RUN_SIMULATION[source]
SAVE[source]
STEADINESS = 'Steadiness'[source]
STEADY[source]
STEPWISE[source]
UNDER_PROFILES[source]
VERBOSITY[source]
WOLF_PARAM_WINDOW[source]
WOLFCLI = 'Wolfcli'[source]
WOLFCLID = 'Wolfclid'[source]
WX[source]
class wolfhece.pyGui1D.Colors[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pyGui1D.Colors

Color names and parameters used in this module.

BED = 'black'[source]
LEFT_BANK = 'red'[source]
MATPLOTLIB_CYCLE[source]
PROPOSED[source]
RIGHT_BANK = 'blue'[source]
TQDM = 'cyan'[source]
WX = 'white'[source]
class wolfhece.pyGui1D.fileExtensions[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pyGui1D.fileExtensions

File extensions (end of file name after the dot) used in this module.

AINI = '.aini'[source]
BANKS = '.banks'[source]
BREADTH = '.breadth'[source]
CL = '.cl'[source]
CVG = '.cvg'[source]
DEPTH = '.depth'[source]
DIAM = '.diam'[source]
GTV = '.gtv'[source]
HELP = '.help'[source]
HINI = '.hini'[source]
INF = '.inf'[source]
INFIL = '.infil'[source]
LENGHTSVECZ = '_lengths.vecz'[source]
LENGTHS = '.lengths'[source]
PARAMETERS = '.param'[source]
PTV = '.ptv'[source]
QINI = '.qini'[source]
ROUGHNESS = '.rough'[source]
TOP = '.top'[source]
VECTOR2D = '.vec'[source]
VECTOR3D = '.vecz'[source]
WIDTH = ''[source]
ZINI = '.zini'[source]
class wolfhece.pyGui1D.Page(parent)[source]

Bases: wx.dataview.wx.Panel

Inheritance diagram of wolfhece.pyGui1D.Page

A wx.page format used by the different tabs.

@ Could be better customized though. It means don’t refrain your creativity.

class wolfhece.pyGui1D.GuiNotebook1D(page_names=[Titles.MAIN.value, Titles.INFILTRATIONS.value, Titles.BC_CONDITIONS.value, Titles.VERBOSITY.value, Titles.PARAMETERS.value], style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP, mapviewer=None)[source]

Bases: wx.dataview.wx.Frame

Inheritance diagram of wolfhece.pyGui1D.GuiNotebook1D

Notebook frame (GUI in wx) that allow a user to interact with a wolf-1D model.

Interaction means: (creation, execution and soon results visualization) of wolf-1D models.

array: wolfhece.wolf_array.WolfArray[source]
cross_section: wolfhece.PyCrosssections.crosssections[source]
zones: wolfhece.PyVertexvectors.Zones[source]
page_1: Page[source]
update_cells_name()[source]

Update the list of cells name.

Note

It’s basically the list of all cross sections minus the last one.

add_new_page(page: wx.dataview.wx.Panel, name: str, cells_related_page=True)[source]

Add a new page to the notebook.

Parameters:
  • page (wx.Panel) – The page panel

  • name (str) – page name to be used across the whole notebook

  • cells_related_page – The page is visible only when

cross sections are sorted, defaults to True :type cells_related_page: bool, optional

update_infiltrations_page()[source]

Create or recreate the infiltration page (tab).

update_boundary_conditions_page()[source]

Create or recreate the page of boundary conditions.

find_page_number(name: str) int[source]

Return the page index base on its name.

Parameters:

name (str) – page name used across the whole notebook.

Returns:

the page index

Return type:

int

delete_page(name: str)[source]

Delete a page based on its name.

Parameters:

name (str) – page name used across the whole notebook.

Delete all pages related to the cells name.

Empty the list of pages related to the cells name.

reset_cell_names()[source]

Delete the name of cells from the program.

enable_action_select_profile_in_mapviewer()[source]

Enable the selection, highlight, and plot of the nearest profile of the user’s click (right down) in the mapviewer interface (2D).

enable_action_set_1D_profile_in_mapviewer()[source]

Enable the selection, highlight, and plot of a profile in the mapviewer interface if the profile was selected in the notebook.

disable_action_in_mapviewer()[source]

Disable every action activated in the mapviewer interface (2D).

setting_active_profile_in_mapviewer()[source]

Set the active profile in the notebook as the active profile in the mapviewer.

double_click_methods(event: wx.propgrid.EVT_PG_DOUBLE_CLICK)[source]

Select the appropriated method based on its id if the double click event is called in the property grid.

Parameters:

event (pg.EVT_PG_DOUBLE_CLICK) – wx.Event

changing_methods(event: wx.propgrid.EVT_PG_CHANGED)[source]

Select the appropriated method based on its id if a property has changed event.

Parameters:

event (pg.EVT_PG_CHANGED) – wx.Event

tab_changed(event)[source]

Bind the right method for locating the selected cell (profile) when the page(tab) has changed.

The selection is based on the cell’s name displayed on the tree list.

Parameters:

event (wx.EVT_NOTEBOOK_PAGE_CHANGED) – wx.Event

element_selected_on_infitltration_tree(event: TreeListEvent)[source]

Bind the event tree list changed each time the selected cell is changed on the infiltration page.

Parameters:

event (TreeListEvent) – EVT_TREELIST_SELECTION_CHANGED

element_selected_on_bounds_conditions_tree(event: TreeListEvent)[source]

Bind the event tree list changed each time the selected cell is changed on the boundary condition page.

Parameters:

event (TreeListEvent) – EVT_TREELIST_SELECTION_CHANGED

get_page_hydrographs()[source]

Return the infiltration page (page of hydrographs).

Returns:

infiltration page

Return type:

MultigridPage

get_page_boundary_conditions()[source]

Return the page of boundary conditions.

Returns:

page of boundary conditions

Return type:

Boundary_condition_Page

set_active_profile(profile_name: str)[source]

In case the profile_name is in the list of sorted cross sections, that profile is set as the active profile in both the notebook and the mapviewer. Simultaneously, the action Set 1D profile in mapviewer is enabled.

Parameters:

profile_name (str) – name of the chosen profile.

add_object(file, id: str)[source]

Add the given wolfhece object in both the GUI and mapviewer.

Parameters:
  • file (every wolfhece.object) – the object to add

  • id (str) – object name displayed in mapviewer

Returns:

a boolean value for checking whether

the process succeeded or aborted. :rtype: bool

add_in_WolfMapViewer(file: str, id: str = '') int[source]

Add a new object in the interface by providing its path.

Parameters:
  • file (str) – object’s path (computer’s path)

  • id (str, optional) – object name displayed in mapviewer, defaults to ‘’

Returns:

a boolean value for checking whether

the process succeeded or aborted. :rtype: int

select_mapviewer_data(data_type: Literal[array, cross_sections, wolfhece.PyVertexvectors.vector])[source]

Return the selected data from the mapviewer.

Parameters:

data_type – type of the wolfhece.object to add

but should be among the implemented literals. :type data_type: Literal['array','cross_sections','vector'] :return: _description_ :rtype: wolfhece.object

get_object_from_WolfMapViewer(id: str)[source]

Get object from the interface (wolf map viewer) based on its id.

Parameters:

id (str) – object name displayed in mapviewer

Returns:

the chosen object

Return type:

wolfhece.object

add_crossections_from_menu(event: wx.dataview.wx.Event)[source]

Add a cross section file using the submenu.

Parameters:

event (wx.Event) – `wx.EVT_MENU

add_bed_and_banks_from_menu(event: wx.dataview.wx.Event)[source]

Add bed and banks using the submenu.

Parameters:

event (wx.Event) – wx.EVT_MENU

add_bathymetry_from_menu(event: wx.dataview.wx.Event)[source]

Add bathymetric array using the submenu.

Parameters:

event (wx.Event) – wx.EVT_MENU

add_friction_from_menu(event: wx.dataview.wx.Event)[source]

Add friction array using the submenu.

Parameters:

event (wx.Event) – wx.EVT_MENU

add_landmark_from_menu(event: wx.dataview.wx.Event)[source]

Add land marks from using the submenu.

Parameters:

event (wx.Event) – wx.EVT_MENU

add_crossection()[source]

Add or change the cross section.

add_bed_and_banks()[source]

Add or change the river and bank data.

add_bathymetry()[source]

Add or change the bathymetric data.

add_friction()[source]

Add or change the friction data.

add_landmark()[source]

Add or change the landmarks data.

add_executable()[source]

Add the path of the wolf executable which will be used by the GUI.

delete_data(variable_name: str, object_id: str)[source]

Delete an object from both the notebook and the interface (mapviewer).

Parameters:
  • variable_name (str) – object name used by the notebook

  • object_id (str) – name displayed in the mapviewer

remove_from_WolfMapViewer(id: str)[source]

Remove an object from the interface (mapviewer) based on its id.

Parameters:

id (str) – name displayed in the mapviewer

delete_crossection(remove_in_mapviewer=True)[source]

Delete the cross section from both this GUI and the interface.

Parameters:

remove_in_mapviewer – remove the object from the mapviewer

(this option skips the removal from mapviewer in case of unavailable object in the mapviewer), defaults to True :type remove_in_mapviewer: bool, optional

delete_bed_and_banks(remove_in_mapviewer=True)[source]

Delete the bed and banks from both this GUI and the interface.

Parameters:

remove_in_mapviewer – remove the object from the mapviewer

(this option skips the removal from mapviewer in case of unavailable object in the mapviewer), defaults to True :type remove_in_mapviewer: bool, optional

delete_bathymetry(remove_in_mapviewer=True)[source]

Delete the bathymetry from both this GUI and the interface.

Parameters:

remove_in_mapviewer – remove the object from the mapviewer

(this option skips the removal from mapviewer in case of unavailable object in the mapviewer), defaults to True :type remove_in_mapviewer: bool, optional

delete_friction(remove_in_mapviewer=True)[source]

Delete the friction from both this GUI and the interface.

Parameters:

remove_in_mapviewer – remove the object from the mapviewer

(this option skips the removal from mapviewer in case of unavailable object in the mapviewer), defaults to True :type remove_in_mapviewer: bool, optional

delete_land_mark(remove_in_mapviewer=True)[source]

Delete the landmarks from both this GUI and the interface.

Parameters:

remove_in_mapviewer – remove the object from the mapviewer

(this option skips the removal from mapviewer in case of unavailable object in the mapviewer), defaults to True :type remove_in_mapviewer: bool, optional

delete_line_in_txt_file(file_path: str, line_to_delete: str)[source]

Delete a specific line (known) in a given text file.

Parameters:
  • file_path (str) – computer path to the text file,

  • line_to_delete (str) – line that should be deleted.

update_data(variable_name: str, new_object_id: str)[source]

update (link) to the right data (object) in the interface.

Parameters:
  • variable_name (str) – new object’s name in this notebook.

  • new_object_id (str) – new object’s name in the mapviewer

correct_parameters(directory='')[source]

Correct the content of the parameter files (.param and .param.default created by the fortran executable.)

Parameters:

directory (str, optional) – computer’s path to the directory containing the files, defaults to ‘’

freeze_commands()[source]

Freeze most of the notebook commands to avoid manipulation errors.

Freeze all commands which require the presence of sorted cross sections.

Unfreeze all commands which require the presence of sorted cross sections.

enable_selection_mode_frictions()[source]

Enable the selection of a friction mode.

selection_friction_mode_changed()[source]

Based on a selected friction mode, enable either the option for agglomeration of friction or for forcing a unique friction value on all profiles.

enable_agglomeration_mode()[source]

Enable the agglomeration of frictions from a 2D array.

enable_forced_value()[source]

Enable the forcing of a unique friction value on all profiles.

chek_cross_sections()[source]

Check the property box of the cross section on the main page.

chek_bed_and_banks()[source]

Check the property box of the bed and banks on the main page.

chek_bathymetry()[source]

Check the property box of the bathymetry on the main page.

chek_friction()[source]

Check the property box of the friction on the main page.

chek_land_mark()[source]

Check the property box of the land marks on the main page.

enable_button_parameters()[source]

Allow the parameters button usage on the main page.

disable_button_parameters()[source]

Block the parameters button usage on the main page

enable_button_save()[source]

Allow the button save usage on the main page

disable_button_save()[source]

Block the button save usage on the main page

enable_infiltration_preprocess()[source]

Allow the choice between continuous hydrographs or a stepwise ones (pre-processed).

enable_initial_discharge()[source]

Enable the encoding of the initial disharge value.

disable_infiltration_preprocess()[source]

Restrict the choice between continuous hydrographs or a stepwise ones (pre-processed).

lock_executable()[source]

Block the manual selection of an executable type.

cross_check_sections()[source]

Automatically enable or disable the cross section property check box.

get_boundary_conditions() dict[source]

Return the dictionnary of boundary conditions.

Returns:

dictionnary of boundary conditions.

Return type:

dict

get_hydrographs() dict[source]

Return the dictionnary of hydrographs. (infiltrations).

Returns:

dictionnary of hydrographs

Return type:

dict

get_frictions()[source]

Return the friction values.

Raises:
  • Exception – in case friction values are still missing and wx.exist.

  • Exception – in case friction values are still missing

Returns:

friction values

Return type:

wolfarray or int

get_agglomeration_mode() str[source]

Return the agglomeration mode of frictions selected on the main page.

Returns:

agglomeration mode of values

(mean, median, min, max, etc). :rtype: str

get_roughness_option() str[source]

Return the selection mode of frictions chosen on the main page.

Returns:

selected mode

Return type:

str

get_initial_water_depth() float[source]

Return the encoded value of the initial water depth.

Returns:

intial water depth

Return type:

float

get_initial_discharge()[source]

Return the encoded value of the discharge.

Returns:

initial discharge

Return type:

float or None

get_ic_file_format() str[source]

Return the file format of intial conditions.

Returns:

file format

Return type:

str

get_infiltration_preprocess() str[source]

Return the selected mode in which the infiltrations hydrographs will be preprocessed.

Returns:

preprossing mode (stepwise or continuous)

Return type:

str

get_epsilon() float[source]

Return the margin used to preprocess the infiltrations in case the stepwise option is selected.

Returns:

epsilon (margin)

Return type:

float

get_computation_mode() str[source]

Return the computation mode used by the 1D executable.

Returns:

computation mode (evolutive or fixed)

Return type:

_type_

get_steadiness_mode() str[source]

Return the steadiness mode which will be used by the executable.

Returns:

steadiness mode

(No precomputation, precomputation, and steady) :rtype: str

get_executable() str[source]

Return the executable type to be used in .bat file.

Returns:

excecutable type (currently wolfcli and wolfclid)

Return type:

str

get_folder_executable() str[source]

return the computer path to the folder containing the executable.

Returns:

folder(computer path in full)

Return type:

str

get_run_command() str[source]

Return the status of the run command. whether the simulation should be run or not after its creation.

Returns:

status(yes or no)

Return type:

str

get_extrapolation_of_extremities() float[source]

Return the value encode in the extrapolation of extremities.

Returns:

Value of how far the 2 extremities of each

profile should be elevated vertically. :rtype: float

test_required_data() bool[source]

Test if all the required data are available to create and save a wolf 1D model.

Returns:

True or False

Return type:

bool

initialize_param_file()[source]

Create the parameters file (.param ` and `.param.default) from the wolf executable (.exe).

This method initialize a temporary directory in which it copies the executable and create 2 files create_simul.txt and temporary.bat.

  • The create_simul file contains the commands necessary

to generate the parameter files from the executable by just passing in the directory;

  • Whereas, the .bat file contains

a command to launch the executable (.exe).

After running the wolf executable (.exe), the param file created, is first corected and then copied in the simulation directory. This file is then read by wolfparam to allow the modification of parameters through the wolfparam window (wx.notebook).

initialize_file(directory_path: str, filename: str) str[source]

Initialize a computer path to a new file.

Parameters:
  • directory_path (str) – Path to the folder

  • filename (str) – filename

Returns:

full computer path to the new file

Return type:

str

click_on_parameters(event: wx.dataview.wx.Event)[source]
The click on the parameters button launch the process:
  • to create a simulatin directory (folder)

  • to initialize the param file

  • to disable the button parameters while enabling the button save.

Parameters:

event (wx.Event) – wx.EVT_BUTTON

create_simulation_directory() str[source]

Create and return the simulation directory.

Returns:

computer path to the folder

in which the simulation files wil be written. :rtype: str

infiltration_preprocess_changed()[source]

Manage the choice of the infiltration preprocessing mode.

close()[source]
quit(event: wx.dataview.wx.Event)[source]

Destroy safely this window from the menu.

Parameters:

event (wx.Event) – wx.event

onclose(event: wx.dataview.wx.Event)[source]
get_bathymetry()[source]

Return the bathymetry object from the notebook.

Returns:

bathymetry object

Return type:

WolfArray

button_save_clicked(event: wx.dataview.wx.Event)[source]

Gather all the inputs in the notebook and generate a 1D model (simulation).

Parameters:

event (wx.Event) – wx.EVT_BUTTON

Raises:

Exception – In case, the model fails to create the simulation

for whatever reasons.

__call_parameters()[source]

FIXME outdated no longer used A temporary .param file is created to initialize the panel of parameters.

If the panel is closed (destroyed), the information are lost.

FIXME wolf_Param should be a panel not a frame.

__click_on_parameters(event: wx.dataview.wx.Event)[source]
__button_save_clicked(event: wx.dataview.wx.Event)[source]

Display

__button_save_clicked(event: wx.dataview.wx.Event)[source]

Gather all the inputs in the notebook and generate a 1D model (simulation).

Parameters:

event (wx.Event) – wx.EVT_BUTTON

Raises:

Exception – In case, the model fails to create the simulation

for whatever reasons.

__add_bed_and_banks(event: wx.propgrid.EVT_PG_DOUBLE_CLICK)[source]

Add or change the river and bank data.

__delete_bed_and_banks(event: wx.propgrid.EVT_PG_CHANGED)[source]

Delete the bed and banks from both this GUI and the interface.

__add_crossection(event: wx.propgrid.EVT_PG_DOUBLE_CLICK)[source]

Add or change the cross section.

__delete_crossection(event: wx.propgrid.EVT_PG_CHANGED)[source]

Delete the cross section from both this GUI and the interface.

__create_id(curdict: dict, id: str = None) str[source]
Dialog box to create the object name
  • curdict: directory selfmapviewer

@ The object name is created at this step and then passed to the wolfpy interface with suffix to clearly distinguish the elements in use.

FIXME It would have been nice to have a select ID though.

__add_river_banks(event: wx.propgrid.EVT_PG_SELECTED)[source]
class wolfhece.pyGui1D.MultigridPage(parent)[source]

Bases: wx.dataview.wx.Panel

Inheritance diagram of wolfhece.pyGui1D.MultigridPage

Grid of hydrographs. It’s a plug and play panel on a given page. The panel contains a grid which allow the user to encode manually or automatically (upload) the hydrographs (infiltrations) of a 1D model.

Parameters:

wx (wx.panel) – The panel on which the grid is displayed.

tree_profiles(profile_names: list[str], title='Hydrographs', number_of_rows=1, number_of_columns=2)[source]

A table containing the daata.

Parameters:
  • profile_names (list[str]) – List of profile names

  • title – The page name that will be

displayed to the users, defaults to ‘Hydrographs’ :type title: str, optional :param number_of_rows: Intializes the numbers of rows (ent), defaults to 1 :type number_of_rows: int, optional :param number_of_columns: the number of columns in the grid (in case of new variables), defaults to 2 :type number_of_columns: int, optional .. todo:: FIXME add a graph plot between the variables and the buttons (to give to the user a visual trend the entries).

get_tree_list_first_item()[source]

Set the the first item on the tree list as the curname (current name).

Note

FIXME It still does not work properly.

get_name_of_selected_cell()[source]

Get the name of the selected cell.

Note

FIXME depreciating.

add_hydrographs_to_dict()[source]

Get the users inputs and append them to the page’s dictionary as the hydrograph associated to the key of the selected cell.

add_hydrographs_to_dict_wx(event: TreeListEvent)[source]

Add the hydrograph to the dictionnary through a wx.Event.

Parameters:

event (TreeListEvent) – wx.EVT_BUTTON

add_row(event: wx.dataview.wx.Event)[source]

Adds new row in the table of records (grid)

Parameters:

event (wx.Event) – wx.EVT_BUTTON

load_hydrogaph(event: wx.dataview.wx.Event)[source]

Load an hydrograph (list of discharges evolution through time) from a text file on the wolfhece hydrograph format.

Parameters:

event (wx.Event) – wx.EVT_BUTTON

delete_hydrograph_from_dict(event: wx.dataview.wx.Event)[source]

Removes the entry saved by the user on the selected cell.

Parameters:

event (wx.Event) – wx.EVT_BUTTON

block_check_item(event: wx.dataview.wx.Event)[source]

Controls which item is checked or not based on the mouse operations (events).

Parameters:

event (wx.Event) – EVT_TREELIST_ITEM_CHECKED

on_select_item(event: TreeListEvent)[source]

Return the name of the cell selected by the user after, displaying the infiltration informations on the screen.

Parameters:

event (TreeListEvent) – EVT_TREELIST_SELECTION_CHANGED

Returns:

name of the selected item

Return type:

str

load_from_Hydrograph(hydrograph: wolfhece.PyHydrographs.Hydrograph)[source]

Fills the grid of infiltration from the hydrograph object available from the wolfhece library.

Parameters:

hydrograph (Hydrograph) – Hydrrograph on the wolfhece format

class wolfhece.pyGui1D.Boundary_condition_Page(parent)[source]

Bases: wx.dataview.wx.Panel

Inheritance diagram of wolfhece.pyGui1D.Boundary_condition_Page

Grid of Boundary conditions. It’s a plug and play panel on a given page. The panel contains a grid which allow the user to encode manually or automatically (upload) the boundary conditions of a 1D model.

Parameters:

wx (_type_) – _description_

Note

FIXME it would have been nice to have unifom format

(file) of boundary conditions for all wolf models (1,2 or 3D). In that way, one class can be used to manage all operations regardless of the dimensions (1,2 or 3D).

tree_profiles(profile_names: list[str], title='Boundary conditions', number_of_rows=1, number_of_columns=2)[source]

A table containing the data.

Parameters:
  • profile_names (list[str]) – List of profile names.

  • title – The page name that will be

displayed to the users, defaults to ‘Boundary conditions’ :type title: str, optional :param number_of_rows: Intializes the numbers of rows (ent), defaults to 1 :type number_of_rows: int, optional :param number_of_columns: the number of columns in the grid (in case of new variables), defaults to 2 :type number_of_columns: int, optional

get_tree_list_first_item()[source]

Set the the first item on the tree list as the curname (current name).

Note

FIXME It still does not work properly.

add_boundary_conditions_to_dict()[source]

Get the users inputs and append them to the page’s dictionary. In the dictionnary, the boundary conditions are associated to the key of the selected cells.

convert_cell_side_value(value: int) str[source]

Return the location of the boundary condition on a selected cell (upstream or downstream).

Parameters:

value (int) – 1 for upstream or 2 for downstream

Returns:

upstream `or `downstream

Return type:

str

convert_type_boundary_condition(value: int) str[source]
Return the type of boundary condition

corresponding to the encoded integer.

Parameters:

value (int) – _description_

Returns:

_description_

Return type:

str

add_boundary_condition_to_dict_wx(event: TreeListEvent)[source]

Add the boundary condition to the dictionnary through a wx.Event.

Parameters:

event (TreeListEvent) – wx.EVT_BUTTON

delete_boundary_condition_from_dict(event: wx.dataview.wx.Event)[source]

Removes the entry saved by the user on specified cell.

Parameters:

event (wx.Event) – wx.EVT_BUTTON

block_check_item(event: wx.dataview.wx.Event)[source]

Controls which item is checked or not based on the mouse operations (events).

Parameters:

event (wx.Event) – EVT_TREELIST_ITEM_CHECKED

oncheckitem(event: TreeListEvent)[source]

Return the name of the cell selected by the user after, displaying the informations regarding the boundary conditions in the grid.

Parameters:

event (TreeListEvent) – EVT_TREELIST_SELECTION_CHANGED

Returns:

name of the selected item

Return type:

str

load_from_boundary_conditions(condition: tuple[str, str, float])[source]

Fills the grid of boundary conditions from a tuple containing:

  • condition[0] : cell side,

  • condition[1]: type of boundary condition,

  • condition[2]: Value of boundary condition.

Parameters:

condition (tuple[str, str, float]) – information about the boundary conditon.

reset_condition()[source]

Reset the information displayed in the grid to default values.