-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81e510b
commit f47f917
Showing
12 changed files
with
166 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contributing | ||
|
||
We'd love to accept your patches and contributions to this project. There are just a few small | ||
guidelines you need to follow. | ||
|
||
## Guidelines | ||
1. Write your patch | ||
1. Add a test case to your patch | ||
1. Make sure that all tests run properly | ||
1. Send your patch as a PR | ||
|
||
## Installation | ||
|
||
You can install the WandaToolbox package as follows: | ||
``` | ||
pip install wandatoolbox | ||
``` | ||
|
||
## Development installation and testing | ||
|
||
For development you can use the 'editable' installation: | ||
``` | ||
pip install -e . | ||
pytest | ||
``` | ||
|
||
## Building the package | ||
|
||
Building the backage is done as follows: | ||
``` | ||
pip install setuptools wheel | ||
python setup.py sdist bdist_wheel | ||
``` | ||
|
||
## Creating a release | ||
|
||
We use bump2version to update the version numbers. Bump2version will also create a tag and commit the | ||
changes. This can then be pushed using | ||
``` | ||
git push origin <branch> --tags | ||
``` | ||
The Github Actions have been configured to run the tests and flake8 linting and publish to test.Pypi | ||
on every push. If a commit is also tagged it will also publish to Pypi. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
analysis tools | ||
=============== | ||
|
||
Monte-carlo analysis | ||
-------------------- | ||
Generic usage of the monte-carlo class: | ||
|
||
.. code-block:: python | ||
:linenos: | ||
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 | ||
The monte carlo toolset will run multiple simulation in parallel, greatly reducing the simulation time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Callibration | ||
============= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Optimization | ||
============= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. mdinclude:: ../CONTRIBUTING.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Plotting figures | ||
======================================== | ||
|
||
Usage | ||
-------- | ||
WandaToolbox supports plotting various objects to a formatted PDF, which can be included as an appendix in your | ||
report. WandaToolbox.wanda_plot supports time and location series where data is exported directly from Wanda models. | ||
It also supports adding tables, images or text blocks on pages, and supports generating system characteristics for | ||
a range of flow rates and discharge points. | ||
|
||
Code example: | ||
|
||
.. code-block:: python | ||
:linenos: | ||
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\\') | ||
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"] | ||
with PdfPages(f'Document.pdf') as pdf: | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Misc. functions and tools | ||
======================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Parameterscript | ||
======================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
================= | ||
README | ||
================= | ||
|
||
.. mdinclude:: ../README.md | ||
|