Skip to main content

Python toolbox for Wanda

Project description

Python package

Wanda Toolbox

Toolbox (python scripts) for Wanda modellers

This toolbox includes several tools and utilities that can help with Wanda modelling and running simulations.


Run the following to install this package:

pip install WandaToolbox


Generic usage of the WandaPlot classes:

from wandatoolbox.wanda_plot import PlotSyschar, PlotText, PlotTable, PlotImage, plot
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import pandas as pd
import pywanda as pw

model = pw.WandaModel(r'c:\Wandamodel.wdi', 'c:\Wanda 4.6\Bin\\')

with PdfPages(f'Document.pdf') as pdf:
    img = plt.imread('WandaToolbox\data\DELTARES_ENABLING_CMYK.png')
    df = pd.read_excel(r'example_data\syschar_test.xlsx', header=0, index_col=0)
    scenario_names = ["Current min", "Current max", "Future min", "Future max"]

    subplots_table = [
        PlotTable(df, ['description', "Current min", "Current max", "Future min", "Future max"]), 
        PlotImage(img), PlotText("Yada yada yada"), 
        PlotSyschar("BOUNDQ B1", 105.0, "Supplier #1", df, 'Wanda_name', 
        scenario_names, 3, "Industry description", 'Discharge (m3/day)', 'Head (m)')
    plot(model, subplots_table,
         'Main title',
         f'Subtitle 1',
         'Subtitle 2',
         'Subtitle 3',
         'Subtitle 4',
         f'Figure number: 1',

Generic usage of the monte-carlo class:

from wandatoolbox.analysis.monte_carlo import MonteCarloInputProperty, MonteCarloOutputProperty, WandaMonteCarlo
import pywanda as pw
import os

def main():
    wandacase_fullpath = os.path.join(os.getcwd(), "Sewage_transient.wdi")
    wanda_bin_directory = r'c:\Program Files (x86)\Deltares\Wanda 4.6\Bin\\'
    model = pw.WandaModel(wandacase_fullpath, wanda_bin_directory)
    parameters = [MonteCarloInputProperty(" PIPES", "Wall roughness", 2.5 / 1000, 0.5 / 1000, "normal", True)]
    outputs = [MonteCarloOutputProperty(" PIPES", "Pressure", keyword=True, extreme="MIN"),
               MonteCarloOutputProperty(" PIPES", "Pressure", keyword=True, extreme="MAX")]
    analysis = WandaMonteCarlo(model, parameters, outputs, nruns=25, n_workers=2)
    analysis.plot_results(filename_prefix="test", width=1000, height=800)

if __name__ == "__main__":
    main()  # This main() method is essential due to the way Python's multiprocessing module works


No official support! For questions/improvements/comments, contact Deltares or Wanda support desk?

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wandatoolbox, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size wandatoolbox-0.0.4-py3-none-any.whl (21.2 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page