hydrowizard package

Subpackages

Submodules

hydrowizard.basin module

class hydrowizard.basin.Basin(basin_config=None, nodes_config=None, flows_config=None, objectives_config=None, basin_data_dir=None, output_dir=None)[source]

Bases: object

add_flows_to_nodes()[source]
calculate_integration_interval_count()[source]
calculate_integration_interval_start_end_times()[source]
static calculate_power_generation(flow_rate, reservoir_head, turbine_head, efficiency, max_power, rho=1000, g=9.81)[source]

Calculate the power generation based on inflow rate, reservoir head, turbine head, efficiency, and max power.

calculate_simulation_end_time()[source]
check_basin_graph()[source]
compute_annual_hydropower_generation(df_flow_rates, df_node_volumes, node_name, round_decimals=2)[source]

Compute the annual hydropower generation for each hydropower plant.

compute_hypervolume(F)[source]
compute_objectives(df_flow_rates, df_node_volumes, round_decimals=2)[source]
compute_quantile_monthly_demand_deficit(df_flow_rates, flow_name, quantile, round_decimals=2)[source]
create_base_flow_rates_dataframe()[source]
create_base_node_volumes_dataframe()[source]
static create_basin_from_yaml(filepath, simulation_horizon=None, integration_interval_duration=None, output_dir='outputs/')[source]
create_basin_graph()[source]
create_demand_rates_for_cyclostationarity_interval_number_dataframe()[source]
create_evaporation_rates_of_evaporation_flows_for_cyclostationarity_interval_number_dataframe()[source]
create_flow_rates_of_x_flows_for_cyclostationarity_interval_number_dataframe()[source]
create_flows()[source]
create_nodes()[source]
create_rbf_network_for_basin(parameters=None)[source]
export_basin_graph(output_dir=None, filename='basin', format='pdf')[source]
export_basin_graphs_for_intervals(interval_list, df_flow_rates, df_node_volumes, output_dir=None, format='pdf')[source]
export_config(filename, additional_info)[source]
generate_cyclostationarity_interval_numbers()[source]
get_all_flows()[source]
get_all_nodes()[source]
get_best_solution_indices(F, print_results=False)[source]
get_evaporation_flow_rates_for_interval(df_flow_rates, df_node_volumes, interval_index)[source]
get_inflows()[source]
get_l_flows()[source]
get_mean_monthly_deficit_percentage_dataframe(df_flow_rates, round_decimals=2)[source]
get_mean_monthly_deficit_rates_dataframe(df_flow_rates, round_decimals=2)[source]
get_mean_monthly_demand_rates_dataframe()[source]
get_mean_monthly_flow_rates_dataframe(df_flow_rates, round_decimals=2)[source]
get_normalized_policy_inputs_for_interval(df_flow_rates, df_node_volumes, interval_index)[source]
get_outflows()[source]
get_policy_decisions_using_rbf_network(policy_function, policy_inputs)[source]
get_policy_inputs_for_interval(df_flow_rates, df_node_volumes, interval_index)[source]
get_policy_outputs_for_interval(policy_function, df_flow_rates, df_node_volumes, interval_index)[source]
get_power_generation(df_flow_rates, df_node_volumes)[source]
get_r_flows()[source]
get_reservoir_nodes()[source]
get_sorted_node_names()[source]
get_x_flows()[source]
initialize_basin()[source]
normalize_policy_inputs(policy_inputs)[source]
parse_rate_input(rate_input)[source]
plot_demand_deficit_percentages(flow_rates, subset=None, max_plots_per_row=3)[source]
plot_demand_deficit_rates(flow_rates, subset=None, max_plots_per_row=3)[source]
plot_flow_rates(flow_rates, subset=None, max_plots_per_row=3)[source]
plot_node_volumes(node_volumes, subset=None, max_plots_per_row=3)[source]
plot_power_generation(flow_rates, node_volumes, subset=None, max_plots_per_row=3)[source]
print_basin_summary()[source]
static read_bathymetry_data(filepath)[source]

