Metadata-Version: 2.1
Name: wandatoolbox
Version: 0.0.5
Summary: Python toolbox for Wanda
Home-page: https://github.com/MichielTukker/WandaToolbox
Author: Michiel Tukker
Author-email: Michiel.Tukker@deltares.nl
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Information Technology
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: pywanda (>=0.4.1)
Requires-Dist: matplotlib (>=3.1.3)
Requires-Dist: pandas (>=1.0.1)
Requires-Dist: numpy (>=1.18.1)
Provides-Extra: dev
Requires-Dist: pytest (==5.3.5) ; extra == 'dev'
Requires-Dist: bump2version (==1.0.0) ; extra == 'dev'

![Python package](https://github.com/MichielTukker/WandaToolbox/workflows/Python%20package/badge.svg)

# Wanda Toolbox
Toolbox (python scripts) for Wanda modellers

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

## Installation
Run the following to install this package:

```
pip install WandaToolbox
```

Also see: https://pypi.org/project/wandatoolbox/

## Usage
Generic usage of the WandaPlot classes:
```python
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',
         company_image=plt.imread('WandaToolbox\data\DELTARES_ENABLING_CMYK.png'),
         fontsize=10)
    pdf.savefig()
    plt.close()
```

Generic usage of the monte-carlo class:
```python
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.run()
    analysis.plot_results(filename_prefix="test", width=1000, height=800)
    analysis.cleanup()


if __name__ == "__main__":
    main()  # This main() method is essential due to the way Python's multiprocessing module works
```
# Support
No official support! For questions/improvements/comments, contact Deltares or Wanda support desk?