Reads bathymetry data from an Excel file and returns a DataFrame with renamed columns.

Args: filepath (str): Path to the Excel file containing bathymetry data.

Returns: pd.DataFrame: DataFrame containing the bathymetry data with renamed columns.

static read_mean_monthly_values_from_file(filepath, round_decimals=2)[source]

Creates a list of mean values from a given Excel file.

Args: filepath (str): Path to the Excel file containing flow data.

Returns: list: List of mean values for each month.

scale_policy_outputs(policy_outputs)[source]
set_cyclostationarity_interval_count()[source]
set_evaporation_flow_name_for_reservoir_node_name()[source]
set_hydropower_plants_properties()[source]
set_initial_node_volumes()[source]
set_maximum_objective_scores()[source]
set_minimum_objective_scores()[source]
set_months_count_and_start_end_times()[source]
set_objectives_names()[source]
set_policy_inputs_max_values()[source]
set_policy_inputs_min_values()[source]
set_policy_inputs_names()[source]
set_policy_outputs_max_values()[source]
set_policy_outputs_min_values()[source]
set_policy_outputs_names()[source]
set_release_flow_name_for_reservoir_node_name()[source]
set_reservoir_node_name_for_evaporation_flow_name()[source]
set_reservoir_node_parameters()[source]

Sets bathymetry, max_volume, and initial_volumes for reservoir nodes in the basin.

Args: nodes_config (list): List of node configurations. basin_data_dir (str): Directory path where the data files are located.

simulate_basin(policy_function, end_interval=None, print_progress=True, export_results=False, output_dir=None)[source]
to_dict()[source]

Converts the Basin object to a dictionary for easy inspection.

update_system_state_for_interval(policy_function, df_flow_rates, df_node_volumes, interval_index, round_decimals=2)[source]
update_x_flow_rates_for_interval(df_flow_rates, interval_index)[source]
visualize(interval_index=None, df_flow_rates=None, df_node_volumes=None)[source]

hydrowizard.db_logging module

hydrowizard.db_logging.create_db_engine_and_session(config)[source]
hydrowizard.db_logging.get_combined_pareto_front(basin, include_intermediate_results=False)[source]
hydrowizard.db_logging.get_pareto_indices(scores)[source]
hydrowizard.db_logging.get_previous_generations_results(basin)[source]
hydrowizard.db_logging.get_previous_optimization_results(basin)[source]
hydrowizard.db_logging.get_unique_indices(X)[source]
hydrowizard.db_logging.load_config(file_path='config.ini')[source]
hydrowizard.db_logging.log_optimization_generation(run_id, generation_number, start_time, end_time, duration, population_size, hypervolume, best_X, best_F)[source]
hydrowizard.db_logging.log_optimization_run_end(run_id, results)[source]
hydrowizard.db_logging.log_optimization_run_start(id, basin, population_size, num_generations, random_seed, biased_initial_population)[source]

hydrowizard.flow module

class hydrowizard.flow.Flow(name, kind, source_node=None, target_node=None, max_rate=None)[source]

Bases: object

to_dict()[source]

hydrowizard.node module

class hydrowizard.node.Node(name, reservoir_node=False)[source]

Bases: object

convert_volume_to_surface_head(volume, round_decimals_surface=1, round_decimals_head=5)[source]
to_dict()[source]

hydrowizard.optimization module

class hydrowizard.optimization.MultiObjectiveBasinProblem(config_file, simulation_horizon, interval_duration, **kwargs)[source]

Bases: ElementwiseProblem

hydrowizard.rbf_network module

class hydrowizard.rbf_network.RBFNetwork(input_dim, output_dim, centers, betas, weights)[source]

Bases: object

evaluate(x)[source]
rbf(x, center, beta)[source]

Module contents