From 4d782c3172e4f799df357091282d56860a021e79 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Wed, 19 May 2021 17:56:22 -0400 Subject: [PATCH 001/126] Configuring OpenMP build --- build-requirements.txt | 8 +++ swmm-toolkit/CMakeLists.txt | 46 +++++++----- swmm-toolkit/extern/openmp.cmake | 48 +++++++++++++ swmm-toolkit/pyproject.toml | 6 -- swmm-toolkit/setup.py | 26 ++++--- swmm-toolkit/src/swmm/toolkit/CMakeLists.txt | 34 +++++---- swmm-toolkit/src/swmm/toolkit/__init__.py | 8 +-- swmm-toolkit/swmm-solver | 2 +- swmm-toolkit/tools/build-wheels.sh | 73 ++++++++++++++++++++ swmm-toolkit/tools/relocate.zsh | 36 ---------- test-requirements.txt | 6 ++ 11 files changed, 203 insertions(+), 90 deletions(-) create mode 100644 build-requirements.txt create mode 100644 swmm-toolkit/extern/openmp.cmake delete mode 100644 swmm-toolkit/pyproject.toml create mode 100644 swmm-toolkit/tools/build-wheels.sh delete mode 100755 swmm-toolkit/tools/relocate.zsh create mode 100644 test-requirements.txt diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 00000000..8149a1aa --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,8 @@ + + + +setuptools +wheel +scikit-build +cmake +ninja diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index f0dd0d9e..84b17d97 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -2,45 +2,53 @@ # CMakeLists.txt - CMake configuration file for swmm-toolkit python package # # Created: Feb 6, 2020 -# Modified Jan 12, 2021 +# Modified May 19, 2021 # # Author: See AUTHORS # +################################################################################ +################## CMAKELISTS FOR SWMM-TOOLKIT PROJECT ################### +################################################################################ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.8.1 + 0.8.2 ) -set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) -set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) -set(Python_LIBRARY ${PYTHON_LIBRARY}) -find_package (Python ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development) +# Trick here is to perform build in a python virtual environment +set(Python_FIND_VIRTUALENV FIRST) +#set(CMAKE_FIND_DEBUG_MODE TRUE) +if(NOT MSVC) + find_package (Python3 ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development.Module REQUIRED) +else() + find_package (Python3 ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development REQUIRED) +endif() +#set(CMAKE_FIND_DEBUG_MODE FALSE) +# SWIG is a build requirement so needs to be installed first find_package(SWIG REQUIRED) cmake_policy(SET CMP0078 NEW) cmake_policy(SET CMP0086 NEW) include(${SWIG_USE_FILE}) -add_subdirectory(swmm-solver) - +# If wheel build on Apple fetch and build OpenMP Library +if (APPLE) + include(./extern/openmp.cmake) +else() + find_package(OpenMP + OPTIONAL_COMPONENTS + C + ) +endif() -add_subdirectory(src/swmm/toolkit) +# Add project subdirectories +add_subdirectory(swmm-solver) -# Relocate external libs into install package -if(APPLE) - install(CODE "execute_process( - COMMAND - ${PROJECT_SOURCE_DIR}/tools/relocate.zsh ${EXTERN_LIB_PATH} - WORKING_DIRECTORY - ${CMAKE_INSTALL_PREFIX} - )" - ) -endif() +add_subdirectory(src/swmm/toolkit) diff --git a/swmm-toolkit/extern/openmp.cmake b/swmm-toolkit/extern/openmp.cmake new file mode 100644 index 00000000..dbe2a09d --- /dev/null +++ b/swmm-toolkit/extern/openmp.cmake @@ -0,0 +1,48 @@ +# +# CMakeLists.txt - CMake configuration file for OpenMP Library on Darwin +# +# Created: Mar 17, 2021 +# Updated: May 19, 2021 +# +# Author: Michael E. Tryby +# US EPA ORD/CESER +# +# Note: +# Need to build libomp for binary compatibility with Python. +# +# OpenMP library build fails for Xcode generator. Use Ninja or Unix Makefiles +# instead. +# + +################################################################################ +##################### CMAKELISTS FOR OPENMP LIBRARY ###################### +################################################################################ + +include(FetchContent) + + +FetchContent_Declare(OpenMP + URL + https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/openmp-11.1.0.src.tar.xz + URL_HASH + SHA256=d187483b75b39acb3ff8ea1b7d98524d95322e3cb148842957e9b0fbb866052e +) + +set(OPENMP_STANDALONE_BUILD TRUE) +set(LIBOMP_INSTALL_ALIASES OFF) + +FetchContent_MakeAvailable(OpenMP) +set(OpenMP_AVAILABLE TRUE) + + +target_link_directories(omp + PUBLIC + $ + $ +) + +install(TARGETS omp + LIBRARY + DESTINATION + "${LIBRARY_DIST}" +) diff --git a/swmm-toolkit/pyproject.toml b/swmm-toolkit/pyproject.toml deleted file mode 100644 index 6d0263b7..00000000 --- a/swmm-toolkit/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ - - - -[build-system] -requires = ["setuptools", "wheel", "scikit-build", "cmake"] -build-backend = "setuptools.build_meta" diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 18ff3ba0..3a847e2f 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -2,7 +2,7 @@ # setup.py - Setup script for swmm-toolkit python package # # Created: Jul 2, 2018 -# Updated: May 7, 2020 +# Updated: May 19, 2021 # # Author: See AUTHORS # @@ -56,12 +56,19 @@ def run(self): p.wait() +# Set up location of wheel libraries depending on build platform +if platform_system == "Windows": + package_dir = {"swmm_toolkit":"bin", "swmm.toolkit": "src/swmm/toolkit"} +else: + package_dir = {"swmm_toolkit":"lib", "swmm.toolkit": "src/swmm/toolkit"} + + # Set Platform specific cmake args here if platform_system == "Windows": cmake_args = ["-GVisual Studio 15 2017 Win64"] elif platform_system == "Darwin": - cmake_args = ["-GXcode","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.10"] + cmake_args = ["-GNinja","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9"] else: cmake_args = ["-GUnix Makefiles"] @@ -74,32 +81,30 @@ def exclude_files(cmake_manifest): return list(filter(lambda name: not (name.endswith(exclude_pats)), cmake_manifest)) - # Get the long description from the README file here = pathlib.Path(__file__).parent.resolve() long_description = (here / 'README.md').read_text(encoding='utf-8') setup( - name = "swmm-toolkit", - version = "0.8.1", + name = "swmm_toolkit", + version = "0.8.2", - packages = ["swmm.toolkit"], - package_dir = {"": "src"}, + packages = ["swmm_toolkit", "swmm.toolkit"], + package_dir = package_dir, zip_safe = False, - install_requires = ["aenum"], + install_requires = ["aenum==3.0.0"], cmdclass = {"clean": CleanCommand}, cmake_args = cmake_args, cmake_process_manifest_hook = exclude_files, - description='OWA SWMM Python Toolkit', long_description=long_description, long_description_content_type='text/markdown', url='https://github.com/OpenWaterAnalytics/swmm-python', - + author='See AUTHORS', maintainer_email='tryby.michael@epa.gov', license='CC0', @@ -114,6 +119,7 @@ def exclude_files(cmake_manifest): "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: C", "Development Status :: 4 - Beta", ] diff --git a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt index 1ecfcd2d..bd2b52ea 100644 --- a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt +++ b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt @@ -2,11 +2,15 @@ # CMakeLists.txt - CMake configuration file for swmm.toolkit python package # # Created: Feb 6, 2020 -# Updated: Dec 29, 2020 +# Updated: May 19, 2021 # # Author: See AUTHORS # +################################################################################ +################# CMAKELISTS FOR SWMM-TOOLKIT EXT BUILD ################## +################################################################################ + set(CMAKE_SWIG_FLAGS -py3) @@ -16,8 +20,7 @@ if(WIN32) else() set(LIB_EXT "so") endif() - -set(Python_EXTENSION ".${Python_SOABI}.${LIB_EXT}") +set(PYTHON_SUFFIX ".${Python3_SOABI}.${LIB_EXT}") # Location of package at runtime on MacOS/Linux @@ -27,9 +30,9 @@ else() set(LIB_ROOT "$ORIGIN") endif() -# Inserting line continuation '\' in this long path string breaks wheel repair -set(PACKAGE_RPATH - "${LIB_ROOT}/../../../..;${LIB_ROOT}/../../../../extern;${LIB_ROOT}/../../../lib;${LIB_ROOT}/../../swmm_toolkit-${CMAKE_PROJECT_VERSION}.data/data/lib" +# Set up rpath on MacOS and Linux +set(PACKAGE_RPATH + "${LIB_ROOT}/../../swmm_toolkit/;${LIB_ROOT}/../../swmm_toolkit.libs/" ) @@ -51,6 +54,7 @@ swig_add_library(output output.i ) + target_link_options(output PUBLIC $<$:-undefineddynamic_lookup> @@ -58,18 +62,18 @@ target_link_options(output target_include_directories(output PUBLIC - ${Python_INCLUDE_DIRS} + ${Python3_INCLUDE_DIRS} ) target_link_libraries(output PUBLIC - $<$>:Python::Module> + $<$>:Python3::Module> swmm-output ) set_target_properties(output PROPERTIES - SUFFIX ${Python_EXTENSION} + SUFFIX ${PYTHON_SUFFIX} SWIG_COMPILE_DEFINITIONS EXPORT_OUT_API MACOSX_RPATH TRUE SKIP_BUILD_RPATH FALSE @@ -99,6 +103,7 @@ install( #################### SOLVER TARGET #################### ############################################################# + set_property(SOURCE solver.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES ON @@ -113,6 +118,7 @@ swig_add_library(solver solver.i ) + target_link_options(solver PUBLIC $<$:-undefineddynamic_lookup> @@ -120,18 +126,19 @@ target_link_options(solver target_include_directories(solver PUBLIC - ${Python_INCLUDE_DIRS} + ${Python3_INCLUDE_DIRS} ) target_link_libraries(solver PUBLIC - $<$>:Python::Module> + $<$>:Python3::Module> swmm5 + $<$:OpenMP::OpenMP_C> ) set_target_properties(solver PROPERTIES - SUFFIX ${Python_EXTENSION} + SUFFIX ${PYTHON_SUFFIX} MACOSX_RPATH TRUE SKIP_BUILD_RPATH FALSE BUILD_WITH_INSTALL_RPATH FALSE @@ -140,7 +147,7 @@ set_target_properties(solver ) -# Stages extension module for package build +# Stages python module for package build install( FILES "${CMAKE_CURRENT_BINARY_DIR}/solver.py" @@ -148,7 +155,6 @@ install( "src/swmm/toolkit" ) - # Stages extension library for package build install( TARGETS diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index ab6cb94b..a4142944 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -4,7 +4,7 @@ # __init__.py - SWMM toolkit package # # Created: Aug 9, 2018 -# Updated: Dec 22, 2020 +# Updated: May 19, 2021 # # Author: See AUTHORS # @@ -19,8 +19,8 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.8.0" -__date__ = "December 22, 2020" +__version__ = "0.8.2" +__date__ = "May 19, 2021" __maintainer__ = "Michael Tryby" __email__ = "tryby.michael@epa.gov" @@ -33,7 +33,7 @@ # Adds directory containing swmm libraries to path if platform.system() == "Windows": - libdir = os.path.join(os.path.dirname(__file__), "../../../../bin") + libdir = os.path.join(os.path.dirname(__file__), "../../swmm_toolkit") if hasattr(os, 'add_dll_directory'): os.add_dll_directory(libdir) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index a5a137d4..48323094 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit a5a137d46d06fcf7ab5ad7a6750954e03ebb4e35 +Subproject commit 483230943a107a7e2ab761fb7f6ae4cc496956f5 diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh new file mode 100644 index 00000000..51e731f0 --- /dev/null +++ b/swmm-toolkit/tools/build-wheels.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# +# build-wheels.sh - in a manyLinux docker image using dockcross +# +# Date created: Feb 2, 2021 +# Date modified: May 19, 2021 +# +# Author: See AUTHORS +# + +set -e -x + + +# Install a system package required by our library +sudo yum install -y swig + + +# Setup and build in swmm-toolkit dir +mkdir -p ./dist +cd swmm-toolkit + +# Build wheels +for PYBIN in /opt/python/*/bin; do + if [ ${PYBIN} != "/opt/python/cp35-cp35m/bin" ]; then + # Setup python virtual environment for build + ${PYBIN}/python -m venv --clear ./build-env + source ./build-env/bin/activate + + # Install build requirements + python -m pip install -r build-requirements.txt + + # Build wheel + python setup.py bdist_wheel + mv ./dist/*.whl ../dist/ + + # cleanup + python setup.py clean + deactivate + fi +done + +# Cleanup +rm -rf ./build-env + + +# Repairing and testing from swmm-python directory +cd .. + +# Bundle external shared libraries into the wheels +for whl in ./dist/*-linux_x86_64.whl; do + auditwheel repair $whl -w ./dist +done + + +# Install packages and test +for PYBIN in /opt/python/*/bin; do + if [ ${PYBIN} != "/opt/python/cp35-cp35m/bin" ]; then + # Setup python virtual environment for test + ${PYBIN}/python -m venv --clear ./test-env + source ./test-env/bin/activate + + python -m pip install -r swmm-toolkit/test-requirements.txt + + python -m pip install --verbose --no-index --find-links=./dist swmm_toolkit + pytest + + deactivate + fi +done + +# Cleanup +rm -rf ./test-env diff --git a/swmm-toolkit/tools/relocate.zsh b/swmm-toolkit/tools/relocate.zsh deleted file mode 100755 index 0cb95f4f..00000000 --- a/swmm-toolkit/tools/relocate.zsh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env zsh - -# -# relocate.zsh - Relocate lib to install/extern for MacOS -# -# Date created: May 7, 2020 -# -# Author: See AUTHORS -# -# Arguments: -# 1 - Path to library -# - -echo "INFO: Relocating ... $1" - -if [[ -z "$1" ]]; then - echo "ERROR: Required argument is missing"; return 1 -fi - -chmod 755 extern/$1:t - - -# Grabs current path for lib -IFS=$' ' -TOKEN=($( otool -l extern/$1:t | grep LC_ID_DYLIB -A2 | grep name )) -LIB_PATH=${TOKEN[2]} - - -# Changes load path for lib in _solver.so -install_name_tool -change ${LIB_PATH} @rpath/$1:t src/swmm/toolkit/_solver*.so - -# Changes load path for lib in libswmm5 -install_name_tool -change ${LIB_PATH} @rpath/$1:t lib/libswmm5.dylib - -# Changes id on relocated lib -install_name_tool -id @rpath/$1:t extern/$1:t diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..9aad0cbb --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,6 @@ + + + +pytest +numpy +aenum==2.2.6 From 6ed853ac952fe0fe247b116534d324e1fa9cb0b1 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Wed, 19 May 2021 18:00:56 -0400 Subject: [PATCH 002/126] Adding linux to wheel build --- .github/workflows/python-package.yml | 81 +++++++++++++++++++--------- 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c870543e..62f3ddc6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -2,15 +2,55 @@ name: Build Wheels on: [push, pull_request] +env: + DOCKER_IMAGE: dockcross/manylinux2014-x64 + + jobs: - build_wheels: + build_linux_wheels: + name: Build wheels on linux + runs-on: ubuntu-18.04 + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install + run: | + docker pull $DOCKER_IMAGE + docker run --rm $DOCKER_IMAGE > ./dockcross + chmod +x ./dockcross + + - name: Script + run: ./dockcross swmm-toolkit/tools/build-wheels.sh + + - uses: actions/upload-artifact@v2 + with: + path: ./dist/swmm_toolkit-*-manylinux2014_x86_64.whl + + + + build_win-mac_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: ./swmm-toolkit strategy: - fail-fast: false - matrix: - os: [windows-2016, ubuntu-16.04, macos-10.15] - py: [3.6, 3.7, 3.8] + fail-fast: false + matrix: + os: [windows-2016, macos-10.15] + py: [3.6, 3.7, 3.8, 3.9] + include: + - os: windows-2016 + sys_pkgs: choco install swig + activate: ./build-env/Scripts/activate + + - os: macos-10.15 + sys_pkgs: brew install swig + activate: source ./build-env/bin/activate steps: - name: Checkout repo @@ -23,33 +63,24 @@ jobs: with: python-version: ${{ matrix.py }} - - name: Install build requirements - if: ${{ contains(matrix.os, 'windows') }} - run: choco install swig - - - if: ${{ contains(matrix.os, 'ubuntu') }} - run: sudo apt-get install swig - - - if: ${{ contains(matrix.os, 'macos') }} - run: brew install libomp swig - - - name: Build wheel - run: pip wheel --wheel-dir=./dist ./swmm-toolkit + - name: Install required system packages + run: ${{matrix.sys_pkgs}} - - name: Repair wheel - if: ${{ contains(matrix.os, 'ubuntu') }} + - name: Build wheel in virtual env run: | - pip install auditwheel - auditwheel repair ./dist/*-linux_x86_64.whl --plat "manylinux2014_x86_64" -w ./dist - rm -rf ./dist/*-linux_x86_64.whl + python -m venv --clear ./build-env + ${{matrix.activate}} + python -m pip install -r build-requirements.txt + python setup.py bdist_wheel + deactivate - name: Test wheel run: | - pip install pytest numpy - pip install --no-index --find-links=./dist swmm-toolkit + pip install -r test-requirements.txt + pip install --no-index --find-links=./dist swmm_toolkit pytest - name: Upload artifacts uses: actions/upload-artifact@v2 with: - path: ./dist/swmm_toolkit*.whl + path: swmm-toolkit/dist/*.whl From 2f5d15b40d5577b7bd08592a15a103c14a9b7307 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 20 May 2021 09:28:30 -0400 Subject: [PATCH 003/126] Moving requirements files --- build-requirements.txt => swmm-toolkit/build-requirements.txt | 0 test-requirements.txt => swmm-toolkit/test-requirements.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename build-requirements.txt => swmm-toolkit/build-requirements.txt (100%) rename test-requirements.txt => swmm-toolkit/test-requirements.txt (100%) diff --git a/build-requirements.txt b/swmm-toolkit/build-requirements.txt similarity index 100% rename from build-requirements.txt rename to swmm-toolkit/build-requirements.txt diff --git a/test-requirements.txt b/swmm-toolkit/test-requirements.txt similarity index 100% rename from test-requirements.txt rename to swmm-toolkit/test-requirements.txt From 95e14d30b609c9b8034ed44b3a42778303b28de3 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 20 May 2021 09:33:59 -0400 Subject: [PATCH 004/126] Make build-wheels.sh executable --- swmm-toolkit/tools/build-wheels.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 swmm-toolkit/tools/build-wheels.sh diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh old mode 100644 new mode 100755 From 3fbe5acdb796802922a906162c750d9e74a3962b Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 20 May 2021 09:49:53 -0400 Subject: [PATCH 005/126] Pinning build and test requirements --- swmm-toolkit/build-requirements.txt | 10 +++++----- swmm-toolkit/test-requirements.txt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 8149a1aa..7022d9c9 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -1,8 +1,8 @@ -setuptools -wheel -scikit-build -cmake -ninja +setuptools==41.4.0 +wheel==0.33.6 +scikit-build==0.11.1 +cmake==3.18.4 +ninja==1.10.0 diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 9aad0cbb..37c7dd05 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -1,6 +1,6 @@ -pytest -numpy +pytest==6.1.1 +numpy==1.17.2 aenum==2.2.6 From 7633009784914e59aeffb5ed0ebbb859c3fffdd3 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 20 May 2021 15:06:01 -0400 Subject: [PATCH 006/126] Update solver, fix dependency --- swmm-toolkit/setup.py | 2 +- swmm-toolkit/swmm-solver | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 3a847e2f..da3b23b6 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -94,7 +94,7 @@ def exclude_files(cmake_manifest): package_dir = package_dir, zip_safe = False, - install_requires = ["aenum==3.0.0"], + install_requires = ["aenum==2.2.6"], cmdclass = {"clean": CleanCommand}, cmake_args = cmake_args, diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 48323094..93abf7f8 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 483230943a107a7e2ab761fb7f6ae4cc496956f5 +Subproject commit 93abf7f8d146986c9bf39beec68cdb5b1eb8faf1 From d27ee573b05496a3154110bb5f82aecd292f3d36 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Thu, 20 May 2021 15:20:12 -0400 Subject: [PATCH 007/126] Making ninja a sys requirement on Mac OS --- .github/workflows/python-package.yml | 2 +- swmm-toolkit/build-requirements.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 62f3ddc6..f8558a26 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -49,7 +49,7 @@ jobs: activate: ./build-env/Scripts/activate - os: macos-10.15 - sys_pkgs: brew install swig + sys_pkgs: brew install swig ninja activate: source ./build-env/bin/activate steps: diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 7022d9c9..9f33934a 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -5,4 +5,3 @@ setuptools==41.4.0 wheel==0.33.6 scikit-build==0.11.1 cmake==3.18.4 -ninja==1.10.0 From a3cd394b4103830827d333dc6673beda815c90b9 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 13:47:21 -0400 Subject: [PATCH 008/126] Pointing swmm-solver submodule to master --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 93abf7f8..3f79b600 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 93abf7f8d146986c9bf39beec68cdb5b1eb8faf1 +Subproject commit 3f79b60081b4b65467621dfb10c32042fac08b59 From c6d520a8e9c57d1ab5aab52aca21c22eacf2a34e Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 14:39:25 -0400 Subject: [PATCH 009/126] Adding nrtest plugin to build; Bumping version --- .github/workflows/python-package.yml | 35 ++++++++++++++++++++++- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f8558a26..dca48a12 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -6,6 +6,37 @@ env: DOCKER_IMAGE: dockcross/manylinux2014-x64 +jobs: + build_nrtest_plugin: + name: Build plugin wheel + runs-on: macos-10.15 + defaults: + run: + working-directory: ./nrtest-swmm + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Build wheel + run: | + pip install wheel + python setup.py bdist_wheel + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + path: nrtest-swmm/dist/*.whl + + + jobs: build_linux_wheels: name: Build wheels on linux @@ -26,7 +57,8 @@ jobs: - name: Script run: ./dockcross swmm-toolkit/tools/build-wheels.sh - - uses: actions/upload-artifact@v2 + - name: Upload artifacts + uses: actions/upload-artifact@v2 with: path: ./dist/swmm_toolkit-*-manylinux2014_x86_64.whl @@ -38,6 +70,7 @@ jobs: defaults: run: working-directory: ./swmm-toolkit + strategy: fail-fast: false matrix: diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index da3b23b6..197068f5 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -87,7 +87,7 @@ def exclude_files(cmake_manifest): setup( - name = "swmm_toolkit", + name = "swmm-toolkit", version = "0.8.2", packages = ["swmm_toolkit", "swmm.toolkit"], diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index a4142944..19312b52 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -20,7 +20,7 @@ __license__ = "CC0 1.0 Universal" __version__ = "0.8.2" -__date__ = "May 19, 2021" +__date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" __email__ = "tryby.michael@epa.gov" From 09d1c63a347b0d765395f81c6f121c1a0547b67b Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 14:47:16 -0400 Subject: [PATCH 010/126] Remove nrtest-swmm plugin from build --- .github/workflows/python-package.yml | 31 ---------------------------- 1 file changed, 31 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index dca48a12..aab474e1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -6,37 +6,6 @@ env: DOCKER_IMAGE: dockcross/manylinux2014-x64 -jobs: - build_nrtest_plugin: - name: Build plugin wheel - runs-on: macos-10.15 - defaults: - run: - working-directory: ./nrtest-swmm - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Build wheel - run: | - pip install wheel - python setup.py bdist_wheel - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - path: nrtest-swmm/dist/*.whl - - - jobs: build_linux_wheels: name: Build wheels on linux From 9be76abead07ba77dd25a108b5c72b198e7193dc Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 14:50:58 -0400 Subject: [PATCH 011/126] Fussing --- swmm-toolkit/CMakeLists.txt | 4 ++-- swmm-toolkit/setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 84b17d97..73b9b359 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -2,9 +2,9 @@ # CMakeLists.txt - CMake configuration file for swmm-toolkit python package # # Created: Feb 6, 2020 -# Modified May 19, 2021 +# Modified Jun 7, 2021 # -# Author: See AUTHORS +# Author: See AUTHORS # ################################################################################ diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 197068f5..2f1aff57 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -2,7 +2,7 @@ # setup.py - Setup script for swmm-toolkit python package # # Created: Jul 2, 2018 -# Updated: May 19, 2021 +# Updated: Jun 7, 2021 # # Author: See AUTHORS # From 298beacbf889c2f00789c084cc8a28e7094eb6dc Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 18:09:41 -0400 Subject: [PATCH 012/126] Fixing linux build --- swmm-toolkit/src/swmm/toolkit/CMakeLists.txt | 2 +- swmm-toolkit/tools/build-wheels.sh | 56 +++++++++----------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt index bd2b52ea..dc4a57f7 100644 --- a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt +++ b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt @@ -32,7 +32,7 @@ endif() # Set up rpath on MacOS and Linux set(PACKAGE_RPATH - "${LIB_ROOT}/../../swmm_toolkit/;${LIB_ROOT}/../../swmm_toolkit.libs/" + "${LIB_ROOT}/../../swmm_toolkit/" ) diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh index 51e731f0..6f15b66c 100755 --- a/swmm-toolkit/tools/build-wheels.sh +++ b/swmm-toolkit/tools/build-wheels.sh @@ -4,7 +4,7 @@ # build-wheels.sh - in a manyLinux docker image using dockcross # # Date created: Feb 2, 2021 -# Date modified: May 19, 2021 +# Date modified: Jun 7, 2021 # # Author: See AUTHORS # @@ -21,23 +21,21 @@ mkdir -p ./dist cd swmm-toolkit # Build wheels -for PYBIN in /opt/python/*/bin; do - if [ ${PYBIN} != "/opt/python/cp35-cp35m/bin" ]; then - # Setup python virtual environment for build - ${PYBIN}/python -m venv --clear ./build-env - source ./build-env/bin/activate - - # Install build requirements - python -m pip install -r build-requirements.txt - - # Build wheel - python setup.py bdist_wheel - mv ./dist/*.whl ../dist/ - - # cleanup - python setup.py clean - deactivate - fi +for PYBIN in /opt/python/cp{36,37,38,39}*/bin; do + # Setup python virtual environment for build + ${PYBIN}/python -m venv --clear ./build-env + source ./build-env/bin/activate + + # Install build requirements + python -m pip install -r build-requirements.txt + + # Build wheel + python setup.py bdist_wheel + mv ./dist/*.whl ../dist/ + + # cleanup + python setup.py clean + deactivate done # Cleanup @@ -48,25 +46,23 @@ rm -rf ./build-env cd .. # Bundle external shared libraries into the wheels -for whl in ./dist/*-linux_x86_64.whl; do - auditwheel repair $whl -w ./dist +for WHL in ./dist/*-linux_x86_64.whl; do + auditwheel repair -L '' -w ./dist $WHL done # Install packages and test -for PYBIN in /opt/python/*/bin; do - if [ ${PYBIN} != "/opt/python/cp35-cp35m/bin" ]; then - # Setup python virtual environment for test - ${PYBIN}/python -m venv --clear ./test-env - source ./test-env/bin/activate +for PYBIN in /opt/python/cp{36,37,38,39}*/bin; do + # Setup python virtual environment for test + ${PYBIN}/python -m venv --clear ./test-env + source ./test-env/bin/activate - python -m pip install -r swmm-toolkit/test-requirements.txt + python -m pip install -r swmm-toolkit/test-requirements.txt - python -m pip install --verbose --no-index --find-links=./dist swmm_toolkit - pytest + python -m pip install --verbose --no-index --find-links=./dist swmm_toolkit + pytest - deactivate - fi + deactivate done # Cleanup From 293cc9ecf13f343ccbad8308840ef67f8b045162 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 18:51:27 -0400 Subject: [PATCH 013/126] Fix problem with wheel upload on linux --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index aab474e1..de90e870 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,7 +29,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - path: ./dist/swmm_toolkit-*-manylinux2014_x86_64.whl + path: ./dist/swmm_toolkit-*.manylinux2014_x86_64.whl From d13424f796a1e5a69b89a505ca1f1f42b2273e27 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Mon, 7 Jun 2021 19:12:57 -0400 Subject: [PATCH 014/126] Fix problem with wheel upload on linux --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index de90e870..ec351a89 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,7 +29,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - path: ./dist/swmm_toolkit-*.manylinux2014_x86_64.whl + path: ./dist/*.manylinux2014_x86_64.whl From 55727a8daa667a23dd6f6b50de989d7b286cc38a Mon Sep 17 00:00:00 2001 From: Constantine Karos Date: Tue, 20 Jul 2021 13:09:40 -0400 Subject: [PATCH 015/126] Fix add_dll_directory issue when using conda - set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 when using conda --- swmm-toolkit/src/swmm/toolkit/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 19312b52..b9efd486 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -29,6 +29,7 @@ import os import platform +import sys # Adds directory containing swmm libraries to path @@ -36,6 +37,8 @@ libdir = os.path.join(os.path.dirname(__file__), "../../swmm_toolkit") if hasattr(os, 'add_dll_directory'): - os.add_dll_directory(libdir) + if 'conda' in sys.version: + os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE']="1" + os.add_dll_directory(libdir) else: os.environ["PATH"] = libdir + ";" + os.environ["PATH"] From 779dff63690d61dd8256b7268c8971acb1cb04ad Mon Sep 17 00:00:00 2001 From: Constantine Karos Date: Tue, 20 Jul 2021 13:11:08 -0400 Subject: [PATCH 016/126] change output_enum to shared_enum in nrtest --- nrtest-swmm/nrtest_swmm/output_reader.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nrtest-swmm/nrtest_swmm/output_reader.py b/nrtest-swmm/nrtest_swmm/output_reader.py index 7b5f9666..a845be5c 100644 --- a/nrtest-swmm/nrtest_swmm/output_reader.py +++ b/nrtest-swmm/nrtest_swmm/output_reader.py @@ -18,7 +18,7 @@ from itertools import islice # project import -from swmm.toolkit import output, output_enum +from swmm.toolkit import output, shared_enum def output_generator(path_ref): @@ -40,7 +40,7 @@ def output_generator(path_ref): with OutputReader(path_ref) as reader: for period_index in range(0, reader.report_periods()): - for element_type in islice(output_enum.ElementType, 4): + for element_type in islice(shared_enum.ElementType, 4): for element_index in range(0, reader.element_count(element_type)): yield (reader.element_result(element_type, period_index, element_index), @@ -57,10 +57,10 @@ def __init__(self, filename): self.handle = None self.count = None self.get_element_result = { - output_enum.ElementType.SUBCATCH: output.get_subcatch_result, - output_enum.ElementType.NODE: output.get_node_result, - output_enum.ElementType.LINK: output.get_link_result, - output_enum.ElementType.SYSTEM: output.get_system_result + shared_enum.ElementType.SUBCATCH: output.get_subcatch_result, + shared_enum.ElementType.NODE: output.get_node_result, + shared_enum.ElementType.LINK: output.get_link_result, + shared_enum.ElementType.SYSTEM: output.get_system_result } def __enter__(self): @@ -73,7 +73,7 @@ def __exit__(self, type, value, traceback): output.close(self.handle) def report_periods(self): - return output.get_times(self.handle, output_enum.Time.NUM_PERIODS) + return output.get_times(self.handle, shared_enum.Time.NUM_PERIODS) def element_count(self, element_type): return self.count[element_type] From a99241ab7b1dd2e2ee1809a331f4bf1d42b1c4d6 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Tue, 20 Jul 2021 17:30:11 -0400 Subject: [PATCH 017/126] Add nrtest-swmm to wheel build --- .github/workflows/python-package.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ec351a89..cda4ef33 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -7,6 +7,34 @@ env: jobs: + build_nrtest_plugin: + name: Build nrtest-swmm plugin + runs-on: ubuntu-18.04 + defaults: + run: + working-directory: ./nrtest-swmm + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Build wheel + run: | + pip install wheel + python setup.py bdist_wheel + - uses: actions/upload-artifact@v2 + with: + path: nrtest-swmm/dist/*.whl + + + build_linux_wheels: name: Build wheels on linux runs-on: ubuntu-18.04 From 059a25d5afaa0e6359f61d8ae297908f260da5a6 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Wed, 28 Jul 2021 17:10:21 -0400 Subject: [PATCH 018/126] Add compare results when lengths differ --- nrtest-swmm/nrtest_swmm/__init__.py | 14 +++++++------- nrtest-swmm/setup.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nrtest-swmm/nrtest_swmm/__init__.py b/nrtest-swmm/nrtest_swmm/__init__.py index 3ba91075..508300df 100644 --- a/nrtest-swmm/nrtest_swmm/__init__.py +++ b/nrtest-swmm/nrtest_swmm/__init__.py @@ -25,8 +25,8 @@ __credits__ = "Colleen Barr, Maurizio Cingi, Mark Gray, David Hall, Bryant McDonnell" __license__ = "CC0 1.0 Universal" -__version__ = "0.6.0" -__date__ = "May 8, 2020" +__version__ = "0.7.0" +__date__ = "Jul 28, 2021" __maintainer__ = "Michael E. Tryby" __email__ = "tryby.michael@epa.gov" @@ -65,15 +65,15 @@ def swmm_allclose_compare(path_test, path_ref, rtol, atol): for (test, ref) in zip(ordr.output_generator(path_test), ordr.output_generator(path_ref)): - if len(test[0]) != len(ref[0]): - raise ValueError('Inconsistent lengths') + # Compare arrays when lengths are unequal by truncating extra elements + length = min(len(test[0]), len(ref[0])) - # Skip over results if they are equal - if (np.array_equal(test[0], ref[0])): + # Skip over results if they are equal to optimize performance + if (np.array_equal(test[0][:length], ref[0][:length])): continue else: - np.testing.assert_allclose(test[0], ref[0], rtol, atol) + np.testing.assert_allclose(test[0][:length], ref[0][:length], rtol, atol) return True diff --git a/nrtest-swmm/setup.py b/nrtest-swmm/setup.py index 7d2338d0..8d0846ff 100644 --- a/nrtest-swmm/setup.py +++ b/nrtest-swmm/setup.py @@ -3,11 +3,11 @@ # # setup.py # -# Modified on October 17, 2019 -# # Author: Michael E. Tryby # US EPA - ORD/NRMRL # +# Modified: Jul 28, 2021 +# # Usage: # \>python setup.py bdist_wheel # @@ -27,7 +27,7 @@ setup( name='nrtest-swmm', - version='0.6.0', + version='0.7.0', description="SWMM extension for nrtest", author="Michael E. Tryby", From 9fc5f2e0fb2a737140d5a53433f98468ff6da835 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Fri, 3 Sep 2021 15:38:36 -0400 Subject: [PATCH 019/126] Truncate elements with result lengths are unequal --- nrtest-swmm/scripts/report-diff | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nrtest-swmm/scripts/report-diff b/nrtest-swmm/scripts/report-diff index 054def11..8fbd085f 100644 --- a/nrtest-swmm/scripts/report-diff +++ b/nrtest-swmm/scripts/report-diff @@ -25,14 +25,14 @@ def _binary_diff(path_test, path_ref, min_cdd): for (test, ref) in zip(ordr.output_generator(path_test), ordr.output_generator(path_ref)): - if len(test[0]) != len(ref[0]): - raise ValueError('Inconsistent lengths') + # Compare arrays when lengths are unequal by truncating extra elements + length = min(len(test[0]), len(ref[0])) # Skip over arrays that are equal - if np.array_equal(test[0], ref[0]): + if np.array_equal(test[0][:length], ref[0][:length]): continue else: - lre = _log_relative_error(test[0], ref[0]) + lre = _log_relative_error(test[0][:length], ref[0][:length]) idx = np.unravel_index(np.argmin(lre), lre.shape) if lre[idx] < min_cdd: From d31395d98131a1475d869569e51231fa760e7bb5 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 6 Jan 2022 10:41:08 -0500 Subject: [PATCH 020/126] update to latestest SWMM - add P_EVAP_RATE to output_enum and metadata - update swmm-solver submodule to latest commit on develop branch --- .gitmodules | 2 +- .../src/swmm/toolkit/output_metadata.py | 4 +- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 2 + swmm-toolkit/swmm-solver | 2 +- swmm-toolkit/tests/test_metadata.py | 85 ++++++++++--------- 5 files changed, 50 insertions(+), 45 deletions(-) diff --git a/.gitmodules b/.gitmodules index 123ee6f0..e4bb4b8c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "swmm-toolkit/swmm-solver"] path = swmm-toolkit/swmm-solver url = https://github.com/OpenWaterAnalytics/Stormwater-Management-Model.git - branch = swig \ No newline at end of file + branch = develop diff --git a/swmm-toolkit/src/swmm/toolkit/output_metadata.py b/swmm-toolkit/src/swmm/toolkit/output_metadata.py index 13ca02b5..5367d962 100644 --- a/swmm-toolkit/src/swmm/toolkit/output_metadata.py +++ b/swmm-toolkit/src/swmm/toolkit/output_metadata.py @@ -194,7 +194,9 @@ def __init__(self, output_handle): shared_enum.SystemAttribute.VOLUME_STORED: ("Volume Stored", self._unit_labels[shared_enum.BaseUnits.VOLUME]), shared_enum.SystemAttribute.EVAP_RATE: - ("Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]) + ("Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]), + shared_enum.SystemAttribute.P_EVAP_RATE: + ("Potential Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]) } self._build_pollut_metadata(output_handle) diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index f3906e79..29d3f21e 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -304,6 +304,7 @@ class SystemAttribute(Enum, start = 0): :attr:`~OUTFALL_FLOWS` outfall outflow :attr:`~VOLUME_STORED` storage volume :attr:`~EVAP_RATE` evaporation + :attr:`~P_EVAP_RATE` potential evapotranspiration ============================= ==================== """ AIR_TEMP = 0 @@ -320,6 +321,7 @@ class SystemAttribute(Enum, start = 0): OUTFALL_FLOWS = 11 VOLUME_STORED = 12 EVAP_RATE = 13 + P_EVAP_RATE = 14 # diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 93891ff1..76b8ae7e 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 93891ff1e3775073895a3b96f38fa6999e961ed9 +Subproject commit 76b8ae7e39f07a659b51284effafe668394d7f29 diff --git a/swmm-toolkit/tests/test_metadata.py b/swmm-toolkit/tests/test_metadata.py index 25df8839..0a76c546 100644 --- a/swmm-toolkit/tests/test_metadata.py +++ b/swmm-toolkit/tests/test_metadata.py @@ -38,48 +38,49 @@ def test_outputmetadata(handle): om = output_metadata.OutputMetadata(handle) ref = { - shared_enum.SubcatchAttribute.RAINFALL: ("Rainfall", "in/hr"), - shared_enum.SubcatchAttribute.SNOW_DEPTH: ("Snow Depth", "in"), - shared_enum.SubcatchAttribute.EVAP_LOSS: ("Evaporation Loss", "in/day"), - shared_enum.SubcatchAttribute.INFIL_LOSS: ("Infiltration Loss", "in/hr"), - shared_enum.SubcatchAttribute.RUNOFF_RATE: ("Runoff Rate", "cu ft/sec"), - shared_enum.SubcatchAttribute.GW_OUTFLOW_RATE: ("Groundwater Flow Rate", "cu ft/sec"), - shared_enum.SubcatchAttribute.GW_TABLE_ELEV: ("Groundwater Elevation", "ft"), - shared_enum.SubcatchAttribute.SOIL_MOISTURE: ("Soil Moisture", "%"), - shared_enum.SubcatchAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), - shared_enum.SubcatchAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), - - shared_enum.NodeAttribute.INVERT_DEPTH: ("Invert Depth", "ft"), - shared_enum.NodeAttribute.HYDRAULIC_HEAD: ("Hydraulic Head", "ft"), - shared_enum.NodeAttribute.PONDED_VOLUME: ("Ponded Volume", "cu ft"), - shared_enum.NodeAttribute.LATERAL_INFLOW: ("Lateral Inflow", "cu ft/sec"), - shared_enum.NodeAttribute.TOTAL_INFLOW: ("Total Inflow", "cu ft/sec"), - shared_enum.NodeAttribute.FLOODING_LOSSES: ("Flooding Loss", "cu ft/sec"), - shared_enum.NodeAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), - shared_enum.NodeAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), - - shared_enum.LinkAttribute.FLOW_RATE: ("Flow Rate", "cu ft/sec"), - shared_enum.LinkAttribute.FLOW_DEPTH: ("Flow Depth", "ft"), - shared_enum.LinkAttribute.FLOW_VELOCITY: ("Flow Velocity", "ft/sec"), - shared_enum.LinkAttribute.FLOW_VOLUME: ("Flow Volume", "cu ft"), - shared_enum.LinkAttribute.CAPACITY: ("Capacity", "%"), - shared_enum.LinkAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), - shared_enum.LinkAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), - - shared_enum.SystemAttribute.AIR_TEMP: ("Temperature", "deg F"), - shared_enum.SystemAttribute.RAINFALL: ("Rainfall", "in/hr"), - shared_enum.SystemAttribute.SNOW_DEPTH: ("Snow Depth", "in"), - shared_enum.SystemAttribute.EVAP_INFIL_LOSS: ("Evap and Infil Losses", "in/hr"), - shared_enum.SystemAttribute.RUNOFF_FLOW: ("Runoff Flow Rate", "cu ft/sec"), - shared_enum.SystemAttribute.DRY_WEATHER_INFLOW: ("Dry Weather Inflow", "cu ft/sec"), - shared_enum.SystemAttribute.GW_INFLOW: ("Groundwater Inflow", "cu ft/sec"), - shared_enum.SystemAttribute.RDII_INFLOW: ("RDII Inflow", "cu ft/sec"), - shared_enum.SystemAttribute.DIRECT_INFLOW: ("Direct Inflow", "cu ft/sec"), - shared_enum.SystemAttribute.TOTAL_LATERAL_INFLOW: ("Total Lateral Inflow", "cu ft/sec"), - shared_enum.SystemAttribute.FLOOD_LOSSES: ("Flood Losses", "cu ft/sec"), - shared_enum.SystemAttribute.OUTFALL_FLOWS: ("Outfall Flow", "cu ft/sec"), - shared_enum.SystemAttribute.VOLUME_STORED: ("Volume Stored", "cu ft"), - shared_enum.SystemAttribute.EVAP_RATE: ("Evaporation Rate", "in/day") + shared_enum.SubcatchAttribute.RAINFALL: ("Rainfall", "in/hr"), + shared_enum.SubcatchAttribute.SNOW_DEPTH: ("Snow Depth", "in"), + shared_enum.SubcatchAttribute.EVAP_LOSS: ("Evaporation Loss", "in/day"), + shared_enum.SubcatchAttribute.INFIL_LOSS: ("Infiltration Loss", "in/hr"), + shared_enum.SubcatchAttribute.RUNOFF_RATE: ("Runoff Rate", "cu ft/sec"), + shared_enum.SubcatchAttribute.GW_OUTFLOW_RATE: ("Groundwater Flow Rate", "cu ft/sec"), + shared_enum.SubcatchAttribute.GW_TABLE_ELEV: ("Groundwater Elevation", "ft"), + shared_enum.SubcatchAttribute.SOIL_MOISTURE: ("Soil Moisture", "%"), + shared_enum.SubcatchAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), + shared_enum.SubcatchAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), + + shared_enum.NodeAttribute.INVERT_DEPTH: ("Invert Depth", "ft"), + shared_enum.NodeAttribute.HYDRAULIC_HEAD: ("Hydraulic Head", "ft"), + shared_enum.NodeAttribute.PONDED_VOLUME: ("Ponded Volume", "cu ft"), + shared_enum.NodeAttribute.LATERAL_INFLOW: ("Lateral Inflow", "cu ft/sec"), + shared_enum.NodeAttribute.TOTAL_INFLOW: ("Total Inflow", "cu ft/sec"), + shared_enum.NodeAttribute.FLOODING_LOSSES: ("Flooding Loss", "cu ft/sec"), + shared_enum.NodeAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), + shared_enum.NodeAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), + + shared_enum.LinkAttribute.FLOW_RATE: ("Flow Rate", "cu ft/sec"), + shared_enum.LinkAttribute.FLOW_DEPTH: ("Flow Depth", "ft"), + shared_enum.LinkAttribute.FLOW_VELOCITY: ("Flow Velocity", "ft/sec"), + shared_enum.LinkAttribute.FLOW_VOLUME: ("Flow Volume", "cu ft"), + shared_enum.LinkAttribute.CAPACITY: ("Capacity", "%"), + shared_enum.LinkAttribute.POLLUT_CONC_0: ("TSS", "mg/L"), + shared_enum.LinkAttribute.POLLUT_CONC_1: ("Lead", "ug/L"), + + shared_enum.SystemAttribute.AIR_TEMP: ("Temperature", "deg F"), + shared_enum.SystemAttribute.RAINFALL: ("Rainfall", "in/hr"), + shared_enum.SystemAttribute.SNOW_DEPTH: ("Snow Depth", "in"), + shared_enum.SystemAttribute.EVAP_INFIL_LOSS: ("Evap and Infil Losses", "in/hr"), + shared_enum.SystemAttribute.RUNOFF_FLOW: ("Runoff Flow Rate", "cu ft/sec"), + shared_enum.SystemAttribute.DRY_WEATHER_INFLOW: ("Dry Weather Inflow", "cu ft/sec"), + shared_enum.SystemAttribute.GW_INFLOW: ("Groundwater Inflow", "cu ft/sec"), + shared_enum.SystemAttribute.RDII_INFLOW: ("RDII Inflow", "cu ft/sec"), + shared_enum.SystemAttribute.DIRECT_INFLOW: ("Direct Inflow", "cu ft/sec"), + shared_enum.SystemAttribute.TOTAL_LATERAL_INFLOW: ("Total Lateral Inflow", "cu ft/sec"), + shared_enum.SystemAttribute.FLOOD_LOSSES: ("Flood Losses", "cu ft/sec"), + shared_enum.SystemAttribute.OUTFALL_FLOWS: ("Outfall Flow", "cu ft/sec"), + shared_enum.SystemAttribute.VOLUME_STORED: ("Volume Stored", "cu ft"), + shared_enum.SystemAttribute.EVAP_RATE: ("Evaporation Rate", "in/day"), + shared_enum.SystemAttribute.P_EVAP_RATE: ("Potential Evaporation Rate", "in/day") } for attr in shared_enum.SubcatchAttribute: From d6f1abfc237d8672ba72f923956e1fe799129684 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 6 Jan 2022 12:46:39 -0500 Subject: [PATCH 021/126] fix swig error by - define EXPORT_TOOLKIT in solver.i --- swmm-toolkit/src/swmm/toolkit/solver.i | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index e3af2d87..bdcbeafb 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -209,7 +209,10 @@ %ignore swmm_getObjectIndex; %ignore swmm_freeMemory; + +#define EXPORT_TOOLKIT %include "toolkit.h" + %exception; From 605766ca7b16a0a9ed81d61d3850d911c47e07c7 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 6 Jan 2022 12:58:11 -0500 Subject: [PATCH 022/126] fix solver_rename.i - change swmm_getVersionInfo -> swmm_getSemVersion --- swmm-toolkit/src/swmm/toolkit/solver_rename.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/src/swmm/toolkit/solver_rename.i b/swmm-toolkit/src/swmm/toolkit/solver_rename.i index 648f1d9a..0c76b316 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_rename.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_rename.i @@ -99,4 +99,4 @@ %rename(raingage_set_precipitation) swmm_setGagePrecip; -%rename(swmm_version_info) swmm_getVersionInfo; +%rename(swmm_version_info) swmm_getSemVersion; From 2e5973a7e77029616985982e489ece6db8d54a9b Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 6 Jan 2022 16:49:43 -0500 Subject: [PATCH 023/126] fix error with swmm_getSemVersion&swmm_getBuildId - needed to add swig exception handling as with SMO_init and SMO_close --- swmm-toolkit/src/swmm/toolkit/solver.i | 11 +++++++++++ swmm-toolkit/tests/test_solver.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index bdcbeafb..33c6b5f9 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -178,6 +178,17 @@ } +/* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */ +%exception swmm_getSemVersion +{ + $function +} + +%exception swmm_getBuildId +{ + $function +} + /* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */ %exception { diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index ae6a23e9..726c9ac4 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -96,7 +96,7 @@ def test_step(handle): def test_version(handle): - major, minor, patch = solver.swmm_version_info() + major, minor, patch = solver.swmm_version_info().split('.') print(major, minor, patch) assert major == '5' From d9940368fb46a9b988af9459aacd900dca9b8cef Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 6 Jan 2022 17:47:02 -0500 Subject: [PATCH 024/126] add new pollutant treatment to shared_enum - Update shared enum with changes from toolkit_enums.h - update solver rename for two new pollutant setter methods - add PEP8 swmm_getBuildId --- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 4 ++++ swmm-toolkit/src/swmm/toolkit/solver_rename.i | 3 +++ 2 files changed, 7 insertions(+) diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index 29d3f21e..8ddef89f 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -441,6 +441,7 @@ class NodeResult(Enum): DEPTH = 5 HEAD = 6 LATERAL_INFLOW = 7 + HRT = 8 class NodePollutant(Enum): @@ -449,6 +450,8 @@ class NodePollutant(Enum): :attr:`~QUALITY` """ QUALITY = 0 + INF_CONC = 1 + REACTOR_CONC = 2 class LinkProperty(Enum): @@ -501,6 +504,7 @@ class LinkPollutant(Enum): """ QUALITY = 0 TOTAL_LOAD = 1 + REACTOR_CONC = 2 class SubcatchProperty(Enum): diff --git a/swmm-toolkit/src/swmm/toolkit/solver_rename.i b/swmm-toolkit/src/swmm/toolkit/solver_rename.i index 0c76b316..29259e7f 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_rename.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_rename.i @@ -44,6 +44,7 @@ %rename(node_set_parameter) swmm_setNodeParam; %rename(node_get_result) swmm_getNodeResult; %rename(node_get_pollutant) swmm_getNodePollut; +%rename(node_set_pollutant) swmm_setNodePollut; %rename(node_get_total_inflow) swmm_getNodeTotalInflow; %rename(node_set_total_inflow) swmm_setNodeInflow; %rename(node_get_stats) swmm_getNodeStats; @@ -63,6 +64,7 @@ %rename(link_set_parameter) swmm_setLinkParam; %rename(link_get_result) swmm_getLinkResult; %rename(link_get_pollutant) swmm_getLinkPollut; +%rename(link_set_pollutant) swmm_setLinkPollut; %rename(link_set_target_setting) swmm_setLinkSetting; %rename(link_get_stats) swmm_getLinkStats; @@ -100,3 +102,4 @@ %rename(swmm_version_info) swmm_getSemVersion; +%rename(swmm_build_id) swmm_getBuildId; \ No newline at end of file From 3547795fc23a4c0b1b0bd8d6c13e0cc3505435ab Mon Sep 17 00:00:00 2001 From: karosc Date: Fri, 7 Jan 2022 09:17:12 -0500 Subject: [PATCH 025/126] Add system get_system_attribute tester --- swmm-toolkit/tests/test_output.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swmm-toolkit/tests/test_output.py b/swmm-toolkit/tests/test_output.py index 9e3224f8..be628881 100644 --- a/swmm-toolkit/tests/test_output.py +++ b/swmm-toolkit/tests/test_output.py @@ -194,3 +194,12 @@ def test_getsystemresult(handle): assert len(test_array) == 14 assert np.allclose(test_array, ref_array) + +def test_getsystemattribute(handle): + + ref_array = np.array([70.0]) + + test_array = output.get_system_attribute(handle, 0, shared_enum.SystemAttribute.AIR_TEMP) + + assert len(test_array) == 1 + assert np.allclose(test_array, ref_array) From 9b5ca780e7bf3caf1dfc6d9c4488fe4e0407e8b6 Mon Sep 17 00:00:00 2001 From: karosc Date: Fri, 7 Jan 2022 12:00:07 -0500 Subject: [PATCH 026/126] Address comments - make shared_enum vars more descriptive - move EXPORT_TOOLKIT define to CMakeLists - fix some formatting and docstrings --- swmm-toolkit/src/swmm/toolkit/CMakeLists.txt | 1 + swmm-toolkit/src/swmm/toolkit/output_metadata.py | 2 +- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 12 ++++++++---- swmm-toolkit/src/swmm/toolkit/solver.i | 4 +--- swmm-toolkit/tests/test_metadata.py | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt index dc4a57f7..a88d77a4 100644 --- a/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt +++ b/swmm-toolkit/src/swmm/toolkit/CMakeLists.txt @@ -139,6 +139,7 @@ target_link_libraries(solver set_target_properties(solver PROPERTIES SUFFIX ${PYTHON_SUFFIX} + SWIG_COMPILE_DEFINITIONS EXPORT_TOOLKIT MACOSX_RPATH TRUE SKIP_BUILD_RPATH FALSE BUILD_WITH_INSTALL_RPATH FALSE diff --git a/swmm-toolkit/src/swmm/toolkit/output_metadata.py b/swmm-toolkit/src/swmm/toolkit/output_metadata.py index 5367d962..93731f46 100644 --- a/swmm-toolkit/src/swmm/toolkit/output_metadata.py +++ b/swmm-toolkit/src/swmm/toolkit/output_metadata.py @@ -195,7 +195,7 @@ def __init__(self, output_handle): ("Volume Stored", self._unit_labels[shared_enum.BaseUnits.VOLUME]), shared_enum.SystemAttribute.EVAP_RATE: ("Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]), - shared_enum.SystemAttribute.P_EVAP_RATE: + shared_enum.SystemAttribute.PTNL_EVAP_RATE: ("Potential Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]) } diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index 8ddef89f..8724e3b3 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -304,7 +304,7 @@ class SystemAttribute(Enum, start = 0): :attr:`~OUTFALL_FLOWS` outfall outflow :attr:`~VOLUME_STORED` storage volume :attr:`~EVAP_RATE` evaporation - :attr:`~P_EVAP_RATE` potential evapotranspiration + :attr:`~PTNL_EVAP_RATE` potential evapotranspiration ============================= ==================== """ AIR_TEMP = 0 @@ -321,7 +321,7 @@ class SystemAttribute(Enum, start = 0): OUTFALL_FLOWS = 11 VOLUME_STORED = 12 EVAP_RATE = 13 - P_EVAP_RATE = 14 + PTNL_EVAP_RATE = 14 # @@ -432,6 +432,7 @@ class NodeResult(Enum): :attr:`~DEPTH` :attr:`~HEAD` :attr:`~LATERAL_INFLOW` + :attr:`~HYD_RES_TIME` """ TOTAL_INFLOW = 0 TOTAL_OUTFLOW = 1 @@ -441,16 +442,18 @@ class NodeResult(Enum): DEPTH = 5 HEAD = 6 LATERAL_INFLOW = 7 - HRT = 8 + HYD_RES_TIME = 8 class NodePollutant(Enum): """Node Pollutant enum class. :attr:`~QUALITY` + :attr:`~INFLOW_CONC` + :attr:`~REACTOR_CONC` """ QUALITY = 0 - INF_CONC = 1 + INFLOW_CONC = 1 REACTOR_CONC = 2 @@ -501,6 +504,7 @@ class LinkPollutant(Enum): :attr:`~QUALITY` :attr:`~TOTAL_LOAD` + :attr:`~REACTOR_CONC` """ QUALITY = 0 TOTAL_LOAD = 1 diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index 33c6b5f9..47413c81 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -221,9 +221,7 @@ %ignore swmm_freeMemory; -#define EXPORT_TOOLKIT %include "toolkit.h" - -%exception; +%exception; \ No newline at end of file diff --git a/swmm-toolkit/tests/test_metadata.py b/swmm-toolkit/tests/test_metadata.py index 0a76c546..f95faec8 100644 --- a/swmm-toolkit/tests/test_metadata.py +++ b/swmm-toolkit/tests/test_metadata.py @@ -80,7 +80,7 @@ def test_outputmetadata(handle): shared_enum.SystemAttribute.OUTFALL_FLOWS: ("Outfall Flow", "cu ft/sec"), shared_enum.SystemAttribute.VOLUME_STORED: ("Volume Stored", "cu ft"), shared_enum.SystemAttribute.EVAP_RATE: ("Evaporation Rate", "in/day"), - shared_enum.SystemAttribute.P_EVAP_RATE: ("Potential Evaporation Rate", "in/day") + shared_enum.SystemAttribute.PTNL_EVAP_RATE: ("Potential Evaporation Rate", "in/day") } for attr in shared_enum.SubcatchAttribute: From 10f2d5bfa7bda0f502a3129fc0ac222c7f3f520a Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 8 Feb 2022 14:38:43 -0500 Subject: [PATCH 027/126] add docstrings for pollutant setters --- swmm-toolkit/src/swmm/toolkit/solver_docs.i | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/swmm-toolkit/src/swmm/toolkit/solver_docs.i b/swmm-toolkit/src/swmm/toolkit/solver_docs.i index 4e130e20..8f34f2eb 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_docs.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_docs.i @@ -664,6 +664,24 @@ flowrate: double ) swmm_setNodeInflow; +%feature("autodoc", +"Set node inflow pollutant concentration + +Parameters +---------- +index: int + The link index. +pollutant_index: int + The index of the pollutant to set. +pollutant_value: + The new pollutant concentration to set. + +" +) swmm_setNodePollut; + + + + %feature("autodoc", "Get a node statistics. @@ -863,6 +881,23 @@ setting: double ) swmm_setLinkSetting; +%feature("autodoc", +"Set link pollutant concentration + +Parameters +---------- +index: int + The link index. +type: SM_LinkPollut + The property type code (see :ref: SM_LinkPollut). Currently Only QUALITY (0) is supported. +pollutant_index: int + The index of the pollutant to set. +pollutant_value: + The new pollutant concentration to set. + +" +) swmm_setLinkPollut; + %feature("autodoc", "Get link statistics. From 04f9a8351ef7fc9e43eaf4410621197b4f4e877e Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 8 Feb 2022 14:39:15 -0500 Subject: [PATCH 028/126] add tests for pollutant setters --- swmm-toolkit/tests/data/test_Example3.inp | 131 +++++++++++++++++ swmm-toolkit/tests/data/test_Example3.old.inp | 133 ++++++++++++++++++ swmm-toolkit/tests/test_solver.py | 52 +++++++ 3 files changed, 316 insertions(+) create mode 100644 swmm-toolkit/tests/data/test_Example3.inp create mode 100644 swmm-toolkit/tests/data/test_Example3.old.inp diff --git a/swmm-toolkit/tests/data/test_Example3.inp b/swmm-toolkit/tests/data/test_Example3.inp new file mode 100644 index 00000000..ed2acbba --- /dev/null +++ b/swmm-toolkit/tests/data/test_Example3.inp @@ -0,0 +1,131 @@ +[TITLE] +;;Project Title/Notes + +[OPTIONS] +;;Option Value +FLOW_UNITS CMS +INFILTRATION HORTON +FLOW_ROUTING KINWAVE +LINK_OFFSETS DEPTH +MIN_SLOPE 0 +ALLOW_PONDING NO +SKIP_STEADY_STATE NO + +START_DATE 01/27/2020 +START_TIME 00:00:00 +REPORT_START_DATE 01/27/2020 +REPORT_START_TIME 00:00:00 +END_DATE 01/27/2020 +END_TIME 00:30:00 +SWEEP_START 01/01 +SWEEP_END 02/28 +DRY_DAYS 0 +REPORT_STEP 00:00:01 +WET_STEP 00:00:01 +DRY_STEP 00:00:01 +ROUTING_STEP 0:00:01 +RULE_STEP 00:00:00 + +INERTIAL_DAMPING PARTIAL +NORMAL_FLOW_LIMITED BOTH +FORCE_MAIN_EQUATION H-W +VARIABLE_STEP 0.75 +LENGTHENING_STEP 0 +MIN_SURFAREA 1.14 +MAX_TRIALS 8 +HEAD_TOLERANCE 0.0015 +SYS_FLOW_TOL 5 +LAT_FLOW_TOL 5 +MINIMUM_STEP 0.5 +THREADS 1 + +[EVAPORATION] +;;Data Source Parameters +;;-------------- ---------------- +CONSTANT 0.0 +DRY_ONLY NO + +[OUTFALLS] +;;Name Elevation Type Stage Data Gated Route To +;;-------------- ---------- ---------- ---------------- -------- ---------------- +Outfall 0 FREE NO + +[STORAGE] +;;Name Elev. MaxDepth InitDepth Shape Curve Name/Params N/A Fevap Psi Ksat IMD +;;-------------- -------- ---------- ----------- ---------- ---------------------------- -------- -------- -------- -------- +Tank 10 5 0 TABULAR Tank_Curve 0 0 + +[CONDUITS] +;;Name From Node To Node Length Roughness InOffset OutOffset InitFlow MaxFlow +;;-------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- +Valve Tank Outfall 400 0.01 0 0 0 0 + +[XSECTIONS] +;;Link Shape Geom1 Geom2 Geom3 Geom4 Barrels Culvert +;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ---------- +Valve CIRCULAR 1 0 0 0 1 + +[POLLUTANTS] +;;Name Units Crain Cgw Crdii Kdecay SnowOnly Co-Pollutant Co-Frac Cdwf Cinit +;;-------------- ------ ---------- ---------- ---------- ---------- ---------- ---------------- ---------- ---------- ---------- +P1 MG/L 0.0 0.0 0 0.0 NO * 0.0 0.0 0 + +[TREATMENT] +;;Node Pollutant Function +;;-------------- ---------------- ---------- +Tank P1 C = 2.0 + +[INFLOWS] +;;Node Constituent Time Series Type Mfactor Sfactor Baseline Pattern +;;-------------- ---------------- ---------------- -------- -------- -------- -------- -------- +Tank FLOW "" FLOW 1.0 1.0 5 +Tank P1 "" CONCENTRATION 1.0 1.0 10 + +[CURVES] +;;Name Type X-Value Y-Value +;;-------------- ---------- ---------- ---------- +Tank_Curve Storage 0 100 +Tank_Curve 1 100 +Tank_Curve 2 100 +Tank_Curve 3 100 +Tank_Curve 4 100 +Tank_Curve 5 100 + +[TIMESERIES] +;;Name Date Time Value +;;-------------- ---------- ---------- ---------- +TestRain 1 0 +TestRain 2 0.5 +TestRain 3 0.75 +TestRain 4 1 +TestRain 5 0.75 +TestRain 6 0.5 +TestRain 7 0 + +[PATTERNS] +;;Name Type Multipliers +;;-------------- ---------- ----------- +DailyX1 DAILY 1.0 1.0 1.0 1.0 1.0 1.0 1.0 + +[REPORT] +;;Reporting Options +SUBCATCHMENTS ALL +NODES ALL +LINKS ALL + +[TAGS] + +[MAP] +DIMENSIONS 0.000 0.000 10000.000 10000.000 +Units None + +[COORDINATES] +;;Node X-Coord Y-Coord +;;-------------- ------------------ ------------------ +Outfall -178.777 6435.986 +Tank -1101.499 6828.143 + +[VERTICES] +;;Link X-Coord Y-Coord +;;-------------- ------------------ ------------------ + diff --git a/swmm-toolkit/tests/data/test_Example3.old.inp b/swmm-toolkit/tests/data/test_Example3.old.inp new file mode 100644 index 00000000..dd164967 --- /dev/null +++ b/swmm-toolkit/tests/data/test_Example3.old.inp @@ -0,0 +1,133 @@ +[TITLE] +;;Project Title/Notes + +[OPTIONS] +;;Option Value +FLOW_UNITS CMS +INFILTRATION HORTON +FLOW_ROUTING KINWAVE +LINK_OFFSETS DEPTH +MIN_SLOPE 0 +ALLOW_PONDING NO +SKIP_STEADY_STATE NO + +START_DATE 01/27/2020 +START_TIME 00:00:00 +REPORT_START_DATE 01/27/2020 +REPORT_START_TIME 00:00:00 +END_DATE 01/27/2020 +END_TIME 00:30:00 +SWEEP_START 01/01 +SWEEP_END 02/28 +DRY_DAYS 0 +REPORT_STEP 00:00:01 +WET_STEP 00:00:01 +DRY_STEP 00:00:01 +ROUTING_STEP 0:00:01 + +INERTIAL_DAMPING PARTIAL +NORMAL_FLOW_LIMITED BOTH +FORCE_MAIN_EQUATION H-W +VARIABLE_STEP 0.75 +LENGTHENING_STEP 0 +MIN_SURFAREA 1.14 +MAX_TRIALS 8 +HEAD_TOLERANCE 0.0015 +SYS_FLOW_TOL 5 +LAT_FLOW_TOL 5 +MINIMUM_STEP 0.5 +THREADS 1 + +[EVAPORATION] +;;Data Source Parameters +;;-------------- ---------------- +CONSTANT 0.0 +DRY_ONLY NO + +[OUTFALLS] +;;Name Elevation Type Stage Data Gated Route To +;;-------------- ---------- ---------- ---------------- -------- ---------------- +Outfall 0 FREE NO + +[STORAGE] +;;Name Elev. MaxDepth InitDepth Shape Curve Name/Params N/A Fevap Psi Ksat IMD +;;-------------- -------- ---------- ----------- ---------- ---------------------------- -------- -------- -------- -------- +Tank 10 5 0 TABULAR Tank_Curve 0 0 + +[ORIFICES] +;;Name From Node To Node Type Offset Qcoeff Gated CloseTime +;;-------------- ---------------- ---------------- ------------ ---------- ---------- -------- ---------- +Valve Tank Outfall BOTTOM 0 1 NO 0 + +[XSECTIONS] +;;Link Shape Geom1 Geom2 Geom3 Geom4 Barrels Culvert +;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ---------- +Valve RECT_CLOSED 1 1 0 0 + +[POLLUTANTS] +;;Name Units Crain Cgw Crdii Kdecay SnowOnly Co-Pollutant Co-Frac Cdwf Cinit +;;-------------- ------ ---------- ---------- ---------- ---------- ---------- ---------------- ---------- ---------- ---------- +P1 MG/L 0.0 0.0 0 0.0 NO * 0.0 0.0 0 + + +[INFLOWS] +;;Node Constituent Time Series Type Mfactor Sfactor Baseline Pattern +;;-------------- ---------------- ---------------- -------- -------- -------- -------- -------- +Tank FLOW "" FLOW 1.0 1.0 5 +Tank P1 "" CONCENTRATION 1.0 1.0 10 + +[TREATMENT] +;;Node Pollutant Function +;;-------------- ---------------- ---------- +Tank P1 C = 2.0 + +[CURVES] +;;Name Type X-Value Y-Value +;;-------------- ---------- ---------- ---------- +Tank_Curve Storage 0 100 +Tank_Curve 1 100 +Tank_Curve 2 100 +Tank_Curve 3 100 +Tank_Curve 4 100 +Tank_Curve 5 100 + +[TIMESERIES] +;;Name Date Time Value +;;-------------- ---------- ---------- ---------- +TestRain 1 0 +TestRain 2 0.5 +TestRain 3 0.75 +TestRain 4 1 +TestRain 5 0.75 +TestRain 6 0.5 +TestRain 7 0 + +[PATTERNS] +;;Name Type Multipliers +;;-------------- ---------- ----------- +DailyX1 DAILY 1.0 1.0 1.0 1.0 1.0 1.0 1.0 + +[REPORT] +;;Reporting Options +INPUT NO +CONTROLS NO +SUBCATCHMENTS ALL +NODES ALL +LINKS ALL + +[TAGS] + +[MAP] +DIMENSIONS 0.000 0.000 10000.000 10000.000 +Units None + +[COORDINATES] +;;Node X-Coord Y-Coord +;;-------------- ------------------ ------------------ +Outfall -178.777 6435.986 +Tank -1101.499 6828.143 + +[VERTICES] +;;Link X-Coord Y-Coord +;;-------------- ------------------ ------------------ + diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 726c9ac4..93230a89 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -21,6 +21,10 @@ INPUT_FILE_EXAMPLE_2 = os.path.join(DATA_PATH, 'test_Example2.inp') REPORT_FILE_TEST_2 = os.path.join(DATA_PATH, 'temp_Example2.rpt') OUTPUT_FILE_TEST_2 = os.path.join(DATA_PATH, 'temp_Example2.out') +INPUT_FILE_EXAMPLE_3 = os.path.join(DATA_PATH, 'test_Example3.inp') +REPORT_FILE_TEST_3 = os.path.join(DATA_PATH, 'temp_Example3.rpt') +OUTPUT_FILE_TEST_3 = os.path.join(DATA_PATH, 'temp_Example3.out') + INPUT_FILE_FAIL = os.path.join(DATA_PATH, 'temp_nodata.inp') @@ -82,6 +86,17 @@ def close(): request.addfinalizer(close) +@pytest.fixture() +def run_pollut_sim(request): + solver.swmm_open(INPUT_FILE_EXAMPLE_3, REPORT_FILE_TEST_3, OUTPUT_FILE_TEST_3) + solver.swmm_start(0) + + def close(): + solver.swmm_end() + solver.swmm_close() + + request.addfinalizer(close) + def test_step(handle): solver.swmm_start(0) @@ -296,6 +311,19 @@ def test_link_get_pollutant(run_sim): assert tss == pytest.approx(14.7179, 0.1) assert lead == pytest.approx(2.9435, 0.1) +def test_link_set_pollutant(run_pollut_sim): + upstream_link = 'Valve' + downstream_node = 'Outfall' + pollutant = 'P1' + + upstream_link = solver.project_get_index(shared_enum.ObjectType.LINK, upstream_link) + downstream_node = solver.project_get_index(shared_enum.ObjectType.NODE, downstream_node) + pollutant = solver.project_get_index(shared_enum.ObjectType.POLLUT, pollutant) + + for i in range(0, 200): + solver.link_set_pollutant(upstream_link,shared_enum.LinkPollutant.QUALITY,pollutant,1000) + solver.swmm_step() + assert round(solver.node_get_pollutant(downstream_node,shared_enum.NodePollutant.QUALITY)[pollutant]) == 1000 def test_link_set_target_setting(run_sim): target_setting = solver.link_get_result(0, shared_enum.LinkResult.TARGET_SETTING) @@ -398,6 +426,30 @@ def test_node_get_pollutant(run_sim): assert lead == pytest.approx(2.9435, 0.1) +def test_node_set_pollutant(run_pollut_sim): + upstream_node = 'Tank' + downstream_node = 'Outfall' + pollutant = 'P1' + + upstream_node = solver.project_get_index(shared_enum.ObjectType.NODE, upstream_node) + downstream_node = solver.project_get_index(shared_enum.ObjectType.NODE, downstream_node) + pollutant = solver.project_get_index(shared_enum.ObjectType.POLLUT, pollutant) + + for i in range(0, 200): + solver.node_set_pollutant(upstream_node,pollutant,1000) + solver.swmm_step() + assert round(solver.node_get_pollutant(downstream_node,shared_enum.NodePollutant.QUALITY)[pollutant]) == 1000 + +def test_node_get_hrt(run_pollut_sim): + upstream_node = 'Tank' + upstream_node = solver.project_get_index(shared_enum.ObjectType.NODE, upstream_node) + + + for i in range(0, 200): + solver.swmm_step() + assert round(solver.node_get_result(upstream_node, shared_enum.NodeResult.HYD_RES_TIME)) == 17 + + def test_node_total_inflow(run_sim): total_inflow = solver.node_get_total_inflow(0) assert total_inflow == 0.0 From 54abe6c742654738755a022c3b6562a5736cb457 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 8 Feb 2022 14:41:12 -0500 Subject: [PATCH 029/126] update SWMM - update swmm-solver to latest commit - incremenet swmm-python version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- swmm-toolkit/swmm-solver | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 73b9b359..e9a28075 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.8.2 + 0.8.3 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 2f1aff57..ee9d1002 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.8.2", + version = "0.8.3", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index b9efd486..a7b84ec1 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.8.2" +__version__ = "0.8.3" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 76b8ae7e..025337c0 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 76b8ae7e39f07a659b51284effafe668394d7f29 +Subproject commit 025337c026dc2b6d493fb23ab05016329f7547cb From d235a6f9d37f6ab64ddb31b649ef3bc4b17c8fd1 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 8 Feb 2022 15:04:59 -0500 Subject: [PATCH 030/126] update authors --- swmm-toolkit/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/AUTHORS b/swmm-toolkit/AUTHORS index c7a896b7..bd1ed338 100644 --- a/swmm-toolkit/AUTHORS +++ b/swmm-toolkit/AUTHORS @@ -5,3 +5,4 @@ Michael Tryby (public domain) Jennifer Wu Caleb Buahin Laurent Courty +Constantine Karos From f7c8459303329b63087b3bf611026e1c701d0e55 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 8 Feb 2022 16:19:11 -0500 Subject: [PATCH 031/126] Versioning - increment version to 0.9.0 - update authors --- swmm-toolkit/AUTHORS | 2 ++ swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/AUTHORS b/swmm-toolkit/AUTHORS index bd1ed338..334d0a05 100644 --- a/swmm-toolkit/AUTHORS +++ b/swmm-toolkit/AUTHORS @@ -6,3 +6,5 @@ Jennifer Wu Caleb Buahin Laurent Courty Constantine Karos +Abhiram Mullapudi +Brooke Mason \ No newline at end of file diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index e9a28075..93c16d67 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.8.3 + 0.9.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index ee9d1002..d293de19 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.8.3", + version = "0.9.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index a7b84ec1..d285fb39 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.8.3" +__version__ = "0.9.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 2e4f6383686c2615135800d61e7380ed2471f959 Mon Sep 17 00:00:00 2001 From: bemason Date: Mon, 4 Apr 2022 12:27:06 -0400 Subject: [PATCH 032/126] Add pollutant tests 1. Added test to get node pollutant REACTOR_QUAL. Passed test. 2. Added test to get node pollutant INFLOW_QUAL. Passed test. 3. Added test to get link pollutant REACTOR_QUAL. Passed test. --- swmm-toolkit/tests/test_solver.py | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 93230a89..9d08aa99 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -311,6 +311,22 @@ def test_link_get_pollutant(run_sim): assert tss == pytest.approx(14.7179, 0.1) assert lead == pytest.approx(2.9435, 0.1) +def test_link_get_pollutant_reactor(run_sim): + pollut = solver.link_get_pollutant(0, shared_enum.LinkPollutant.REACTOR_CONC) + tss, lead = tuple(pollut) + assert tss == 0.0 + assert lead == 0.0 + + for i in range(0, 250): + solver.swmm_step() + pollut = solver.link_get_pollutant(0, shared_enum.LinkPollutant.REACTOR_CONC) + print(pollut) + + tss, lead = tuple(pollut) + + assert tss == pytest.approx(14.7179, 0.1) + assert lead == pytest.approx(2.9435, 0.1) + def test_link_set_pollutant(run_pollut_sim): upstream_link = 'Valve' downstream_node = 'Outfall' @@ -425,6 +441,35 @@ def test_node_get_pollutant(run_sim): assert tss == pytest.approx(14.7179, 0.1) assert lead == pytest.approx(2.9435, 0.1) +def test_node_get_pollutant_reactor(run_pollut_sim): + # Need to test on a storage node + node_index = solver.project_get_index(shared_enum.ObjectType.NODE, 'Tank') + #print(node_index) + pollut = solver.node_get_pollutant(1, shared_enum.NodePollutant.REACTOR_CONC) + p1 = pollut[0] + assert p1 == 0.0 + + for i in range(0, 250): + solver.swmm_step() + pollut = solver.node_get_pollutant(1, shared_enum.NodePollutant.REACTOR_CONC) + + p1 = pollut[0] + assert p1 == pytest.approx(2.4455, 0.1) + +def test_node_get_pollutant_inflow(run_pollut_sim): + # Need to test on a storage node + node_index = solver.project_get_index(shared_enum.ObjectType.NODE, 'Tank') + #print(node_index) + pollut = solver.node_get_pollutant(1, shared_enum.NodePollutant.INFLOW_CONC) + p1 = pollut[0] + assert p1 == 0.0 + + for i in range(0, 250): + solver.swmm_step() + pollut = solver.node_get_pollutant(1, shared_enum.NodePollutant.INFLOW_CONC) + + p1 = pollut[0] + assert p1 == pytest.approx(10.0, 0.1) def test_node_set_pollutant(run_pollut_sim): upstream_node = 'Tank' From b3ee118653e8154ee810e1a7c3af3a74de1c1bb9 Mon Sep 17 00:00:00 2001 From: bemason Date: Tue, 5 Apr 2022 10:44:40 -0400 Subject: [PATCH 033/126] Updated node setter pollutant description in solver_docs.i --- swmm-toolkit/src/swmm/toolkit/solver_docs.i | 4 +++- swmm-toolkit/swmm-solver | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/solver_docs.i b/swmm-toolkit/src/swmm/toolkit/solver_docs.i index 8f34f2eb..1f29d2ec 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_docs.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_docs.i @@ -665,12 +665,14 @@ flowrate: double %feature("autodoc", -"Set node inflow pollutant concentration +"Set node pollutant concentration Parameters ---------- index: int The link index. +type: SM_NodePollut + The property type code (see :ref: SM_NodePollut). Currently Only QUALITY (0) is supported. pollutant_index: int The index of the pollutant to set. pollutant_value: diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 025337c0..fe450190 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 025337c026dc2b6d493fb23ab05016329f7547cb +Subproject commit fe450190484fd0a7e85a2fd819d3a4a5f78ec835 From e2e0dfe3b623881c66a9c3a8e2cf6371d3c98b6a Mon Sep 17 00:00:00 2001 From: bemason Date: Tue, 5 Apr 2022 10:47:52 -0400 Subject: [PATCH 034/126] Update test_solver.py Add new required parameter to node_set_pollutant in test_solver.py. --- swmm-toolkit/tests/test_solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 9d08aa99..6609826f 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -481,7 +481,7 @@ def test_node_set_pollutant(run_pollut_sim): pollutant = solver.project_get_index(shared_enum.ObjectType.POLLUT, pollutant) for i in range(0, 200): - solver.node_set_pollutant(upstream_node,pollutant,1000) + solver.node_set_pollutant(upstream_node,shared_enum.NodePollutant.QUALITY, pollutant,1000) solver.swmm_step() assert round(solver.node_get_pollutant(downstream_node,shared_enum.NodePollutant.QUALITY)[pollutant]) == 1000 From 14503740b693917b82df9d82913903f2bfe8da48 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 14 Apr 2022 12:30:17 -0400 Subject: [PATCH 035/126] update swmm-solver to latest develop --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 025337c0..6d6b5272 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 025337c026dc2b6d493fb23ab05016329f7547cb +Subproject commit 6d6b5272250acaa3939db9e265f0e593dc96e43e From 7ae4411eb1927dccc8be28470e4d2fefb0e1ab5c Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 14 Apr 2022 12:59:31 -0400 Subject: [PATCH 036/126] fix error in swmm_setNodePollut docstring --- swmm-toolkit/src/swmm/toolkit/solver_docs.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/src/swmm/toolkit/solver_docs.i b/swmm-toolkit/src/swmm/toolkit/solver_docs.i index 1f29d2ec..e47d24be 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_docs.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_docs.i @@ -670,7 +670,7 @@ flowrate: double Parameters ---------- index: int - The link index. + The node index. type: SM_NodePollut The property type code (see :ref: SM_NodePollut). Currently Only QUALITY (0) is supported. pollutant_index: int From 2e7ee86d2dbbca3e1ad6825b8b5f83ce78849ec9 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 14 Apr 2022 15:23:36 -0400 Subject: [PATCH 037/126] Update windows action runner and python support - Updated windows action runner to 2022 - Revised cmake args to use VS 2022 - Update cmake to 3.21 for VS 2022 generator support - Deprecate Python 3.6 by removing from build and test scripts - Add Python 3.10 support by adding to build and test scripts - Update numpy to 1.21.5 for Python 3.10 support - Update pytest to 7.1.1 for Python 3.10 support --- .github/workflows/python-package.yml | 6 +++--- swmm-toolkit/build-requirements.txt | 2 +- swmm-toolkit/setup.py | 4 ++-- swmm-toolkit/test-requirements.txt | 4 ++-- swmm-toolkit/tools/build-wheels.sh | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cda4ef33..470bdfd6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -71,10 +71,10 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2016, macos-10.15] - py: [3.6, 3.7, 3.8, 3.9] + os: [windows-2022, macos-10.15] + py: ["3.7", "3.8", "3.9", "3.10"] include: - - os: windows-2016 + - os: windows-2022 sys_pkgs: choco install swig activate: ./build-env/Scripts/activate diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 9f33934a..17b3977d 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -4,4 +4,4 @@ setuptools==41.4.0 wheel==0.33.6 scikit-build==0.11.1 -cmake==3.18.4 +cmake==3.21 diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index d293de19..21b72ca6 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -65,7 +65,7 @@ def run(self): # Set Platform specific cmake args here if platform_system == "Windows": - cmake_args = ["-GVisual Studio 15 2017 Win64"] + cmake_args = ["-GVisual Studio 17 2022","-Ax64"] elif platform_system == "Darwin": cmake_args = ["-GNinja","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9"] @@ -116,10 +116,10 @@ def exclude_files(cmake_manifest): "Operating System :: POSIX :: Linux", "Operating System :: MacOS", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: C", "Development Status :: 4 - Beta", ] diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 37c7dd05..80ca5603 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -1,6 +1,6 @@ -pytest==6.1.1 -numpy==1.17.2 +pytest==7.1.1 +numpy==1.21.5 aenum==2.2.6 diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh index 6f15b66c..e1f7090c 100755 --- a/swmm-toolkit/tools/build-wheels.sh +++ b/swmm-toolkit/tools/build-wheels.sh @@ -21,7 +21,7 @@ mkdir -p ./dist cd swmm-toolkit # Build wheels -for PYBIN in /opt/python/cp{36,37,38,39}*/bin; do +for PYBIN in /opt/python/cp{37,38,39,310}*/bin; do # Setup python virtual environment for build ${PYBIN}/python -m venv --clear ./build-env source ./build-env/bin/activate @@ -52,7 +52,7 @@ done # Install packages and test -for PYBIN in /opt/python/cp{36,37,38,39}*/bin; do +for PYBIN in /opt/python/cp{37,38,39,310}*/bin; do # Setup python virtual environment for test ${PYBIN}/python -m venv --clear ./test-env source ./test-env/bin/activate From 40c80d8d62cd28247dbd03993624d7cfa1fdd85a Mon Sep 17 00:00:00 2001 From: karosc Date: Mon, 25 Apr 2022 19:30:39 -0400 Subject: [PATCH 038/126] Debug swmm_get_version() - add type map for swmm_getVersion - add custom exception handling for swmm_getVersion - add test for legacy version getter --- swmm-toolkit/src/swmm/toolkit/solver.i | 9 +++++++++ swmm-toolkit/tests/test_solver.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index 47413c81..c9e19c96 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -39,6 +39,10 @@ Py_INCREF($result); } +%typemap(out) int swmm_getVersion { + $result = PyInt_FromLong($1); +} + %apply int *OUTPUT { int *index, @@ -189,6 +193,11 @@ $function } +%exception swmm_getVersion +{ + $function +} + /* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */ %exception { diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 6609826f..992fbe41 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -114,7 +114,12 @@ def test_version(handle): major, minor, patch = solver.swmm_version_info().split('.') print(major, minor, patch) assert major == '5' - + +def test_legacy_version(handle): + version = solver.swmm_get_version() + major = str(version)[0] + assert isinstance(version, int) + assert major == '5' def test_simulation_unit(handle): simulation_system_unit_option = solver.simulation_get_unit(shared_enum.UnitProperty.SYSTEM_UNIT) From e95275beb96a58adea94e1578eb46fa1ce125b8c Mon Sep 17 00:00:00 2001 From: abhiramm7 Date: Sat, 21 May 2022 00:45:58 -0400 Subject: [PATCH 039/126] updataing submodule to master branch --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index e4bb4b8c..f827f1c0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "swmm-toolkit/swmm-solver"] path = swmm-toolkit/swmm-solver url = https://github.com/OpenWaterAnalytics/Stormwater-Management-Model.git - branch = develop + branch = master From cb7c7631df6a772ded574de0a8d8e8b586ad3c38 Mon Sep 17 00:00:00 2001 From: abhiramm7 Date: Sat, 21 May 2022 01:26:24 -0400 Subject: [PATCH 040/126] update linux to latest image in github workflow --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 470bdfd6..6985e6a6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -9,7 +9,7 @@ env: jobs: build_nrtest_plugin: name: Build nrtest-swmm plugin - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 defaults: run: working-directory: ./nrtest-swmm @@ -37,7 +37,7 @@ jobs: build_linux_wheels: name: Build wheels on linux - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout repo From 802471b78301ae204afc378c0da28f0265579dd3 Mon Sep 17 00:00:00 2001 From: abhiramm7 Date: Sat, 21 May 2022 01:43:18 -0400 Subject: [PATCH 041/126] update linux to 20.04 --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6985e6a6..afeac691 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -9,7 +9,7 @@ env: jobs: build_nrtest_plugin: name: Build nrtest-swmm plugin - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest defaults: run: working-directory: ./nrtest-swmm @@ -37,7 +37,7 @@ jobs: build_linux_wheels: name: Build wheels on linux - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo From 4a46deeb83db3750dcda9cce14ce80045fa9da4c Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 09:31:49 +0530 Subject: [PATCH 042/126] update development status to prod --- swmm-toolkit/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 21b72ca6..d9d1c0a5 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -109,7 +109,7 @@ def exclude_files(cmake_manifest): maintainer_email='tryby.michael@epa.gov', license='CC0', - keywords="swmm5, swmm, stormwater, hydraulics, hydrology, ", + keywords="swmm5, swmm, stormwater, hydraulics, hydrology", classifiers=[ "Topic :: Scientific/Engineering", "Operating System :: Microsoft :: Windows", @@ -121,6 +121,6 @@ def exclude_files(cmake_manifest): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: C", - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", ] ) From ccc4b5fa023a8e1d5faa255694219e57672b589b Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 09:59:35 +0530 Subject: [PATCH 043/126] update conda check to be inline with python 3.7 and greater --- swmm-toolkit/src/swmm/toolkit/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index d285fb39..b1aab68a 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -4,14 +4,14 @@ # __init__.py - SWMM toolkit package # # Created: Aug 9, 2018 -# Updated: May 19, 2021 +# Updated: July 2, 2022 # # Author: See AUTHORS # -''' +""" A low level pythonic API for the swmm-output and swmm-solver dlls using SWIG. -''' +""" __author__ = "See AUTHORS" @@ -37,8 +37,9 @@ libdir = os.path.join(os.path.dirname(__file__), "../../swmm_toolkit") if hasattr(os, 'add_dll_directory'): - if 'conda' in sys.version: - os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE']="1" - os.add_dll_directory(libdir) + conda_exists = os.path.exists(os.path.join(sys.prefix, 'conda-meta')) + if conda_exists: + os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = "1" + os.add_dll_directory(libdir) else: os.environ["PATH"] = libdir + ";" + os.environ["PATH"] From 4f136a559057f6fb60224591588d248167bc8894 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:20:51 +0530 Subject: [PATCH 044/126] conda build test for windows and mac --- .github/workflows/python-package.yml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index afeac691..b18a02c8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,6 +33,50 @@ jobs: with: path: nrtest-swmm/dist/*.whl + build_conda_wheels: + name: Conda wheel test (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["macos-latest", "windows-latest"] + python-version: ["3.7", "3.8", "3.9", "3.10"] + include: + - os: windows-2022 + sys_pkgs: choco install swig + activate: ./build-env/Scripts/activate + + - os: macos-10.15 + sys_pkgs: brew install swig ninja + activate: source ./build-env/bin/activate + + steps: + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install required system packages + run: ${{matrix.sys_pkgs}} + + - name: Build wheel in virtual env + run: | + python -m venv --clear ./build-env + ${{matrix.activate}} + python -m pip install -r build-requirements.txt + python setup.py bdist_wheel + deactivate + + - name: Test wheel + run: | + pip install -r test-requirements.txt + pip install --no-index --find-links=./dist swmm_toolkit + pytest build_linux_wheels: From 20f77a3346b179d3039988d74c16563ce55f05ea Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:26:11 +0530 Subject: [PATCH 045/126] remove venv --- .github/workflows/python-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b18a02c8..9aaa2804 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -66,8 +66,6 @@ jobs: - name: Build wheel in virtual env run: | - python -m venv --clear ./build-env - ${{matrix.activate}} python -m pip install -r build-requirements.txt python setup.py bdist_wheel deactivate From 189118cf29c12419429b689c469dade34c6263cb Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:33:26 +0530 Subject: [PATCH 046/126] force python3 on conda check --- .github/workflows/python-package.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9aaa2804..a8019626 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -66,14 +66,13 @@ jobs: - name: Build wheel in virtual env run: | - python -m pip install -r build-requirements.txt - python setup.py bdist_wheel - deactivate + python3 -m pip install -r build-requirements.txt + python3 setup.py bdist_wheel - name: Test wheel run: | - pip install -r test-requirements.txt - pip install --no-index --find-links=./dist swmm_toolkit + python3 -m pip install -r test-requirements.txt + python3 -m pip install --no-index --find-links=./dist swmm_toolkit pytest From da183bc404f2c4aacbd37236b87ff6207deeeb75 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:40:08 +0530 Subject: [PATCH 047/126] python3 conda check --- .github/workflows/python-package.yml | 33 +++++++++------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a8019626..6eeb8543 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,37 +34,24 @@ jobs: path: nrtest-swmm/dist/*.whl build_conda_wheels: - name: Conda wheel test (${{ matrix.python-version }}, ${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["macos-latest", "windows-latest"] - python-version: ["3.7", "3.8", "3.9", "3.10"] - include: - - os: windows-2022 - sys_pkgs: choco install swig - activate: ./build-env/Scripts/activate - - - os: macos-10.15 - sys_pkgs: brew install swig ninja - activate: source ./build-env/bin/activate + name: Conda wheel test mac + runs-on: macos-latest steps: - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - - name: Checkout repo uses: actions/checkout@v2 with: submodules: true + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.7 + - name: Install required system packages - run: ${{matrix.sys_pkgs}} + run: brew install swig ninja - - name: Build wheel in virtual env + - name: Install requirements run: | python3 -m pip install -r build-requirements.txt python3 setup.py bdist_wheel @@ -154,4 +141,4 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - path: swmm-toolkit/dist/*.whl + path: swmm-toolkit/dist/*.whl \ No newline at end of file From c3a431a25ad0558db96736c5df28a88c8856c70d Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:56:11 +0530 Subject: [PATCH 048/126] test path --- .github/workflows/python-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6eeb8543..5a74fc3c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -58,6 +58,8 @@ jobs: - name: Test wheel run: | + pwd + ls python3 -m pip install -r test-requirements.txt python3 -m pip install --no-index --find-links=./dist swmm_toolkit pytest From e4e8a5a0eb8383217f278801fba74030991c762d Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 10:59:11 +0530 Subject: [PATCH 049/126] test path with right location --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5a74fc3c..1dae6ed2 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -53,13 +53,13 @@ jobs: - name: Install requirements run: | + pwd + ls python3 -m pip install -r build-requirements.txt python3 setup.py bdist_wheel - name: Test wheel run: | - pwd - ls python3 -m pip install -r test-requirements.txt python3 -m pip install --no-index --find-links=./dist swmm_toolkit pytest From ab002f8517b85832c953ab0ba5555de88d6cc2ba Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 11:05:07 +0530 Subject: [PATCH 050/126] right path --- .github/workflows/python-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1dae6ed2..b146cacf 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -53,8 +53,7 @@ jobs: - name: Install requirements run: | - pwd - ls + cd swmm-toolkit python3 -m pip install -r build-requirements.txt python3 setup.py bdist_wheel From a0b7f0162bbdc542e311ced6877b6acc3cc0321b Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 11:11:34 +0530 Subject: [PATCH 051/126] right path for test --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b146cacf..7fe495af 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -59,6 +59,7 @@ jobs: - name: Test wheel run: | + cd swmm-toolkit python3 -m pip install -r test-requirements.txt python3 -m pip install --no-index --find-links=./dist swmm_toolkit pytest From ed63a87d7394a8b25d4250d51ff9f8b76f8b14bc Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 11:17:11 +0530 Subject: [PATCH 052/126] user path --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7fe495af..8987c902 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -61,7 +61,7 @@ jobs: run: | cd swmm-toolkit python3 -m pip install -r test-requirements.txt - python3 -m pip install --no-index --find-links=./dist swmm_toolkit + python3 -m pip install --no-index --find-links=./dist swmm_toolkit --user pytest From cac30a19ccffc4d00da4bfde89e2cef5bda85230 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Sat, 2 Jul 2022 11:27:51 +0530 Subject: [PATCH 053/126] point to right conda python --- .github/workflows/python-package.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8987c902..93291fe4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -54,14 +54,16 @@ jobs: - name: Install requirements run: | cd swmm-toolkit - python3 -m pip install -r build-requirements.txt - python3 setup.py bdist_wheel + conda activate test + python -m pip install -r build-requirements.txt + python setup.py bdist_wheel - name: Test wheel run: | cd swmm-toolkit - python3 -m pip install -r test-requirements.txt - python3 -m pip install --no-index --find-links=./dist swmm_toolkit --user + conda activate test + python -m pip install -r test-requirements.txt + python -m pip install --no-index --find-links=./dist swmm_toolkit --user pytest From bcd66553c96ffa5512ba685f53487683c23686c7 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Fri, 15 Jul 2022 05:23:49 -0400 Subject: [PATCH 054/126] add default shell --- .github/workflows/python-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 93291fe4..e4f97fbe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -36,6 +36,9 @@ jobs: build_conda_wheels: name: Conda wheel test mac runs-on: macos-latest + defaults: + run: + shell: bash -l {0} steps: - name: Checkout repo From 0ebd04efa3f2c0e6dc10fb0610c543a0fd695997 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Fri, 15 Jul 2022 05:47:46 -0400 Subject: [PATCH 055/126] update conda env install --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e4f97fbe..d9f4accf 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -49,7 +49,7 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true - python-version: 3.7 + python-version: 3.9 - name: Install required system packages run: brew install swig ninja @@ -58,14 +58,14 @@ jobs: run: | cd swmm-toolkit conda activate test - python -m pip install -r build-requirements.txt + conda install --yes --file build-requirements.txt python setup.py bdist_wheel - name: Test wheel run: | cd swmm-toolkit conda activate test - python -m pip install -r test-requirements.txt + conda install --yes --file test-requirements.txt python -m pip install --no-index --find-links=./dist swmm_toolkit --user pytest From cd586c6d05a98bc109eabbb8cf7f0dc01488818a Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Fri, 15 Jul 2022 05:52:28 -0400 Subject: [PATCH 056/126] add conda forge --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d9f4accf..650160cb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -49,6 +49,7 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true + channels: conda-forge python-version: 3.9 - name: Install required system packages From ce9b1c263712467b30c811680142b6094a3e7f48 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Fri, 15 Jul 2022 06:00:15 -0400 Subject: [PATCH 057/126] 3.8 version patch --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 650160cb..165e832a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -50,7 +50,7 @@ jobs: with: auto-update-conda: true channels: conda-forge - python-version: 3.9 + python-version: 3.8 - name: Install required system packages run: brew install swig ninja From 0d91bf35bf2e3ebd5ba8d4bf04504f4363ec3b48 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Fri, 15 Jul 2022 14:45:31 -0400 Subject: [PATCH 058/126] renaming conda test name --- .github/workflows/python-package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 165e832a..14d41f8f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,7 +33,7 @@ jobs: with: path: nrtest-swmm/dist/*.whl - build_conda_wheels: + test_conda_build: name: Conda wheel test mac runs-on: macos-latest defaults: @@ -50,6 +50,7 @@ jobs: with: auto-update-conda: true channels: conda-forge + # Python 3.9 does not support all libs we need in swmm-python python-version: 3.8 - name: Install required system packages From da1b467ddd584099a4a57971b09e07fca8ea3dc9 Mon Sep 17 00:00:00 2001 From: Abhiram Mullapudi Date: Wed, 20 Jul 2022 20:02:56 -0400 Subject: [PATCH 059/126] updates swmm-solver to 7e7e6da799e4c8f1fd51499cebe47f82f80c67f6 --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 6d6b5272..7e7e6da7 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 6d6b5272250acaa3939db9e265f0e593dc96e43e +Subproject commit 7e7e6da799e4c8f1fd51499cebe47f82f80c67f6 From 1a23528875c472a219559c747b9df57e5c5b0ddd Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Fri, 22 Jul 2022 10:37:22 -0400 Subject: [PATCH 060/126] Updates maintainer, and aenum --- swmm-toolkit/setup.py | 4 ++-- swmm-toolkit/test-requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index d9d1c0a5..f821ceb1 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -94,7 +94,7 @@ def exclude_files(cmake_manifest): package_dir = package_dir, zip_safe = False, - install_requires = ["aenum==2.2.6"], + install_requires = ["aenum==3.1.11"], cmdclass = {"clean": CleanCommand}, cmake_args = cmake_args, @@ -106,7 +106,7 @@ def exclude_files(cmake_manifest): url='https://github.com/OpenWaterAnalytics/swmm-python', author='See AUTHORS', - maintainer_email='tryby.michael@epa.gov', + maintainer_email='bemcdonnell@gmail.com', license='CC0', keywords="swmm5, swmm, stormwater, hydraulics, hydrology", diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 80ca5603..c6c0ef8d 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -3,4 +3,4 @@ pytest==7.1.1 numpy==1.21.5 -aenum==2.2.6 +aenum==3.1.11 From ba084e087fb25e167b43ec8b82661ede9284b36c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Jul 2022 19:54:35 +0000 Subject: [PATCH 061/126] Bump numpy from 1.21.5 to 1.22.0 in /swmm-toolkit Bumps [numpy](https://github.com/numpy/numpy) from 1.21.5 to 1.22.0. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/HOWTO_RELEASE.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.21.5...v1.22.0) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- swmm-toolkit/test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index c6c0ef8d..9ffbede6 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -2,5 +2,5 @@ pytest==7.1.1 -numpy==1.21.5 +numpy==1.22.0 aenum==3.1.11 From b0a8d4fe5a8e09d9400f255d3e83aeb7151cf790 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Fri, 22 Jul 2022 16:39:29 -0400 Subject: [PATCH 062/126] Update numpy, format requirements files --- swmm-toolkit/build-requirements.txt | 8 ++++---- swmm-toolkit/test-requirements.txt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 17b3977d..115a86d3 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -1,7 +1,7 @@ -setuptools==41.4.0 -wheel==0.33.6 -scikit-build==0.11.1 -cmake==3.21 +setuptools == 41.4.0 +wheel == 0.33.6 +scikit-build == 0.11.1 +cmake == 3.21 diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 9ffbede6..69d2fda8 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -1,6 +1,6 @@ -pytest==7.1.1 -numpy==1.22.0 -aenum==3.1.11 +pytest == 7.1.1 +numpy == 1.21.6; python_version == "3.7" +numpy == 1.22.0; python_version >= "3.8" From ce02b57ce9a381d4117bbbc9e2cc77eb844e95fa Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Fri, 22 Jul 2022 16:45:32 -0400 Subject: [PATCH 063/126] Add aenum --- swmm-toolkit/test-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 69d2fda8..1d649ff1 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -4,3 +4,4 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" numpy == 1.22.0; python_version >= "3.8" +aenum == 3.1.11 From 32265144f48c602aba94794caa926bc88e4ba2db Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 11:41:01 -0400 Subject: [PATCH 064/126] Separation of concerns --- .github/workflows/conda-test.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/python-package.yml | 39 +--------------------- 2 files changed, 49 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/conda-test.yml diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml new file mode 100644 index 00000000..8f153d29 --- /dev/null +++ b/.github/workflows/conda-test.yml @@ -0,0 +1,48 @@ +name: Conda Tests + +on: + workflow_run: + workflows: ["Build Wheels"] + types: [requested] + branches: + - '**' + + +jobs: + test_conda_build: + name: Conda wheel test mac + runs-on: macos-latest + defaults: + run: + shell: bash -l {0} + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + channels: conda-forge + # Python 3.9 does not support all libs we need in swmm-python + python-version: 3.8 + + - name: Install required system packages + run: brew install swig ninja + + - name: Install requirements + run: | + cd swmm-toolkit + conda activate test + conda install --yes --file build-requirements.txt + python setup.py bdist_wheel + + - name: Test wheel + run: | + cd swmm-toolkit + conda activate test + conda install --yes --file test-requirements.txt + python -m pip install --no-index --find-links=./dist swmm_toolkit --user + pytest diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 14d41f8f..afeac691 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,43 +33,6 @@ jobs: with: path: nrtest-swmm/dist/*.whl - test_conda_build: - name: Conda wheel test mac - runs-on: macos-latest - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - channels: conda-forge - # Python 3.9 does not support all libs we need in swmm-python - python-version: 3.8 - - - name: Install required system packages - run: brew install swig ninja - - - name: Install requirements - run: | - cd swmm-toolkit - conda activate test - conda install --yes --file build-requirements.txt - python setup.py bdist_wheel - - - name: Test wheel - run: | - cd swmm-toolkit - conda activate test - conda install --yes --file test-requirements.txt - python -m pip install --no-index --find-links=./dist swmm_toolkit --user - pytest build_linux_wheels: @@ -150,4 +113,4 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - path: swmm-toolkit/dist/*.whl \ No newline at end of file + path: swmm-toolkit/dist/*.whl From 4ed69a5229ee1cedfd4f0aad0cd72da2e74fe7f0 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 11:54:18 -0400 Subject: [PATCH 065/126] Tweak trigger --- .github/workflows/conda-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml index 8f153d29..452ae4cb 100644 --- a/.github/workflows/conda-test.yml +++ b/.github/workflows/conda-test.yml @@ -5,7 +5,7 @@ on: workflows: ["Build Wheels"] types: [requested] branches: - - '**' + - '/dev-condatest' jobs: From bb496f1f1eb4590763c70ec81027d2b284b920c4 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 12:05:02 -0400 Subject: [PATCH 066/126] Debugging trigger --- .github/workflows/conda-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml index 452ae4cb..16947db2 100644 --- a/.github/workflows/conda-test.yml +++ b/.github/workflows/conda-test.yml @@ -3,7 +3,8 @@ name: Conda Tests on: workflow_run: workflows: ["Build Wheels"] - types: [requested] + types: + - completed branches: - '/dev-condatest' From be0c3603ae786bb0f13eef2d1388df72ad43d11c Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 12:06:19 -0400 Subject: [PATCH 067/126] Create conda-test.yml Must be in default branch to run --- .github/workflows/conda-test.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/conda-test.yml diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml new file mode 100644 index 00000000..16947db2 --- /dev/null +++ b/.github/workflows/conda-test.yml @@ -0,0 +1,49 @@ +name: Conda Tests + +on: + workflow_run: + workflows: ["Build Wheels"] + types: + - completed + branches: + - '/dev-condatest' + + +jobs: + test_conda_build: + name: Conda wheel test mac + runs-on: macos-latest + defaults: + run: + shell: bash -l {0} + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + channels: conda-forge + # Python 3.9 does not support all libs we need in swmm-python + python-version: 3.8 + + - name: Install required system packages + run: brew install swig ninja + + - name: Install requirements + run: | + cd swmm-toolkit + conda activate test + conda install --yes --file build-requirements.txt + python setup.py bdist_wheel + + - name: Test wheel + run: | + cd swmm-toolkit + conda activate test + conda install --yes --file test-requirements.txt + python -m pip install --no-index --find-links=./dist swmm_toolkit --user + pytest From 5a4c77b50b57c55b94958a9c36841cb25c27c3d0 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 12:16:19 -0400 Subject: [PATCH 068/126] Debug trigger --- .github/workflows/conda-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml index 16947db2..f8b2648c 100644 --- a/.github/workflows/conda-test.yml +++ b/.github/workflows/conda-test.yml @@ -5,8 +5,6 @@ on: workflows: ["Build Wheels"] types: - completed - branches: - - '/dev-condatest' jobs: From 1c4feca5f73f7184ff8063de25fcb03de2d64795 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Sun, 24 Jul 2022 12:29:16 -0400 Subject: [PATCH 069/126] Config conda test to use pip --- .github/workflows/conda-test.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml index f8b2648c..6890163a 100644 --- a/.github/workflows/conda-test.yml +++ b/.github/workflows/conda-test.yml @@ -34,14 +34,17 @@ jobs: - name: Install requirements run: | cd swmm-toolkit - conda activate test - conda install --yes --file build-requirements.txt + conda create -n test-env pip + conda activate test-env + pip install -r build-requirements.txt python setup.py bdist_wheel + conda deactivate - name: Test wheel run: | cd swmm-toolkit - conda activate test - conda install --yes --file test-requirements.txt - python -m pip install --no-index --find-links=./dist swmm_toolkit --user + conda activate test-env + pip install -r test-requirements.txt + python -m pip install --no-index --find-links=./dist swmm_toolkit pytest + conda deactivate From 74042b5b809086709a9d91f1d47cc84a3e6d43a6 Mon Sep 17 00:00:00 2001 From: karosc Date: Sun, 30 Oct 2022 11:16:37 -0400 Subject: [PATCH 070/126] build wheels for python 3.11 --- .github/workflows/python-package.yml | 2 +- swmm-toolkit/tools/build-wheels.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index afeac691..cce34454 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -72,7 +72,7 @@ jobs: fail-fast: false matrix: os: [windows-2022, macos-10.15] - py: ["3.7", "3.8", "3.9", "3.10"] + py: ["3.7", "3.8", "3.9", "3.10", "3.11"] include: - os: windows-2022 sys_pkgs: choco install swig diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh index e1f7090c..9e556b7b 100755 --- a/swmm-toolkit/tools/build-wheels.sh +++ b/swmm-toolkit/tools/build-wheels.sh @@ -21,7 +21,7 @@ mkdir -p ./dist cd swmm-toolkit # Build wheels -for PYBIN in /opt/python/cp{37,38,39,310}*/bin; do +for PYBIN in /opt/python/cp{37,38,39,310,311}*/bin; do # Setup python virtual environment for build ${PYBIN}/python -m venv --clear ./build-env source ./build-env/bin/activate From 8478a39cd8bfa43fa5b5c9f6126ba0f9e72c7ada Mon Sep 17 00:00:00 2001 From: karosc Date: Sun, 30 Oct 2022 11:29:15 -0400 Subject: [PATCH 071/126] update numpy test version for python 3.11 --- swmm-toolkit/test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 1d649ff1..f46c81c6 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -3,5 +3,5 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" -numpy == 1.22.0; python_version >= "3.8" +numpy == 1.23.4; python_version >= "3.8" aenum == 3.1.11 From 1b9dfdb6bf0a2ec79f32ba5230ba075f87925236 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 1 Nov 2022 09:27:51 -0400 Subject: [PATCH 072/126] explicitly use latest manylinux docker --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cce34454..94cc39be 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -3,7 +3,7 @@ name: Build Wheels on: [push, pull_request] env: - DOCKER_IMAGE: dockcross/manylinux2014-x64 + DOCKER_IMAGE: dockcross/manylinux2014-x64:latest jobs: From 992b31ffd1c833c27da3ef1016a954514ceb963e Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 1 Nov 2022 12:05:25 -0400 Subject: [PATCH 073/126] pin swig to 4.0.2 - New version of swig (4.1.0) not working properly with SWIG_COMPILE_DEFINITIONS --- swmm-toolkit/build-requirements.txt | 1 + swmm-toolkit/tools/build-wheels.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 115a86d3..2fffc03d 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -5,3 +5,4 @@ setuptools == 41.4.0 wheel == 0.33.6 scikit-build == 0.11.1 cmake == 3.21 +swig == 4.0.2 \ No newline at end of file diff --git a/swmm-toolkit/tools/build-wheels.sh b/swmm-toolkit/tools/build-wheels.sh index 9e556b7b..738627ca 100755 --- a/swmm-toolkit/tools/build-wheels.sh +++ b/swmm-toolkit/tools/build-wheels.sh @@ -13,7 +13,7 @@ set -e -x # Install a system package required by our library -sudo yum install -y swig +# sudo yum install -y swig # Setup and build in swmm-toolkit dir From 3492401a240b3c219ee45f6d84e9de82b55a219c Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 1 Nov 2022 12:13:29 -0400 Subject: [PATCH 074/126] update setup.py classifiers --- swmm-toolkit/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index f821ceb1..11736d9d 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -120,6 +120,7 @@ def exclude_files(cmake_manifest): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: C", "Development Status :: 5 - Production/Stable", ] From 1e167f16ca62bf80ba41bead56786cb7278bdc47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 21:03:11 +0000 Subject: [PATCH 075/126] Bump wheel from 0.33.6 to 0.38.1 in /swmm-toolkit Bumps [wheel](https://github.com/pypa/wheel) from 0.33.6 to 0.38.1. - [Release notes](https://github.com/pypa/wheel/releases) - [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst) - [Commits](https://github.com/pypa/wheel/compare/0.33.6...0.38.1) --- updated-dependencies: - dependency-name: wheel dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- swmm-toolkit/build-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index 2fffc03d..b19f7b21 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -2,7 +2,7 @@ setuptools == 41.4.0 -wheel == 0.33.6 +wheel == 0.38.1 scikit-build == 0.11.1 cmake == 3.21 swig == 4.0.2 \ No newline at end of file From 8d7ca3eab3f3e8bc7da0f049cf6f4edb712d9e80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 00:39:50 +0000 Subject: [PATCH 076/126] Bump setuptools from 41.4.0 to 65.5.1 in /swmm-toolkit Bumps [setuptools](https://github.com/pypa/setuptools) from 41.4.0 to 65.5.1. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst) - [Commits](https://github.com/pypa/setuptools/compare/v41.4.0...v65.5.1) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- swmm-toolkit/build-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/build-requirements.txt b/swmm-toolkit/build-requirements.txt index b19f7b21..cc5fbd1a 100644 --- a/swmm-toolkit/build-requirements.txt +++ b/swmm-toolkit/build-requirements.txt @@ -1,7 +1,7 @@ -setuptools == 41.4.0 +setuptools == 65.5.1 wheel == 0.38.1 scikit-build == 0.11.1 cmake == 3.21 From 37ce646890d5f2cc11914df187d4a340a6b1e140 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 24 Jan 2023 20:03:57 -0500 Subject: [PATCH 077/126] set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 93c16d67..3816e8b7 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.9.0 + 0.9.1 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 11736d9d..8f5e35a9 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.9.0", + version = "0.9.1", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index b1aab68a..d7d4c162 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.9.0" +__version__ = "0.9.1" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 607fdf5769bfddcc210671ec92d4fe6daa05b7bb Mon Sep 17 00:00:00 2001 From: karosc Date: Wed, 25 Jan 2023 09:20:05 -0500 Subject: [PATCH 078/126] update deprecated macos actions runner --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 94cc39be..0296cbfc 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -71,14 +71,14 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022, macos-10.15] + os: [windows-2022, macos-12] py: ["3.7", "3.8", "3.9", "3.10", "3.11"] include: - os: windows-2022 sys_pkgs: choco install swig activate: ./build-env/Scripts/activate - - os: macos-10.15 + - os: macos-12 sys_pkgs: brew install swig ninja activate: source ./build-env/bin/activate From 730429a1b82fd7f79a2c013c22ac00f783045ef9 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 23 Feb 2023 22:22:21 -0500 Subject: [PATCH 079/126] update OWA SWMM to v5.1.15 --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 7e7e6da7..c2c0f4f4 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 7e7e6da799e4c8f1fd51499cebe47f82f80c67f6 +Subproject commit c2c0f4f4563d69580ca302bc11c31bbdf02dbea6 From 604adc5d4154f20b9a4cee87d3491db1fcc78fc1 Mon Sep 17 00:00:00 2001 From: karosc Date: Thu, 23 Feb 2023 22:37:24 -0500 Subject: [PATCH 080/126] set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 3816e8b7..6cff50ff 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.9.1 + 0.10.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 8f5e35a9..513cd9e4 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.9.1", + version = "0.10.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index d7d4c162..507bfc18 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.9.1" +__version__ = "0.10.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 1a096d57b4a05f2450d189abc0ef0635fc4d13ef Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 28 Mar 2023 10:37:40 -0400 Subject: [PATCH 081/126] update OWA SWMM to v5.2.0 and set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- swmm-toolkit/src/swmm/toolkit/solver.i | 10 ++++++++++ swmm-toolkit/swmm-solver | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 6cff50ff..2a25d087 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.10.0 + 0.11.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 513cd9e4..f28aead4 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.10.0", + version = "0.11.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 507bfc18..b58d175e 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.10.0" +__version__ = "0.11.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index c9e19c96..53381c3b 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -219,6 +219,16 @@ %ignore swmm_getWarnings; %ignore swmm_IsOpenFlag; %ignore swmm_IsStartedFlag; +%ignore swmm_IsStartedFlag; + +%ignore swmm_getCount; +%ignore swmm_getName; +%ignore swmm_getIndex; +%ignore swmm_getValue; +%ignore swmm_setValue; +%ignore swmm_getSavedValue; +%ignore swmm_writeLine; +%ignore swmm_decodeDate; %include "swmm5.h" diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index c2c0f4f4..e8264729 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit c2c0f4f4563d69580ca302bc11c31bbdf02dbea6 +Subproject commit e826472962233b97698b1ad74b261791fd49e73d From 89a25305226c623e557990b4bfb8f619b328155f Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 28 Mar 2023 10:39:36 -0400 Subject: [PATCH 082/126] update OWA SWMM to v5.2.1 and set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- swmm-toolkit/swmm-solver | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 2a25d087..ae547157 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.11.0 + 0.12.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index f28aead4..a1e40ef6 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.11.0", + version = "0.12.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index b58d175e..7edcd507 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.11.0" +__version__ = "0.12.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index e8264729..1ea204b0 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit e826472962233b97698b1ad74b261791fd49e73d +Subproject commit 1ea204b00c50f9aa473c4b0450b097f03182a194 From 119989404c112b2794aec9b9035d0244c2385715 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 28 Mar 2023 10:47:59 -0400 Subject: [PATCH 083/126] update OWA SWMM to v5.2.2 and set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- swmm-toolkit/swmm-solver | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index ae547157..3c9dc938 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.12.0 + 0.13.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index a1e40ef6..7152551f 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.12.0", + version = "0.13.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 7edcd507..5a395c88 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.12.0" +__version__ = "0.13.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 1ea204b0..d74e6363 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 1ea204b00c50f9aa473c4b0450b097f03182a194 +Subproject commit d74e6363fd4c7bfcee64f9fafa83b34f5e3cb92d From 384ed3ff723e9fc55c245e64c08deb95d0df1418 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 28 Mar 2023 11:00:39 -0400 Subject: [PATCH 084/126] update OWA SWMM to v5.2.3 - add inlet api functions - set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 14 + swmm-toolkit/src/swmm/toolkit/solver.i | 4 +- swmm-toolkit/src/swmm/toolkit/solver_docs.i | 54 ++ swmm-toolkit/src/swmm/toolkit/solver_rename.i | 3 + swmm-toolkit/swmm-solver | 2 +- swmm-toolkit/tests/data/test_inlet_drains.inp | 502 ++++++++++++++++++ swmm-toolkit/tests/test_solver.py | 72 +++ 10 files changed, 652 insertions(+), 5 deletions(-) create mode 100644 swmm-toolkit/tests/data/test_inlet_drains.inp diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 3c9dc938..181f9ab7 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.13.0 + 0.14.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 7152551f..a2282930 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -88,7 +88,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.13.0", + version = "0.14.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 5a395c88..91df118a 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.13.0" +__version__ = "0.14.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index 8724e3b3..48a34d5d 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -739,3 +739,17 @@ class RainResult(Enum): TOTAL = 0 RAINFALL = 1 SNOWFALL = 2 + +class InletProperty(Enum): + NUM_INLETS = 0 + CLOG_FACTOR = 1 + FLOW_LIMIT = 2 + DEPRESSION_HEIGHT = 3 + DEPRESSION_WIDTH = 4 + + +class InletResult(Enum): + FLOW_FACTOR = 0 + FLOW_CAPTURE = 1 + BACK_FLOW = 2 + BLACK_FLOW_RATIO = 3 \ No newline at end of file diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index 53381c3b..2fc69d18 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -158,7 +158,9 @@ SM_LidLayerProperty, SM_LidUProperty, SM_LidUOptions, - SM_LidResult + SM_LidResult, + SM_InletProperty, + SM_InletResult } diff --git a/swmm-toolkit/src/swmm/toolkit/solver_docs.i b/swmm-toolkit/src/swmm/toolkit/solver_docs.i index e47d24be..d2f02a61 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_docs.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_docs.i @@ -1293,3 +1293,57 @@ total_precip: double The new total precipitation intensity. " ) swmm_setGagePrecip; + + +%feature("autodoc", +"Get a property value for the inlet of a specified link. + +Parameters +---------- +index: int + The index of a link with desired inlets +param: SM_InletProperty + The property type code (See :ref: SM_InletProperty) + +Returns +------- +value: double * + The value of the inlet's property +" +) swmm_getInletParam; + + +%feature("autodoc", +"Get a property value for the inlet of a specified link. + +Parameters +---------- +index: int + The index of a link with desired inlets +param: SM_InletProperty + The property type code (See :ref: SM_InletProperty) + +Returns +------- +value: double * + The new value of the inlet's property +" +) swmm_setInletParam; + + +%feature("autodoc", +"Get a result value for specified link. + +Parameters +---------- +index: int + The index of a link with desired inlets +type: SM_InletResult + The result type code (See :ref: SM_InletResult) + +Returns +------- +result: double * + The value of the inlet's result at the current simulation timestep +" +) swmm_getInletResult; diff --git a/swmm-toolkit/src/swmm/toolkit/solver_rename.i b/swmm-toolkit/src/swmm/toolkit/solver_rename.i index 29259e7f..2d72a89b 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_rename.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_rename.i @@ -68,6 +68,9 @@ %rename(link_set_target_setting) swmm_setLinkSetting; %rename(link_get_stats) swmm_getLinkStats; +%rename(inlet_get_parameter) swmm_getInletParam; +%rename(inlet_set_parameter) swmm_setInletParam; +%rename(inlet_get_result) swmm_getInletResult; %rename(pump_get_stats) swmm_getPumpStats; diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index d74e6363..2e5b21d5 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit d74e6363fd4c7bfcee64f9fafa83b34f5e3cb92d +Subproject commit 2e5b21d5ce268428765f78b4e1ce6601e64e3c39 diff --git a/swmm-toolkit/tests/data/test_inlet_drains.inp b/swmm-toolkit/tests/data/test_inlet_drains.inp new file mode 100644 index 00000000..a60d798a --- /dev/null +++ b/swmm-toolkit/tests/data/test_inlet_drains.inp @@ -0,0 +1,502 @@ +[TITLE] +;;Project Title/Notes +A dual drainage model with street inlets. +See Inlet_Drains_Model.txt for more details. + +[OPTIONS] +;;Option Value +FLOW_UNITS CFS +INFILTRATION HORTON +FLOW_ROUTING DYNWAVE +LINK_OFFSETS DEPTH +MIN_SLOPE 0 +ALLOW_PONDING NO +SKIP_STEADY_STATE NO + +START_DATE 01/01/2007 +START_TIME 00:00:00 +REPORT_START_DATE 01/01/2007 +REPORT_START_TIME 00:00:00 +END_DATE 01/01/2007 +END_TIME 06:00:00 +SWEEP_START 01/01 +SWEEP_END 12/31 +DRY_DAYS 0 +REPORT_STEP 00:01:00 +WET_STEP 00:01:00 +DRY_STEP 01:00:00 +ROUTING_STEP 0:00:15 +RULE_STEP 00:00:00 + +INERTIAL_DAMPING PARTIAL +NORMAL_FLOW_LIMITED SLOPE +FORCE_MAIN_EQUATION H-W +VARIABLE_STEP 0.75 +LENGTHENING_STEP 0 +MIN_SURFAREA 12.566 +MAX_TRIALS 8 +HEAD_TOLERANCE 0.005 +SYS_FLOW_TOL 5 +LAT_FLOW_TOL 5 +MINIMUM_STEP 0.5 +THREADS 1 + +[EVAPORATION] +;;Data Source Parameters +;;-------------- ---------------- +CONSTANT 0.0 +DRY_ONLY NO + +[RAINGAGES] +;;Name Format Interval SCF Source +;;-------------- --------- ------ ------ ---------- +RainGage INTENSITY 0:05 1.0 TIMESERIES 2-yr + +[SUBCATCHMENTS] +;;Name Rain Gage Outlet Area %Imperv Width %Slope CurbLen SnowPack +;;-------------- ---------------- ---------------- -------- -------- -------- -------- -------- ---------------- +S1 RainGage Aux1 4.55 56.8 1587 2 0 +S2 RainGage Aux4 4.74 63.0 1653 2 0 +S3 RainGage Aux3 3.74 39.5 1456 3.1 0 +S4 RainGage J7 6.79 49.9 2331 3.1 0 +S5 RainGage J10 4.79 87.7 1670 2 0 +S6 RainGage J11 1.98 95.0 690 2 0 +S7 RainGage J10 2.33 0.0 907 3.1 0 + +[SUBAREAS] +;;Subcatchment N-Imperv N-Perv S-Imperv S-Perv PctZero RouteTo PctRouted +;;-------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- +S1 0.015 0.24 0.06 0.3 25 OUTLET +S2 0.015 0.24 0.06 0.3 25 OUTLET +S3 0.015 0.24 0.06 0.3 25 OUTLET +S4 0.015 0.24 0.06 0.3 25 OUTLET +S5 0.015 0.24 0.06 0.3 25 OUTLET +S6 0.015 0.24 0.06 0.3 25 OUTLET +S7 0.015 0.24 0.06 0.3 25 OUTLET + +[INFILTRATION] +;;Subcatchment Param1 Param2 Param3 Param4 Param5 +;;-------------- ---------- ---------- ---------- ---------- ---------- +S1 4.5 0.2 6.5 7 0 +S2 4.5 0.2 6.5 7 0 +S3 4.5 0.2 6.5 7 0 +S4 4.5 0.2 6.5 7 0 +S5 4.5 0.2 6.5 7 0 +S6 4.5 0.2 6.5 7 0 +S7 4.5 0.2 6.5 7 0 + +[JUNCTIONS] +;;Name Elevation MaxDepth InitDepth SurDepth Aponded +;;-------------- ---------- ---------- ---------- ---------- ---------- +Aux1 4975 0 0 0 0 +Aux2 4973 0 0 0 0 +Aux3 4968.5 0 0 0 0 +Aux4 4971.8 0 0 0 0 +Aux5 4970.7 0 0 0 0 +Aux6 4969 0 0 0 0 +Aux7 4963 0 0 0 0 +J1 4969 4 0 0 0 +J10 4957.8 0 0 0 0 +J11 4957 0 0 0 0 +J2 4965 4 0 0 0 +J2a 4966.7 4 0 0 0 +J3 4973 0 0 0 0 +J4 4965 0 0 0 0 +J5 4965.8 0 0 0 0 +J6 4969 0 0 0 0 +J7 4963.5 0 0 0 0 +J8 4966.5 0 0 0 0 +J9 4964.8 0 0 0 0 + +[OUTFALLS] +;;Name Elevation Type Stage Data Gated Route To +;;-------------- ---------- ---------- ---------------- -------- ---------------- +O1 4956 FREE NO + +[CONDUITS] +;;Name From Node To Node Length Roughness InOffset OutOffset InitFlow MaxFlow +;;-------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- +Street1 Aux1 Aux2 377.31 0.016 0 0 0 0 +Street2 Aux2 Aux4 286.06 0.016 0 0 0 0 +Street3 Aux4 Aux5 239.41 0.016 0 0 0 0 +Street4 Aux5 Aux6 157.48 0.016 0 0 0 0 +Street5 Aux6 Aux7 526.0 0.016 0 0 0 0 +C3 J3 J4 109.0 0.016 0 6 0 0 +C4 J4 J5 133.0 0.05 6 4 0 0 +C5 J5 J6 207.0 0.05 4 0 0 0 +C6 J7 J6 140.0 0.05 8 0 0 0 +C7 J6 J8 95.0 0.016 0 0 0 0 +C8 J8 J9 166.0 0.05 0 0 0 0 +C9 J9 J10 320.0 0.05 0 6 0 0 +C10 J10 J11 145.0 0.05 6 6 0 0 +C11 J11 O1 89.0 0.016 0 0 0 0 +C_Aux3 Aux3 J3 444.75 0.05 6 0 0 0 +P1 J1 J5 185.39 0.016 0 0 0 0 +P2 J2a J2 157.48 0.016 0 0 0 0 +P3 J2 J11 529.22 0.016 0 0 0 0 +P4 Aux3 J4 567.19 0.016 0 0 0 0 +P5 J5 J4 125.98 0.016 0 0 0 0 +P6 J4 J7 360.39 0.016 0 0 0 0 +P7 J7 J10 507.76 0.016 0 0 0 0 +P8 J10 J11 144.50 0.016 0 0 0 0 + +[XSECTIONS] +;;Link Shape Geom1 Geom2 Geom3 Geom4 Barrels Culvert +;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ---------- +Street1 STREET FullStreet +Street2 STREET FullStreet +Street3 STREET FullStreet +Street4 STREET HalfStreet +Street5 STREET HalfStreet +C3 CIRCULAR 2.25 0 0 0 1 +C4 TRAPEZOIDAL 3 5 5 5 1 +C5 TRAPEZOIDAL 3 5 5 5 1 +C6 TRAPEZOIDAL 3 5 5 5 1 +C7 CIRCULAR 3.5 0 0 0 1 +C8 TRAPEZOIDAL 3 5 5 5 1 +C9 TRAPEZOIDAL 3 5 5 5 1 +C10 TRAPEZOIDAL 3 5 5 5 1 +C11 CIRCULAR 4.75 0 0 0 1 +C_Aux3 TRAPEZOIDAL 3 5 5 5 1 +P1 CIRCULAR 0.5 0 0 0 1 +P2 CIRCULAR 1.5 0 0 0 1 +P3 CIRCULAR 1.5 0 0 0 1 +P4 CIRCULAR 1.67 0 0 0 1 +P5 CIRCULAR 1.83 0 0 0 1 +P6 CIRCULAR 2 0 0 0 1 +P7 CIRCULAR 2 0 0 0 1 +P8 CIRCULAR 3.17 0 0 0 1 + +[STREETS] +;;Name Tcrown Hcurb Sx nRoad a W Sides Tback Sback nBack +;;-------------- -------- -------- -------- -------- -------- -------- -------- -------- -------- -------- +HalfStreet 20 0.5 4 0.016 0 0 1 20 4 0.016 +FullStreet 20 0.5 4 0.016 0 0 2 20 4 0.016 + +[INLETS] +;;Name Type Parameters: +;;-------------- ---------------- ----------- +ComboInlet GRATE 2 2 P_BAR-50 +ComboInlet CURB 2 0.5 HORIZONTAL + +[INLET_USAGE] +;;Conduit Inlet Node Number %Clogged Qmax aLocal wLocal Placement +;;-------------- ---------------- ---------------- --------- --------- --------- --------- --------- --------- --------- +Street1 ComboInlet J1 1 50 2.2 0.5 2 +Street3 ComboInlet J2a 1 0 0 0 0 +Street4 ComboInlet J2 1 0 0 0 0 +Street5 ComboInlet J11 2 0 0 0 0 + +[TIMESERIES] +;;Name Date Time Value +;;-------------- ---------- ---------- ---------- +2-yr 0:00 0.29 +2-yr 0:05 0.33 +2-yr 0:10 0.38 +2-yr 0:15 0.64 +2-yr 0:20 0.81 +2-yr 0:25 1.57 +2-yr 0:30 2.85 +2-yr 0:35 1.18 +2-yr 0:40 0.71 +2-yr 0:45 0.42 +2-yr 0:50 0.35 +2-yr 0:55 0.3 +2-yr 1:00 0.2 +2-yr 1:05 0.19 +2-yr 1:10 0.18 +2-yr 1:15 0.17 +2-yr 1:20 0.17 +2-yr 1:25 0.16 +2-yr 1:30 0.15 +2-yr 1:35 0.15 +2-yr 1:40 0.14 +2-yr 1:45 0.14 +2-yr 1:50 0.13 +2-yr 1:55 0.13 +; +10-yr 0:00 0.49 +10-yr 0:05 0.56 +10-yr 0:10 0.65 +10-yr 0:15 1.09 +10-yr 0:20 1.39 +10-yr 0:25 2.69 +10-yr 0:30 4.87 +10-yr 0:35 2.02 +10-yr 0:40 1.21 +10-yr 0:45 0.71 +10-yr 0:50 0.6 +10-yr 0:55 0.52 +10-yr 1:00 0.39 +10-yr 1:05 0.37 +10-yr 1:10 0.35 +10-yr 1:15 0.34 +10-yr 1:20 0.32 +10-yr 1:25 0.31 +10-yr 1:30 0.3 +10-yr 1:35 0.29 +10-yr 1:40 0.28 +10-yr 1:45 0.27 +10-yr 1:50 0.26 +10-yr 1:55 0.25 + +[REPORT] +;;Reporting Options +INPUT YES +SUBCATCHMENTS ALL +NODES ALL +LINKS ALL + +[TAGS] +Link Street1 Full_Street +Link Street2 Full_Street +Link Street3 Full_Street +Link Street4 Half_Street +Link Street5 Half_Street +Link C3 Culvert +Link C4 Swale +Link C5 Swale +Link C6 Swale +Link C7 Culvert +Link C8 Swale +Link C9 Swale +Link C10 Swale +Link C11 Culvert +Link C_Aux3 Swale + +[MAP] +DIMENSIONS -255.206 -70.199 1490.833 1514.231 +Units Feet + +[COORDINATES] +;;Node X-Coord Y-Coord +;;-------------- ------------------ ------------------ +Aux1 293.152 1161.023 +Aux2 653.046 1052.180 +Aux3 122.363 696.959 +Aux4 914.142 1058.025 +Aux5 1175.238 1120.376 +Aux6 1260.972 956.704 +Aux7 1381.777 514.399 +J1 647.200 1022.952 +J10 1254.058 640.029 +J11 1270.714 491.017 +J2 1218.105 950.859 +J2a 1159.651 1069.716 +J3 405.287 905.702 +J4 505.345 862.573 +J5 631.281 859.123 +J6 803.079 869.022 +J7 831.398 709.035 +J8 915.930 840.146 +J9 1072.918 867.749 +O1 1411.468 477.401 + +[VERTICES] +;;Link X-Coord Y-Coord +;;-------------- ------------------ ------------------ +Street1 382.860 1112.719 +Street1 514.703 1061.922 +Street2 806.976 1042.437 +Street3 1062.227 1091.149 +Street4 1210.311 1061.922 +Street5 1338.911 781.341 +Street5 1387.623 662.483 +Street5 1393.468 586.493 +C4 559.710 846.393 +C5 672.684 850.497 +C5 712.363 829.795 +C5 743.415 805.643 +C5 768.006 833.950 +C6 791.719 734.912 +C6 798.620 784.942 +C8 965.959 838.421 +C8 995.287 831.520 +C8 1038.415 850.497 +C9 1102.246 867.749 +C9 1131.573 852.222 +C9 1147.099 829.795 +C9 1162.626 809.094 +C9 1198.854 779.766 +C9 1219.556 757.339 +C9 1233.357 721.111 +C9 1238.532 715.936 +C9 1235.082 674.532 +C9 1247.158 646.930 +C_Aux3 163.003 699.992 +C_Aux3 208.620 726.287 +C_Aux3 239.673 793.567 +C_Aux3 251.749 876.374 +C_Aux3 291.427 912.602 +C_Aux3 355.257 929.854 +P3 1331.117 691.711 +P3 1329.168 590.390 +P4 275.901 572.749 +P4 472.567 824.620 +P7 886.602 800.468 + +[Polygons] +;;Subcatchment X-Coord Y-Coord +;;-------------- ------------------ ------------------ +S1 282.657 1334.810 +S1 111.700 1101.604 +S1 172.525 1062.743 +S1 231.660 1027.262 +S1 306.002 990.092 +S1 370.206 959.679 +S1 409.066 946.163 +S1 444.547 936.025 +S1 493.545 924.198 +S1 532.405 915.750 +S1 569.576 907.302 +S1 610.125 897.165 +S1 655.744 897.165 +S1 684.338 1318.700 +S1 651.043 1321.922 +S1 596.269 1332.662 +S1 551.160 1346.624 +S1 495.312 1367.030 +S1 455.573 1384.214 +S1 410.465 1409.991 +S1 386.836 1427.175 +S1 363.208 1442.211 +S2 678.967 1238.149 +S2 673.584 1152.903 +S2 655.744 897.165 +S2 758.808 893.786 +S2 817.943 895.475 +S2 880.458 898.855 +S2 921.007 905.613 +S2 978.453 920.819 +S2 1042.657 937.715 +S2 1103.482 959.679 +S2 1159.238 985.023 +S2 1225.131 1010.367 +S2 1109.646 1274.665 +S2 1052.723 1400.325 +S2 985.061 1370.252 +S2 924.916 1348.772 +S2 861.549 1331.588 +S2 815.367 1325.144 +S2 762.740 1319.774 +S2 719.780 1316.552 +S2 684.338 1317.626 +S3 109.199 1103.258 +S3 141.754 1081.555 +S3 190.586 1051.713 +S3 247.557 1019.158 +S3 304.528 989.317 +S3 354.716 964.900 +S3 398.123 949.980 +S3 490.166 922.509 +S3 477.743 883.275 +S3 501.993 816.065 +S3 556.059 778.895 +S3 488.476 679.210 +S3 422.582 729.897 +S3 282.348 557.560 +S3 179.734 633.927 +S3 153.962 651.561 +S3 107.843 693.610 +S3 71.218 742.443 +S3 48.159 785.849 +S3 31.881 837.394 +S3 29.168 886.226 +S3 31.881 933.702 +S3 38.664 967.613 +S3 50.872 1001.525 +S3 65.793 1035.436 +S3 87.496 1070.704 +S3 109.199 1103.258 +S4 282.348 559.250 +S4 420.893 729.897 +S4 488.476 680.899 +S4 556.828 779.067 +S4 501.213 814.335 +S4 479.468 885.000 +S4 491.718 922.851 +S4 616.511 898.434 +S4 668.056 897.078 +S4 783.355 895.722 +S4 815.909 898.434 +S4 857.959 899.791 +S4 890.595 897.165 +S4 968.316 915.750 +S4 1042.657 937.715 +S4 1074.759 849.857 +S4 1054.484 773.826 +S4 1020.692 702.864 +S4 963.247 623.454 +S4 689.536 256.816 +S5 1301.482 474.258 +S5 1271.677 445.380 +S5 1232.340 393.835 +S5 1241.835 384.340 +S5 1222.844 366.706 +S5 1233.696 355.854 +S5 1026.159 66.931 +S5 1008.525 56.079 +S5 708.750 275.824 +S5 1023.446 704.462 +S5 1150.644 618.812 +S5 1251.203 640.809 +S5 1328.193 519.824 +S6 1334.478 519.824 +S6 1306.266 488.956 +S6 1293.380 474.205 +S6 1232.340 393.835 +S6 1241.835 381.627 +S6 1222.844 365.350 +S6 1232.340 353.142 +S6 1027.516 65.574 +S6 1012.595 56.079 +S6 707.393 273.111 +S6 688.403 254.121 +S6 739.948 218.853 +S6 788.780 159.169 +S6 806.414 106.268 +S6 813.197 1.821 +S6 994.961 12.673 +S6 1228.270 27.594 +S6 1222.844 115.763 +S6 1228.270 167.308 +S6 1241.835 229.705 +S6 1255.399 254.121 +S6 1279.815 302.953 +S6 1309.657 354.498 +S6 1335.430 401.974 +S6 1359.846 448.093 +S6 1370.616 475.830 +S6 1381.615 491.542 +S7 1122.467 968.970 +S7 1174.012 987.282 +S7 1225.557 1005.594 +S7 1377.480 675.977 +S7 1391.044 642.065 +S7 1396.470 598.659 +S7 1381.615 491.542 +S7 1331.336 519.824 +S7 1249.632 640.809 +S7 1150.644 617.241 +S7 1020.733 704.462 +S7 1054.645 772.285 +S7 1076.796 848.212 +S7 1056.370 900.062 +S7 1040.658 937.772 + +[SYMBOLS] +;;Gage X-Coord Y-Coord +;;-------------- ------------------ ------------------ +RainGage -175.841 1212.778 + +[LABELS] +;;X-Coord Y-Coord Label +145.274 1129.896 "S1" "" "Arial" 14 0 0 +758.404 969.723 "S2" "" "Arial" 14 0 0 +247.369 666.226 "S3" "" "Arial" 14 0 0 +628.971 458.688 "S4" "" "Arial" 14 0 0 +952.552 257.845 "S5" "" "Arial" 14 0 0 +827.947 56.930 "S6" "" "Arial" 14 0 0 +1073.058 780.037 "S7" "" "Arial" 14 0 0 +1385.481 454.225 "Outfall" "" "Arial" 10 1 0 + diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 992fbe41..6fcec9a9 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -24,6 +24,9 @@ INPUT_FILE_EXAMPLE_3 = os.path.join(DATA_PATH, 'test_Example3.inp') REPORT_FILE_TEST_3 = os.path.join(DATA_PATH, 'temp_Example3.rpt') OUTPUT_FILE_TEST_3 = os.path.join(DATA_PATH, 'temp_Example3.out') +INPUT_FILE_INLET = os.path.join(DATA_PATH, 'test_inlet_drains.inp') +REPORT_FILE_INLET = os.path.join(DATA_PATH, 'temp_inlet_drains.rpt') +OUTPUT_FILE_INLET = os.path.join(DATA_PATH, 'temp_inlet_drains.out') INPUT_FILE_FAIL = os.path.join(DATA_PATH, 'temp_nodata.inp') @@ -86,6 +89,27 @@ def close(): request.addfinalizer(close) +@pytest.fixture() +def inlet_handle(request): + solver.swmm_open(INPUT_FILE_INLET, REPORT_FILE_INLET, OUTPUT_FILE_INLET) + + + def close(): + solver.swmm_close() + + request.addfinalizer(close) + +@pytest.fixture() +def run_inlet_sim(request): + solver.swmm_open(INPUT_FILE_INLET, REPORT_FILE_INLET, OUTPUT_FILE_INLET) + solver.swmm_start(0) + + def close(): + solver.swmm_end() + solver.swmm_close() + + request.addfinalizer(close) + @pytest.fixture() def run_pollut_sim(request): solver.swmm_open(INPUT_FILE_EXAMPLE_3, REPORT_FILE_TEST_3, OUTPUT_FILE_TEST_3) @@ -109,6 +133,19 @@ def test_step(handle): solver.swmm_end() solver.swmm_report() +def test_stride(handle): + solver.swmm_start(0) + steps = 0 + while True: + time = solver.swmm_stride(60 * 60) + steps+=1 + if time == 0: + break + + solver.swmm_end() + solver.swmm_report() + # advancing a 36 hour simulation hourly should yeild 36 steps + assert steps == 36 def test_version(handle): major, minor, patch = solver.swmm_version_info().split('.') @@ -761,3 +798,38 @@ def test_gage_precipitation(run_sim): assert total == 1.0 assert snowfall == 0.0 assert rainfall == 1.0 + + + +def test_inlet_error(inlet_handle): + with pytest.raises(Exception) as e: + index = solver.project_get_index(shared_enum.ObjectType.LINK,"C3") + clogged = solver.inlet_get_parameter(index, shared_enum.InletProperty.CLOG_FACTOR) + assert "Specified link is not assigned an inlet" in str(e.value) + + +def test_inlet_clogging(inlet_handle): + index = solver.project_get_index(shared_enum.ObjectType.LINK,"Street1") + + num_inlets = solver.inlet_get_parameter(index, shared_enum.InletProperty.NUM_INLETS) + assert num_inlets == 1 + + clogged = solver.inlet_get_parameter(index, shared_enum.InletProperty.CLOG_FACTOR) + assert clogged == 50 + + solver.inlet_set_parameter(index, shared_enum.InletProperty.CLOG_FACTOR,0) + clogged = solver.inlet_get_parameter(index, shared_enum.InletProperty.CLOG_FACTOR) + assert clogged == 0 + + flow_limit = solver.inlet_get_parameter(index, shared_enum.InletProperty.FLOW_LIMIT) + assert flow_limit == 2.2 + + solver.inlet_set_parameter(index, shared_enum.InletProperty.FLOW_LIMIT,5.5) + flow_limit = solver.inlet_get_parameter(index, shared_enum.InletProperty.FLOW_LIMIT) + assert flow_limit == 5.5 + + dep_height = solver.inlet_get_parameter(index, shared_enum.InletProperty.DEPRESSION_HEIGHT) + assert dep_height == 0.5 + + dep_width = solver.inlet_get_parameter(index, shared_enum.InletProperty.DEPRESSION_WIDTH) + assert dep_width == 2 \ No newline at end of file From 71803af94f2b395d0d21cae4109b4bc9b83ee163 Mon Sep 17 00:00:00 2001 From: karosc Date: Mon, 5 Jun 2023 20:07:23 -0400 Subject: [PATCH 085/126] allow user specified cmake args --- swmm-toolkit/setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index a2282930..212a184b 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -16,7 +16,7 @@ import platform import subprocess import pathlib - +import os from skbuild import setup from setuptools import Command @@ -63,8 +63,10 @@ def run(self): package_dir = {"swmm_toolkit":"lib", "swmm.toolkit": "src/swmm/toolkit"} +if os.environ.get('CMAKE_ARGS') is not None: + cmake_args = os.environ.get('CMAKE_ARGS').split() # Set Platform specific cmake args here -if platform_system == "Windows": +elif platform_system == "Windows": cmake_args = ["-GVisual Studio 17 2022","-Ax64"] elif platform_system == "Darwin": From dc666a631ce90f3f1c64461973db655356b3ed8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 00:08:54 +0000 Subject: [PATCH 086/126] Bump numpy from 1.21.6 to 1.22.0 in /swmm-toolkit Bumps [numpy](https://github.com/numpy/numpy) from 1.21.6 to 1.22.0. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.21.6...v1.22.0) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- swmm-toolkit/test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index f46c81c6..1d649ff1 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -3,5 +3,5 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" -numpy == 1.23.4; python_version >= "3.8" +numpy == 1.22.0; python_version >= "3.8" aenum == 3.1.11 From 6b9c4f8f5b0e5c945e67140d9fc6dfb15cbd2f61 Mon Sep 17 00:00:00 2001 From: karosc Date: Mon, 5 Jun 2023 20:11:16 -0400 Subject: [PATCH 087/126] set release version --- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 212a184b..c7613fac 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -90,7 +90,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.14.0", + version = "0.14.1", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 91df118a..7c7cf83e 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.14.0" +__version__ = "0.14.1" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 7d00e9d4892db55b4e5c6b46275523b47786def7 Mon Sep 17 00:00:00 2001 From: karosc Date: Mon, 5 Jun 2023 20:36:15 -0400 Subject: [PATCH 088/126] debug custom cmake args and set release version --- swmm-toolkit/setup.py | 7 ++++--- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index c7613fac..a4107512 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -63,8 +63,9 @@ def run(self): package_dir = {"swmm_toolkit":"lib", "swmm.toolkit": "src/swmm/toolkit"} -if os.environ.get('CMAKE_ARGS') is not None: - cmake_args = os.environ.get('CMAKE_ARGS').split() +if os.environ.get('SWMM_CMAKE_ARGS') is not None: + cmake_args = os.environ.get('SWMM_CMAKE_ARGS').split() + # Set Platform specific cmake args here elif platform_system == "Windows": cmake_args = ["-GVisual Studio 17 2022","-Ax64"] @@ -90,7 +91,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.14.1", + version = "0.14.2", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 7c7cf83e..fe53e08f 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.14.1" +__version__ = "0.14.2" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From cb80f5527d7e3eaa937e7a5f5f58a4efec76b47b Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 1 Sep 2023 16:25:41 -0400 Subject: [PATCH 089/126] add pyproject.toml --- swmm-toolkit/pyproject.toml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 swmm-toolkit/pyproject.toml diff --git a/swmm-toolkit/pyproject.toml b/swmm-toolkit/pyproject.toml new file mode 100644 index 00000000..bf989284 --- /dev/null +++ b/swmm-toolkit/pyproject.toml @@ -0,0 +1,9 @@ +[build-system] +requires = [ + "wheel>=0.38.1", + "setuptools>=42", + "scikit-build>=0.13", + "cmake>=3.21", + "swig==4.0.2", +] +build-backend = "setuptools.build_meta" \ No newline at end of file From a3776af59b0bc55bd7bbfba1ef937e03fbe45c78 Mon Sep 17 00:00:00 2001 From: ckaros Date: Sat, 2 Sep 2023 10:22:26 -0400 Subject: [PATCH 090/126] Add setup tools hack so `python -m build .` and `pip install .` just work --- swmm-toolkit/setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index a4107512..f29ad934 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -20,6 +20,13 @@ from skbuild import setup from setuptools import Command +# hack to trick setuptools until we transition to scikit-build-core +# without these libs, setuptools will fail to build sdist thinking the +# package is pure python and missing. +_HERE_ = os.path.abspath(os.path.dirname(__file__)) +os.mkdir(os.path.join(_HERE_, 'bin')) +os.mkdir(os.path.join(_HERE_, 'lib')) + # Determine platform platform_system = platform.system() @@ -88,7 +95,6 @@ def exclude_files(cmake_manifest): here = pathlib.Path(__file__).parent.resolve() long_description = (here / 'README.md').read_text(encoding='utf-8') - setup( name = "swmm-toolkit", version = "0.14.2", @@ -128,3 +134,8 @@ def exclude_files(cmake_manifest): "Development Status :: 5 - Production/Stable", ] ) + + +# clean up setuptools hack +os.rmdir(os.path.join(_HERE_, 'bin')) +os.rmdir(os.path.join(_HERE_, 'lib')) From 85bc57c277bf93c01dd748e1c95fb179906bf542 Mon Sep 17 00:00:00 2001 From: ckaros Date: Sat, 2 Sep 2023 13:48:33 -0400 Subject: [PATCH 091/126] set package dir depending on if cmake is run --- swmm-toolkit/setup.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index f29ad934..93670c96 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -19,14 +19,7 @@ import os from skbuild import setup from setuptools import Command - -# hack to trick setuptools until we transition to scikit-build-core -# without these libs, setuptools will fail to build sdist thinking the -# package is pure python and missing. -_HERE_ = os.path.abspath(os.path.dirname(__file__)) -os.mkdir(os.path.join(_HERE_, 'bin')) -os.mkdir(os.path.join(_HERE_, 'lib')) - +import sys # Determine platform platform_system = platform.system() @@ -63,11 +56,28 @@ def run(self): p.wait() -# Set up location of wheel libraries depending on build platform -if platform_system == "Windows": - package_dir = {"swmm_toolkit":"bin", "swmm.toolkit": "src/swmm/toolkit"} +# Set up location of wheel libraries depending on build platform and command +# commands that trigger cmake from skbuild.setuptools_wrap._should_run_cmake +commands_that_trigger_cmake = { + "build", + "build_ext", + "develop", + "install", + "install_lib", + "bdist", + "bdist_dumb", + "bdist_egg", + "bdist_rpm", + "bdist_wininst", + "bdist_wheel", + "test", + } +command = sys.argv[1] if len(sys.argv) > 1 else None +if command in commands_that_trigger_cmake: + swmm_toolkit_dir= "bin" if platform_system == "Windows" else "lib" else: - package_dir = {"swmm_toolkit":"lib", "swmm.toolkit": "src/swmm/toolkit"} + swmm_toolkit_dir= "swmm-solver" +package_dir = {"swmm_toolkit" : swmm_toolkit_dir, "swmm.toolkit": "src/swmm/toolkit"} if os.environ.get('SWMM_CMAKE_ARGS') is not None: @@ -133,9 +143,4 @@ def exclude_files(cmake_manifest): "Programming Language :: C", "Development Status :: 5 - Production/Stable", ] -) - - -# clean up setuptools hack -os.rmdir(os.path.join(_HERE_, 'bin')) -os.rmdir(os.path.join(_HERE_, 'lib')) +) \ No newline at end of file From 7be4f044297c74970cceeb76422c2dbe9d7c9931 Mon Sep 17 00:00:00 2001 From: ckaros Date: Sat, 2 Sep 2023 13:58:14 -0400 Subject: [PATCH 092/126] update numpy version for macos python 3.11 testing --- swmm-toolkit/test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index 1d649ff1..cbb4f032 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -3,5 +3,5 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" -numpy == 1.22.0; python_version >= "3.8" +numpy == 1.24.4; python_version >= "3.8" aenum == 3.1.11 From 0d50ac2b3bf1ec6b7dfe53f07eeb76b24fbd78af Mon Sep 17 00:00:00 2001 From: ckaros Date: Sat, 2 Sep 2023 22:59:48 -0400 Subject: [PATCH 093/126] add swmm_hotstart function and unit test --- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 25 ++++++++++++++++++- swmm-toolkit/src/swmm/toolkit/solver.i | 3 ++- swmm-toolkit/src/swmm/toolkit/solver_docs.i | 11 ++++++++ swmm-toolkit/src/swmm/toolkit/solver_rename.i | 3 ++- swmm-toolkit/swmm-solver | 2 +- swmm-toolkit/tests/test_solver.py | 20 ++++++++++++++- 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index 48a34d5d..336bfca5 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -741,6 +741,13 @@ class RainResult(Enum): SNOWFALL = 2 class InletProperty(Enum): + """Inlet Property enum class. + + :attr:`~NUM_INLETS` + :attr:`~CLOG_FACTOR` + :attr:`~FLOW_LIMIT` + :attr:`~DEPRESSION_HEIGHT` + :attr:`~DEPRESSION_WIDTH`""" NUM_INLETS = 0 CLOG_FACTOR = 1 FLOW_LIMIT = 2 @@ -749,7 +756,23 @@ class InletProperty(Enum): class InletResult(Enum): + """Inlet Result enum class. + + :attr:`~FLOW_FACTOR` + :attr:`~FLOW CAPTURE` + :attr:`~BACK_FLOW` + :attr:`~BLACK_FLOW_RATIO` + """ FLOW_FACTOR = 0 FLOW_CAPTURE = 1 BACK_FLOW = 2 - BLACK_FLOW_RATIO = 3 \ No newline at end of file + BLACK_FLOW_RATIO = 3 + +class HotstartFile(Enum): + """Hotstart File enum class. + + :attr:`~USE` + :attr:`~SAVE` + """ + USE = 0 + SAVE = 1 \ No newline at end of file diff --git a/swmm-toolkit/src/swmm/toolkit/solver.i b/swmm-toolkit/src/swmm/toolkit/solver.i index 2fc69d18..49257bc0 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver.i +++ b/swmm-toolkit/src/swmm/toolkit/solver.i @@ -160,7 +160,8 @@ SM_LidUOptions, SM_LidResult, SM_InletProperty, - SM_InletResult + SM_InletResult, + SM_HotStart } diff --git a/swmm-toolkit/src/swmm/toolkit/solver_docs.i b/swmm-toolkit/src/swmm/toolkit/solver_docs.i index d2f02a61..5a440e8b 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_docs.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_docs.i @@ -377,6 +377,17 @@ patch: char ** " ) swmm_getVersionInfo; +%feature("autodoc", +"Load or save a hotstart file into or out of a running simulation. + +Parameters +---------- +operation: SM_HotStart + The hotstart operation to use (i.e. save or load) +hsfile: str + The path to the hotstart file to either save or load +" +) swmm_hotstart; %feature("autodoc", "Finds the index of an object given its ID. diff --git a/swmm-toolkit/src/swmm/toolkit/solver_rename.i b/swmm-toolkit/src/swmm/toolkit/solver_rename.i index 2d72a89b..14db8184 100644 --- a/swmm-toolkit/src/swmm/toolkit/solver_rename.i +++ b/swmm-toolkit/src/swmm/toolkit/solver_rename.i @@ -105,4 +105,5 @@ %rename(swmm_version_info) swmm_getSemVersion; -%rename(swmm_build_id) swmm_getBuildId; \ No newline at end of file +%rename(swmm_build_id) swmm_getBuildId; +%rename(swmm_hotstart) swmm_hotstart; \ No newline at end of file diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 2e5b21d5..c760dbf5 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 2e5b21d5ce268428765f78b4e1ce6601e64e3c39 +Subproject commit c760dbf578f323bbfeb675ebed6635558280121d diff --git a/swmm-toolkit/tests/test_solver.py b/swmm-toolkit/tests/test_solver.py index 6fcec9a9..766089e4 100644 --- a/swmm-toolkit/tests/test_solver.py +++ b/swmm-toolkit/tests/test_solver.py @@ -832,4 +832,22 @@ def test_inlet_clogging(inlet_handle): assert dep_height == 0.5 dep_width = solver.inlet_get_parameter(index, shared_enum.InletProperty.DEPRESSION_WIDTH) - assert dep_width == 2 \ No newline at end of file + assert dep_width == 2 + +def test_hotstart(run_inlet_sim): + for i in range(0, 100): + solver.swmm_step() + + # save hotstart and pull out a node depth + solver.swmm_hotstart(shared_enum.HotstartFile.SAVE,'HS_FILE.hs') + prev_depth = solver.node_get_result(0, shared_enum.NodeResult.DEPTH) + solver.swmm_end() + solver.swmm_close() + + # restart sim using hotstart file and check that node depth is the same + solver.swmm_open(INPUT_FILE_INLET, REPORT_FILE_INLET, OUTPUT_FILE_INLET) + solver.swmm_hotstart(shared_enum.HotstartFile.USE,'HS_FILE.hs') + solver.swmm_start(0) + new_depth = solver.node_get_result(0, shared_enum.NodeResult.DEPTH) + assert prev_depth > 0 + assert prev_depth == pytest.approx(new_depth, 0.1) From 20c2f630aa0dc07b51524835b5f851fea914550a Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 08:50:26 -0400 Subject: [PATCH 094/126] update swmm_solver to OWA_v5.2.4 tag --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index c760dbf5..27dc6990 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit c760dbf578f323bbfeb675ebed6635558280121d +Subproject commit 27dc6990cda8bce21f6c16ddae631b37e7510ffc From a44149278045d1e6c01f53b917459a0921ffceae Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 09:03:38 -0400 Subject: [PATCH 095/126] init cross compile workflow --- .github/workflows/build_wheel.yml | 85 ++++++++++++++++++++ .github/workflows/conda-test.yml | 50 ------------ .github/workflows/python-package.yml | 116 --------------------------- .github/workflows/unit_test.yml | 60 ++++++++++++++ swmm-toolkit/CMakeLists.txt | 15 +--- swmm-toolkit/extern/openmp.cmake | 48 ----------- 6 files changed, 149 insertions(+), 225 deletions(-) create mode 100644 .github/workflows/build_wheel.yml delete mode 100644 .github/workflows/conda-test.yml delete mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/unit_test.yml delete mode 100644 swmm-toolkit/extern/openmp.cmake diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml new file mode 100644 index 00000000..ee6f5908 --- /dev/null +++ b/.github/workflows/build_wheel.yml @@ -0,0 +1,85 @@ +name: Build Wheels + +# Cross compile wheels only on main branch and tags +on: + pull_request: + branches: + - main + push: + branches: + - main + tags: + - v* + +jobs: + build_nrtest_plugin: + name: Build nrtest-swmm plugin + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./nrtest-swmm + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Build wheel + run: | + pip install wheel + python setup.py bdist_wheel + - uses: actions/upload-artifact@v2 + with: + path: nrtest-swmm/dist/*.whl + + + + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-2022, macos-12] + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: true + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.15.0 + with: + package-dir: ./swmm-toolkit + env: + CIBEW_TEST_COMMAND: "pytest ./swmm-toolkit/tests" + CIBW_BEFORE_TEST: pip install -r ./swmm-toolkit/test-requirements.txt + # mac needs ninja to build + CIBW_BEFORE_BUILD_MACOS: brew install ninja + # configure cibuildwheel to build native archs ('auto'), and some emulated ones + CIBW_ARCHS_LINUX: x86_64 aarch64 + CIBW_ARCHS_WINDOWS: AMD64 + CIBW_ARCHS_MACOS: x86_64 arm64 + # only build current supported python: https://devguide.python.org/versions/ + # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs + CIBW_SKIP: cp36-* cp37 cp312-* pp* *-musllinux* + # Will avoid testing on emulated architectures + # Skip trying to test arm64 builds on Intel Macs + CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/conda-test.yml b/.github/workflows/conda-test.yml deleted file mode 100644 index 6890163a..00000000 --- a/.github/workflows/conda-test.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Conda Tests - -on: - workflow_run: - workflows: ["Build Wheels"] - types: - - completed - - -jobs: - test_conda_build: - name: Conda wheel test mac - runs-on: macos-latest - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - channels: conda-forge - # Python 3.9 does not support all libs we need in swmm-python - python-version: 3.8 - - - name: Install required system packages - run: brew install swig ninja - - - name: Install requirements - run: | - cd swmm-toolkit - conda create -n test-env pip - conda activate test-env - pip install -r build-requirements.txt - python setup.py bdist_wheel - conda deactivate - - - name: Test wheel - run: | - cd swmm-toolkit - conda activate test-env - pip install -r test-requirements.txt - python -m pip install --no-index --find-links=./dist swmm_toolkit - pytest - conda deactivate diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 0296cbfc..00000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Build Wheels - -on: [push, pull_request] - -env: - DOCKER_IMAGE: dockcross/manylinux2014-x64:latest - - -jobs: - build_nrtest_plugin: - name: Build nrtest-swmm plugin - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./nrtest-swmm - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Build wheel - run: | - pip install wheel - python setup.py bdist_wheel - - uses: actions/upload-artifact@v2 - with: - path: nrtest-swmm/dist/*.whl - - - - build_linux_wheels: - name: Build wheels on linux - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install - run: | - docker pull $DOCKER_IMAGE - docker run --rm $DOCKER_IMAGE > ./dockcross - chmod +x ./dockcross - - - name: Script - run: ./dockcross swmm-toolkit/tools/build-wheels.sh - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - path: ./dist/*.manylinux2014_x86_64.whl - - - - build_win-mac_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - defaults: - run: - working-directory: ./swmm-toolkit - - strategy: - fail-fast: false - matrix: - os: [windows-2022, macos-12] - py: ["3.7", "3.8", "3.9", "3.10", "3.11"] - include: - - os: windows-2022 - sys_pkgs: choco install swig - activate: ./build-env/Scripts/activate - - - os: macos-12 - sys_pkgs: brew install swig ninja - activate: source ./build-env/bin/activate - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.py }} - - - name: Install required system packages - run: ${{matrix.sys_pkgs}} - - - name: Build wheel in virtual env - run: | - python -m venv --clear ./build-env - ${{matrix.activate}} - python -m pip install -r build-requirements.txt - python setup.py bdist_wheel - deactivate - - - name: Test wheel - run: | - pip install -r test-requirements.txt - pip install --no-index --find-links=./dist swmm_toolkit - pytest - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - path: swmm-toolkit/dist/*.whl diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml new file mode 100644 index 00000000..1e81f8b5 --- /dev/null +++ b/.github/workflows/unit_test.yml @@ -0,0 +1,60 @@ +name: Unit Test + +on: + push: + branches-ignore: + - 'main' + tags-ignore: + - v* + pull_request: + branches-ignore: + - 'main' + +jobs: + build_and_test: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: ./swmm-toolkit + + strategy: + fail-fast: false + matrix: + os: [windows-2022, macos-12, ubuntu-latest] + include: + - os: windows-2022 + sys_pkgs: choco install swig + activate: ./build-env/Scripts/activate + + - os: macos-12 + sys_pkgs: brew install swig ninja + activate: source ./build-env/bin/activate + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install required system packages + run: ${{matrix.sys_pkgs}} + + - name: Build wheel in virtual env + run: | + python -m venv --clear ./build-env + ${{matrix.activate}} + python -m pip install -r build-requirements.txt + python setup.py bdist_wheel + deactivate + + - name: Test wheel + run: | + pip install -r test-requirements.txt + pip install --no-index --find-links=./dist swmm_toolkit + pytest \ No newline at end of file diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 181f9ab7..fdacb2d0 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -36,17 +36,10 @@ cmake_policy(SET CMP0078 NEW) cmake_policy(SET CMP0086 NEW) include(${SWIG_USE_FILE}) - -# If wheel build on Apple fetch and build OpenMP Library -if (APPLE) - include(./extern/openmp.cmake) -else() - find_package(OpenMP - OPTIONAL_COMPONENTS - C - ) -endif() - +find_package(OpenMP + OPTIONAL_COMPONENTS + C +) # Add project subdirectories add_subdirectory(swmm-solver) diff --git a/swmm-toolkit/extern/openmp.cmake b/swmm-toolkit/extern/openmp.cmake deleted file mode 100644 index dbe2a09d..00000000 --- a/swmm-toolkit/extern/openmp.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -# CMakeLists.txt - CMake configuration file for OpenMP Library on Darwin -# -# Created: Mar 17, 2021 -# Updated: May 19, 2021 -# -# Author: Michael E. Tryby -# US EPA ORD/CESER -# -# Note: -# Need to build libomp for binary compatibility with Python. -# -# OpenMP library build fails for Xcode generator. Use Ninja or Unix Makefiles -# instead. -# - -################################################################################ -##################### CMAKELISTS FOR OPENMP LIBRARY ###################### -################################################################################ - -include(FetchContent) - - -FetchContent_Declare(OpenMP - URL - https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/openmp-11.1.0.src.tar.xz - URL_HASH - SHA256=d187483b75b39acb3ff8ea1b7d98524d95322e3cb148842957e9b0fbb866052e -) - -set(OPENMP_STANDALONE_BUILD TRUE) -set(LIBOMP_INSTALL_ALIASES OFF) - -FetchContent_MakeAvailable(OpenMP) -set(OpenMP_AVAILABLE TRUE) - - -target_link_directories(omp - PUBLIC - $ - $ -) - -install(TARGETS omp - LIBRARY - DESTINATION - "${LIBRARY_DIST}" -) From 856b4d8668d8af4150369f8a8e7dad1f3fd56980 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 09:08:04 -0400 Subject: [PATCH 096/126] debug unit test workflow --- .github/workflows/unit_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 1e81f8b5..bc3c70b7 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -30,6 +30,9 @@ jobs: - os: macos-12 sys_pkgs: brew install swig ninja activate: source ./build-env/bin/activate + + - os: ubuntu-latest + activate: source ./build-env/bin/activate steps: - name: Checkout repo From 1b76ba62f3f37a3792b2d623f25ed736ff0ef000 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 09:15:55 -0400 Subject: [PATCH 097/126] add workflow dispatch event to build_wheel --- .github/workflows/build_wheel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index ee6f5908..0f03ab55 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -10,6 +10,7 @@ on: - main tags: - v* + workflow_dispatch: jobs: build_nrtest_plugin: From bff9739431f430edb09b96f69f48d73f134c1a84 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 09:22:19 -0400 Subject: [PATCH 098/126] update unit test workflow name --- .github/workflows/unit_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index bc3c70b7..82f68ff2 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -12,7 +12,7 @@ on: jobs: build_and_test: - name: Build wheels on ${{ matrix.os }} + name: Build and test on ${{ matrix.os }} runs-on: ${{ matrix.os }} defaults: run: From ca79409f60d7d484734819f03120fa6893f097c4 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 09:28:11 -0400 Subject: [PATCH 099/126] fix build wheel workflow trigger --- .github/workflows/build_wheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 0f03ab55..54754c75 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -4,10 +4,10 @@ name: Build Wheels on: pull_request: branches: - - main + - master push: branches: - - main + - master tags: - v* workflow_dispatch: From 1899d720a95572f8510fbbb00ec90f75e2cd7de7 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 10:16:37 -0400 Subject: [PATCH 100/126] set release version --- .github/workflows/build_wheel.yml | 4 ++-- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 54754c75..b3e6462c 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -27,7 +27,7 @@ jobs: submodules: true - name: Install Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.7 @@ -35,7 +35,7 @@ jobs: run: | pip install wheel python setup.py bdist_wheel - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: path: nrtest-swmm/dist/*.whl diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index fdacb2d0..0f3f608b 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.14.0 + 0.15.0 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 93670c96..e9c96e6f 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -107,7 +107,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.14.2", + version = "0.15.0", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index fe53e08f..444027cc 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.14.2" +__version__ = "0.15.0" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 2bcb9b0af14f07940b0079d6d07f5cf51a3f1a04 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 10:21:59 -0400 Subject: [PATCH 101/126] debug build wheel workflow --- .github/workflows/build_wheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index b3e6462c..e61028ca 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -66,7 +66,7 @@ jobs: with: package-dir: ./swmm-toolkit env: - CIBEW_TEST_COMMAND: "pytest ./swmm-toolkit/tests" + CIBW_TEST_COMMAND: "pytest ./swmm-toolkit/tests" CIBW_BEFORE_TEST: pip install -r ./swmm-toolkit/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja @@ -76,7 +76,7 @@ jobs: CIBW_ARCHS_MACOS: x86_64 arm64 # only build current supported python: https://devguide.python.org/versions/ # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs - CIBW_SKIP: cp36-* cp37 cp312-* pp* *-musllinux* + CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* # Will avoid testing on emulated architectures # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" From 0aafcbf5c9321cc6429b1fafbd4731993d0c96df Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 10:25:56 -0400 Subject: [PATCH 102/126] debug build wheel workflow --- .github/workflows/build_wheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index e61028ca..ec43ea50 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -66,8 +66,8 @@ jobs: with: package-dir: ./swmm-toolkit env: - CIBW_TEST_COMMAND: "pytest ./swmm-toolkit/tests" - CIBW_BEFORE_TEST: pip install -r ./swmm-toolkit/test-requirements.txt + CIBW_TEST_COMMAND: "pytest {package}/tests" + CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja # configure cibuildwheel to build native archs ('auto'), and some emulated ones From 7527636e0b55e05259be3e68c3b6861824f87a14 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 10:52:20 -0400 Subject: [PATCH 103/126] attempt to parallelize build wheel --- .github/workflows/build_wheel.yml | 47 ++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index ec43ea50..178e314a 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -42,12 +42,51 @@ jobs: build_wheels: - name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: true matrix: os: [ubuntu-latest, windows-2022, macos-12] + pyver: [cp38, cp39, cp310, cp311] + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: true + + - name: Build wheels + uses: pypa/cibuildwheel@v2.15.0 + with: + package-dir: ./swmm-toolkit + env: + CIBW_TEST_COMMAND: "pytest {package}/tests" + CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt + # mac needs ninja to build + CIBW_BEFORE_BUILD_MACOS: brew install ninja + # configure cibuildwheel to build native archs ('auto'), and some emulated ones + CIBW_ARCHS_LINUX: x86_64 + CIBW_ARCHS_WINDOWS: AMD64 + CIBW_ARCHS_MACOS: x86_64 + # only build current supported python: https://devguide.python.org/versions/ + # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs + CIBW_BUILD: ${{matrix.pyver}}-* + CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* + # Will avoid testing on emulated architectures + # Skip trying to test arm64 builds on Intel Macs + CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + + build_cross_wheels: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest,macos-12] + pyver: [cp37, cp38, cp39, cp310, cp311] steps: - name: Checkout repo @@ -71,11 +110,11 @@ jobs: # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja # configure cibuildwheel to build native archs ('auto'), and some emulated ones - CIBW_ARCHS_LINUX: x86_64 aarch64 - CIBW_ARCHS_WINDOWS: AMD64 - CIBW_ARCHS_MACOS: x86_64 arm64 + CIBW_ARCHS_LINUX: aarch64 + CIBW_ARCHS_MACOS: arm64 # only build current supported python: https://devguide.python.org/versions/ # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs + CIBW_BUILD: ${{matrix.pyver}}-* CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* # Will avoid testing on emulated architectures # Skip trying to test arm64 builds on Intel Macs From a352ade16b1458242c03da8148c9551fe883cab6 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 5 Sep 2023 10:57:54 -0400 Subject: [PATCH 104/126] debug new workflows --- .github/workflows/build_wheel.yml | 9 ++------- .github/workflows/unit_test.yml | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 178e314a..532a87da 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -86,7 +86,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest,macos-12] - pyver: [cp37, cp38, cp39, cp310, cp311] + pyver: [cp38, cp39, cp310, cp311] steps: - name: Checkout repo @@ -104,9 +104,7 @@ jobs: uses: pypa/cibuildwheel@v2.15.0 with: package-dir: ./swmm-toolkit - env: - CIBW_TEST_COMMAND: "pytest {package}/tests" - CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt + env: # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja # configure cibuildwheel to build native archs ('auto'), and some emulated ones @@ -116,9 +114,6 @@ jobs: # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs CIBW_BUILD: ${{matrix.pyver}}-* CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* - # Will avoid testing on emulated architectures - # Skip trying to test arm64 builds on Intel Macs - CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 82f68ff2..c496033f 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -3,12 +3,12 @@ name: Unit Test on: push: branches-ignore: - - 'main' + - 'master' tags-ignore: - v* pull_request: branches-ignore: - - 'main' + - 'master' jobs: build_and_test: From a1372a405db08c20ff10c5dfc236f0adbdbe03ba Mon Sep 17 00:00:00 2001 From: ckaros Date: Sun, 10 Sep 2023 00:13:34 -0400 Subject: [PATCH 105/126] restore building openmp from source on apple --- .github/workflows/build_wheel.yml | 20 +++++----- swmm-toolkit/CMakeLists.txt | 14 +++++-- swmm-toolkit/extern/openmp.cmake | 64 +++++++++++++++++++++++++++++++ swmm-toolkit/swmm-solver | 2 +- 4 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 swmm-toolkit/extern/openmp.cmake diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 532a87da..38f970f7 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -3,12 +3,12 @@ name: Build Wheels # Cross compile wheels only on main branch and tags on: pull_request: - branches: - - master + branches: + - master push: - branches: + branches: - master - tags: + tags: - v* workflow_dispatch: @@ -44,7 +44,7 @@ jobs: build_wheels: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-latest, windows-2022, macos-12] pyver: [cp38, cp39, cp310, cp311] @@ -59,15 +59,15 @@ jobs: uses: pypa/cibuildwheel@v2.15.0 with: package-dir: ./swmm-toolkit - env: + env: CIBW_TEST_COMMAND: "pytest {package}/tests" CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 - CIBW_ARCHS_WINDOWS: AMD64 - CIBW_ARCHS_MACOS: x86_64 + CIBW_ARCHS_WINDOWS: AMD64 + CIBW_ARCHS_MACOS: x86_64 # only build current supported python: https://devguide.python.org/versions/ # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs CIBW_BUILD: ${{matrix.pyver}}-* @@ -75,6 +75,7 @@ jobs: # Will avoid testing on emulated architectures # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" + CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v3 with: @@ -83,7 +84,7 @@ jobs: build_cross_wheels: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-latest,macos-12] pyver: [cp38, cp39, cp310, cp311] @@ -114,6 +115,7 @@ jobs: # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs CIBW_BUILD: ${{matrix.pyver}}-* CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* + CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v3 with: diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 0f3f608b..048b0eee 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -36,10 +36,16 @@ cmake_policy(SET CMP0078 NEW) cmake_policy(SET CMP0086 NEW) include(${SWIG_USE_FILE}) -find_package(OpenMP - OPTIONAL_COMPONENTS - C -) +# If wheel build on Apple fetch and build OpenMP Library +if (APPLE) + include(./extern/openmp.cmake) +else() + find_package(OpenMP + REQUIRED + OPTIONAL_COMPONENTS + C + ) +endif() # Add project subdirectories add_subdirectory(swmm-solver) diff --git a/swmm-toolkit/extern/openmp.cmake b/swmm-toolkit/extern/openmp.cmake new file mode 100644 index 00000000..95d64eaf --- /dev/null +++ b/swmm-toolkit/extern/openmp.cmake @@ -0,0 +1,64 @@ +# +# CMakeLists.txt - CMake configuration file for OpenMP Library on Darwin +# +# Created: Mar 17, 2021 +# Updated: May 19, 2021 +# +# Author: Michael E. Tryby +# US EPA ORD/CESER +# +# Note: +# Need to build libomp for binary compatibility with Python. +# +# OpenMP library build fails for Xcode generator. Use Ninja or Unix Makefiles +# instead. +# + +################################################################################ +##################### CMAKELISTS FOR OPENMP LIBRARY ###################### +################################################################################ + +include(FetchContent) + + +FetchContent_Declare(OpenMP + URL + https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/openmp-12.0.1.src.tar.xz + URL_HASH + SHA256=60fe79440eaa9ebf583a6ea7f81501310388c02754dbe7dc210776014d06b091 +) + +set(OPENMP_STANDALONE_BUILD TRUE) +set(LIBOMP_INSTALL_ALIASES OFF) + +FetchContent_MakeAvailable(OpenMP) +set(OpenMP_AVAILABLE TRUE) + + +target_link_directories(omp + PUBLIC + $ + $ +) + +# install(TARGETS omp +# LIBRARY +# DESTINATION +# "${LIBRARY_DIST}" +# ) + +if(CMAKE_C_COMPILER_ID MATCHES "Clang\$") + set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src") + set(OpenMP_C_LIB_NAMES "omp") + set(OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src/libomp.dylib") +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$") + set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src") + set(OpenMP_CXX_LIB_NAMES "omp") + set(OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src/libomp.dylib") +endif() + +# Save the bin directory for later use with +# ci/cd build scripts +file(WRITE _skbuild/bindir ${CMAKE_BINARY_DIR}) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index 27dc6990..f08343db 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit 27dc6990cda8bce21f6c16ddae631b37e7510ffc +Subproject commit f08343dbd7e2879d93c2e944c67cefa0e0c2d81c From 8b45bf44442dd3455d01283323360a183094077b Mon Sep 17 00:00:00 2001 From: ckaros Date: Mon, 11 Sep 2023 10:07:47 -0400 Subject: [PATCH 106/126] update submodule to support OpenMP linkage on MacOS --- swmm-toolkit/swmm-solver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/swmm-solver b/swmm-toolkit/swmm-solver index f08343db..459db1d4 160000 --- a/swmm-toolkit/swmm-solver +++ b/swmm-toolkit/swmm-solver @@ -1 +1 @@ -Subproject commit f08343dbd7e2879d93c2e944c67cefa0e0c2d81c +Subproject commit 459db1d4dfc61ff994ae01f92eae64e378e08915 From 691e9e9ca6a9d75e64f74cb0806351000ecf9808 Mon Sep 17 00:00:00 2001 From: ckaros Date: Mon, 11 Sep 2023 15:44:17 -0400 Subject: [PATCH 107/126] cleanup openmp.cmake --- swmm-toolkit/extern/openmp.cmake | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/swmm-toolkit/extern/openmp.cmake b/swmm-toolkit/extern/openmp.cmake index 95d64eaf..baf4635f 100644 --- a/swmm-toolkit/extern/openmp.cmake +++ b/swmm-toolkit/extern/openmp.cmake @@ -41,11 +41,11 @@ target_link_directories(omp $ ) -# install(TARGETS omp -# LIBRARY -# DESTINATION -# "${LIBRARY_DIST}" -# ) +install(TARGETS omp + LIBRARY + DESTINATION + "${LIBRARY_DIST}" +) if(CMAKE_C_COMPILER_ID MATCHES "Clang\$") set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src") @@ -57,8 +57,4 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$") set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src") set(OpenMP_CXX_LIB_NAMES "omp") set(OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src/libomp.dylib") -endif() - -# Save the bin directory for later use with -# ci/cd build scripts -file(WRITE _skbuild/bindir ${CMAKE_BINARY_DIR}) +endif() \ No newline at end of file From 3c5a2ec1fedecac4cf831bb7d0740b44124e5e4d Mon Sep 17 00:00:00 2001 From: ckaros Date: Tue, 12 Sep 2023 21:10:01 -0400 Subject: [PATCH 108/126] add THREADS to SimSetting enum --- swmm-toolkit/src/swmm/toolkit/shared_enum.py | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/src/swmm/toolkit/shared_enum.py b/swmm-toolkit/src/swmm/toolkit/shared_enum.py index 336bfca5..f787b8eb 100644 --- a/swmm-toolkit/src/swmm/toolkit/shared_enum.py +++ b/swmm-toolkit/src/swmm/toolkit/shared_enum.py @@ -403,6 +403,7 @@ class SimSetting(Enum): HEAD_TOLERANCE = 11 SYSTEM_FLOW_TOLERANCE = 12 LATERAL_FLOW_TOLERANCE = 13 + THREADS = 14 class NodeProperty(Enum): From 2a2898a0d33ca35cf1f1466c8a2654769c7c294f Mon Sep 17 00:00:00 2001 From: ckaros Date: Tue, 12 Sep 2023 21:46:39 -0400 Subject: [PATCH 109/126] include llvm-openmp apche license with distribution --- swmm-toolkit/extern/license-llvm-openmp.txt | 361 ++++++++++++++++++++ swmm-toolkit/extern/openmp.cmake | 3 + swmm-toolkit/setup.py | 7 +- 3 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 swmm-toolkit/extern/license-llvm-openmp.txt diff --git a/swmm-toolkit/extern/license-llvm-openmp.txt b/swmm-toolkit/extern/license-llvm-openmp.txt new file mode 100644 index 00000000..99075663 --- /dev/null +++ b/swmm-toolkit/extern/license-llvm-openmp.txt @@ -0,0 +1,361 @@ +============================================================================== +The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + +============================================================================== +Software from third parties included in the LLVM Project: +============================================================================== +The LLVM Project contains third party software which is under different license +terms. All such code will be identified clearly using at least one of two +mechanisms: +1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or +2) It will contain specific license and restriction terms at the top of every + file. + +============================================================================== +Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): +============================================================================== + +The software contained in this directory tree is dual licensed under both the +University of Illinois "BSD-Like" license and the MIT license. As a user of +this code you may choose to use it under either license. As a contributor, +you agree to allow your code to be used under both. The full text of the +relevant licenses is included below. + +In addition, a license agreement from the copyright/patent holders of the +software contained in this directory tree is included below. + +============================================================================== + +University of Illinois/NCSA +Open Source License + +Copyright (c) 1997-2019 Intel Corporation + +All rights reserved. + +Developed by: + OpenMP Runtime Team + Intel Corporation + http://www.openmprtl.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of Intel Corporation OpenMP Runtime Team nor the + names of its contributors may be used to endorse or promote products + derived from this Software without specific prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== + +Copyright (c) 1997-2019 Intel Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +============================================================================== + +Intel Corporation + +Software Grant License Agreement ("Agreement") + +Except for the license granted herein to you, Intel Corporation ("Intel") reserves +all right, title, and interest in and to the Software (defined below). + +Definition + +"Software" means the code and documentation as well as any original work of +authorship, including any modifications or additions to an existing work, that +is intentionally submitted by Intel to llvm.org (http://llvm.org) ("LLVM") for +inclusion in, or documentation of, any of the products owned or managed by LLVM +(the "Work"). For the purposes of this definition, "submitted" means any form of +electronic, verbal, or written communication sent to LLVM or its +representatives, including but not limited to communication on electronic +mailing lists, source code control systems, and issue tracking systems that are +managed by, or on behalf of, LLVM for the purpose of discussing and improving +the Work, but excluding communication that is conspicuously marked otherwise. + +1. Grant of Copyright License. Subject to the terms and conditions of this + Agreement, Intel hereby grants to you and to recipients of the Software + distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable copyright license to reproduce, prepare derivative + works of, publicly display, publicly perform, sublicense, and distribute the + Software and such derivative works. + +2. Grant of Patent License. Subject to the terms and conditions of this + Agreement, Intel hereby grants you and to recipients of the Software + distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable (except as stated in this section) patent license + to make, have made, use, offer to sell, sell, import, and otherwise transfer + the Work, where such license applies only to those patent claims licensable + by Intel that are necessarily infringed by Intel's Software alone or by + combination of the Software with the Work to which such Software was + submitted. If any entity institutes patent litigation against Intel or any + other entity (including a cross-claim or counterclaim in a lawsuit) alleging + that Intel's Software, or the Work to which Intel has contributed constitutes + direct or contributory patent infringement, then any patent licenses granted + to that entity under this Agreement for the Software or Work shall terminate + as of the date such litigation is filed. + +Unless required by applicable law or agreed to in writing, the software is +provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied, including, without limitation, any warranties or +conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. + +============================================================================== diff --git a/swmm-toolkit/extern/openmp.cmake b/swmm-toolkit/extern/openmp.cmake index baf4635f..89d74850 100644 --- a/swmm-toolkit/extern/openmp.cmake +++ b/swmm-toolkit/extern/openmp.cmake @@ -13,6 +13,9 @@ # OpenMP library build fails for Xcode generator. Use Ninja or Unix Makefiles # instead. # +# All sources were obtained directly from the LLVM releases on github +# See license-llvm-openmp.txt for the corresponding license and +# https://openmp.llvm.org/ for details on the OpenMP run-time. ################################################################################ ##################### CMAKELISTS FOR OPENMP LIBRARY ###################### diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index e9c96e6f..b7e46b3f 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -105,6 +105,11 @@ def exclude_files(cmake_manifest): here = pathlib.Path(__file__).parent.resolve() long_description = (here / 'README.md').read_text(encoding='utf-8') +if platform_system == "Darwin": + license_files = ['LICENSE.md', 'extern/license-llvm-openmp.txt'] +else: + license_files = ['LICENSE.md'] + setup( name = "swmm-toolkit", version = "0.15.0", @@ -127,7 +132,7 @@ def exclude_files(cmake_manifest): author='See AUTHORS', maintainer_email='bemcdonnell@gmail.com', license='CC0', - + license_files=license_files, keywords="swmm5, swmm, stormwater, hydraulics, hydrology", classifiers=[ "Topic :: Scientific/Engineering", From 01754434a1d82e7d630f901cdb84ecec2ddfe157 Mon Sep 17 00:00:00 2001 From: ckaros Date: Tue, 12 Sep 2023 21:52:37 -0400 Subject: [PATCH 110/126] set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 048b0eee..e18b1967 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.15.0 + 0.15.1 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index b7e46b3f..8f9e6599 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -112,7 +112,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.15.0", + version = "0.15.1", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 444027cc..38a2c5c5 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.15.0" +__version__ = "0.15.1" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From b58c3f3420d1057cce8e46c6ee5363b4abd972dd Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 26 Sep 2023 13:07:42 -0400 Subject: [PATCH 111/126] add ninja to build requirements --- swmm-toolkit/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/pyproject.toml b/swmm-toolkit/pyproject.toml index bf989284..5f79a435 100644 --- a/swmm-toolkit/pyproject.toml +++ b/swmm-toolkit/pyproject.toml @@ -5,5 +5,6 @@ requires = [ "scikit-build>=0.13", "cmake>=3.21", "swig==4.0.2", + "ninja==1.11.1 ; sys_platform == 'darwin'" ] build-backend = "setuptools.build_meta" \ No newline at end of file From b2e8b38f8d5543663bbba1967c88188e48d01287 Mon Sep 17 00:00:00 2001 From: karosc Date: Tue, 26 Sep 2023 13:10:33 -0400 Subject: [PATCH 112/126] set release version --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index e18b1967..2f78fb90 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.15.1 + 0.15.2 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 8f9e6599..f9d68c29 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -112,7 +112,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.15.1", + version = "0.15.2", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 38a2c5c5..d759edd4 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.15.1" +__version__ = "0.15.2" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From 82e23b3c76497ce4c948ca605b8cb129d7d14a33 Mon Sep 17 00:00:00 2001 From: karosc Date: Wed, 27 Sep 2023 09:27:12 -0400 Subject: [PATCH 113/126] install ninja from pip instead of brew --- .github/workflows/build_wheel.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 38f970f7..cb657652 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -106,8 +106,6 @@ jobs: with: package-dir: ./swmm-toolkit env: - # mac needs ninja to build - CIBW_BEFORE_BUILD_MACOS: brew install ninja # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: aarch64 CIBW_ARCHS_MACOS: arm64 From 6b2f7453834b6fb670146e4b409825582f82ec2a Mon Sep 17 00:00:00 2001 From: "Bryant E. McDonnell" Date: Mon, 27 Nov 2023 11:33:28 -0700 Subject: [PATCH 114/126] Adding PY3.12 Support to build --- .github/workflows/build_wheel.yml | 16 ++++++++-------- swmm-toolkit/setup.py | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index cb657652..f7101f3c 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -47,7 +47,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-2022, macos-12] - pyver: [cp38, cp39, cp310, cp311] + pyver: [cp38, cp39, cp310, cp311, cp312] steps: - name: Checkout repo @@ -64,14 +64,14 @@ jobs: CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja - # configure cibuildwheel to build native archs ('auto'), and some emulated ones + # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 CIBW_ARCHS_WINDOWS: AMD64 CIBW_ARCHS_MACOS: x86_64 # only build current supported python: https://devguide.python.org/versions/ # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs CIBW_BUILD: ${{matrix.pyver}}-* - CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* + CIBW_SKIP: cp36-* cp37-* pp* *-musllinux* # Will avoid testing on emulated architectures # Skip trying to test arm64 builds on Intel Macs CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" @@ -87,7 +87,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest,macos-12] - pyver: [cp38, cp39, cp310, cp311] + pyver: [cp38, cp39, cp310, cp311, cp312] steps: - name: Checkout repo @@ -106,15 +106,15 @@ jobs: with: package-dir: ./swmm-toolkit env: - # configure cibuildwheel to build native archs ('auto'), and some emulated ones + # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: aarch64 - CIBW_ARCHS_MACOS: arm64 + CIBW_ARCHS_MACOS: arm64 # only build current supported python: https://devguide.python.org/versions/ # don't build pypy or musllinux to save build time. TODO: find a good way to support those archs CIBW_BUILD: ${{matrix.pyver}}-* - CIBW_SKIP: cp36-* cp37-* cp312-* pp* *-musllinux* + CIBW_SKIP: cp36-* cp37-* pp* *-musllinux* CIBW_BUILD_VERBOSITY: 1 - uses: actions/upload-artifact@v3 with: - path: ./wheelhouse/*.whl \ No newline at end of file + path: ./wheelhouse/*.whl diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index f9d68c29..60544ced 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -124,10 +124,10 @@ def exclude_files(cmake_manifest): cmake_args = cmake_args, cmake_process_manifest_hook = exclude_files, - description='OWA SWMM Python Toolkit', + description='PySWMM SWMM Python Toolkit', long_description=long_description, long_description_content_type='text/markdown', - url='https://github.com/OpenWaterAnalytics/swmm-python', + url='https://github.com/pyswmm/swmm-python', author='See AUTHORS', maintainer_email='bemcdonnell@gmail.com', @@ -145,7 +145,8 @@ def exclude_files(cmake_manifest): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: C", "Development Status :: 5 - Production/Stable", ] -) \ No newline at end of file +) From a35ae11e77c397053bd1a5cb6a306c28507e5550 Mon Sep 17 00:00:00 2001 From: "Bryant E. McDonnell" Date: Mon, 27 Nov 2023 12:02:20 -0700 Subject: [PATCH 115/126] bumping version v0.15.3 --- swmm-toolkit/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 60544ced..5ea2f994 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -112,7 +112,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.15.2", + version = "0.15.3", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, From 93242a0aae32232642eaae8cb86f65509cdc5876 Mon Sep 17 00:00:00 2001 From: "Bryant E. McDonnell" Date: Mon, 27 Nov 2023 15:45:30 -0700 Subject: [PATCH 116/126] Updated cibuildwheel and bumped cmakelists version number --- .github/workflows/build_wheel.yml | 4 ++-- swmm-toolkit/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index f7101f3c..2a2931c7 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -56,7 +56,7 @@ jobs: submodules: true - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.16.2 with: package-dir: ./swmm-toolkit env: @@ -102,7 +102,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.16.2 with: package-dir: ./swmm-toolkit env: diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 2f78fb90..08301bce 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.15.2 + 0.15.3 ) From cbe36fc2efaf9dd69017cdffe6150dd2afef1b35 Mon Sep 17 00:00:00 2001 From: "Bryant E. McDonnell" Date: Mon, 27 Nov 2023 15:56:04 -0700 Subject: [PATCH 117/126] Update test-requirements for 3.12 lacking distutils --- swmm-toolkit/test-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index cbb4f032..a8807923 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -4,4 +4,5 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" numpy == 1.24.4; python_version >= "3.8" +numpy == 1.26.2; python_version >= "3.12" aenum == 3.1.11 From e2e25c33fbd6f7492f13d8251db6d691c7a98e10 Mon Sep 17 00:00:00 2001 From: "Bryant E. McDonnell" Date: Mon, 27 Nov 2023 16:06:45 -0700 Subject: [PATCH 118/126] Fighting the build process --- swmm-toolkit/test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm-toolkit/test-requirements.txt b/swmm-toolkit/test-requirements.txt index a8807923..0cc9aaba 100644 --- a/swmm-toolkit/test-requirements.txt +++ b/swmm-toolkit/test-requirements.txt @@ -3,6 +3,6 @@ pytest == 7.1.1 numpy == 1.21.6; python_version == "3.7" -numpy == 1.24.4; python_version >= "3.8" +numpy == 1.24.4; python_version < "3.12" numpy == 1.26.2; python_version >= "3.12" aenum == 3.1.11 From b92a146d66fcd07038dda4478f3382540a9f648a Mon Sep 17 00:00:00 2001 From: stroutm Date: Wed, 6 Mar 2024 13:18:30 -0500 Subject: [PATCH 119/126] Added statement to check if symbolic_name already exists in shared_enum before extending --- swmm-toolkit/src/swmm/toolkit/output_metadata.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/src/swmm/toolkit/output_metadata.py b/swmm-toolkit/src/swmm/toolkit/output_metadata.py index 93731f46..89b6210b 100644 --- a/swmm-toolkit/src/swmm/toolkit/output_metadata.py +++ b/swmm-toolkit/src/swmm/toolkit/output_metadata.py @@ -88,9 +88,10 @@ def _build_pollut_metadata(self, output_handle): # Create dictionary keys for i in range(1, n): symbolic_name = 'POLLUT_CONC_' + str(i) - extend_enum(shared_enum.SubcatchAttribute, symbolic_name, 8 + i) - extend_enum(shared_enum.NodeAttribute, symbolic_name, 6 + i) - extend_enum(shared_enum.LinkAttribute, symbolic_name, 5 + i) + if symbolic_name not in shared_enum.SubcatchAttribute._member_names_: + extend_enum(shared_enum.SubcatchAttribute, symbolic_name, 8 + i) + extend_enum(shared_enum.NodeAttribute, symbolic_name, 6 + i) + extend_enum(shared_enum.LinkAttribute, symbolic_name, 5 + i) # Update metadata dictionary with pollutant metadata for i, attr in enumerate(islice(shared_enum.SubcatchAttribute, 8, None)): From 4b28a7e2e0d1b8897ca02d5eb5aba3a972f22b88 Mon Sep 17 00:00:00 2001 From: stroutm Date: Fri, 12 Apr 2024 11:32:13 -0400 Subject: [PATCH 120/126] bumping version v0.15.4 --- swmm-toolkit/AUTHORS | 3 ++- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/swmm-toolkit/AUTHORS b/swmm-toolkit/AUTHORS index 334d0a05..a908903a 100644 --- a/swmm-toolkit/AUTHORS +++ b/swmm-toolkit/AUTHORS @@ -7,4 +7,5 @@ Caleb Buahin Laurent Courty Constantine Karos Abhiram Mullapudi -Brooke Mason \ No newline at end of file +Brooke Mason +Sara C. Troutman \ No newline at end of file diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index 08301bce..b899ca44 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.15.3 + 0.15.4 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 5ea2f994..275e6915 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -112,7 +112,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.15.3", + version = "0.15.4", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index d759edd4..6440085c 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.15.2" +__version__ = "0.15.4" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby" From c1511938fa028721b23a1d89cb2dd1f425bb523c Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 12 Apr 2024 15:35:22 -0400 Subject: [PATCH 121/126] fix: update cibuildwheel --- .github/workflows/build_wheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 2a2931c7..14e1dbd2 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -56,7 +56,7 @@ jobs: submodules: true - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.17.0 with: package-dir: ./swmm-toolkit env: From 1f5b00499b6d15c25a833235d8cddf2fd65c52a4 Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 12 Apr 2024 15:53:28 -0400 Subject: [PATCH 122/126] fix pipeline: remove system swig before building wheel --- .github/workflows/build_wheel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 14e1dbd2..b04b35cf 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -64,6 +64,7 @@ jobs: CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja + CIBW_BEFORE_BUILD_LINUX: sudo apt remove swig4.0 cmake # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 CIBW_ARCHS_WINDOWS: AMD64 @@ -102,7 +103,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.17.0 with: package-dir: ./swmm-toolkit env: From 5dd041f9f0e2d39a8e88d29a2d08bd4d8b745245 Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 12 Apr 2024 15:56:18 -0400 Subject: [PATCH 123/126] fix: debug actions --- .github/workflows/build_wheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index b04b35cf..bacecda7 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -64,7 +64,7 @@ jobs: CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja - CIBW_BEFORE_BUILD_LINUX: sudo apt remove swig4.0 cmake + CIBW_BEFORE_BUILD_LINUX: apt remove -y swig4.0 cmake # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 CIBW_ARCHS_WINDOWS: AMD64 From 3f24358229332cfd7abfa2b2a9258df80eed94fb Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 12 Apr 2024 16:07:49 -0400 Subject: [PATCH 124/126] fix: debug actions --- .github/workflows/build_wheel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index bacecda7..21fb154c 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -64,7 +64,8 @@ jobs: CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja - CIBW_BEFORE_BUILD_LINUX: apt remove -y swig4.0 cmake + # remove system swig (cmake bug doesn't respect python venv) + CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0) # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 CIBW_ARCHS_WINDOWS: AMD64 From 0d580c2d365d6140fb8200dfed88a62bd1d97b87 Mon Sep 17 00:00:00 2001 From: ckaros Date: Fri, 12 Apr 2024 16:19:10 -0400 Subject: [PATCH 125/126] fix: debug cross build wheel --- .github/workflows/build_wheel.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 21fb154c..402ea21b 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -65,6 +65,7 @@ jobs: # mac needs ninja to build CIBW_BEFORE_BUILD_MACOS: brew install ninja # remove system swig (cmake bug doesn't respect python venv) + # https://github.com/swig/swig/issues/2481#issuecomment-1949573105 CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0) # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: x86_64 @@ -108,6 +109,9 @@ jobs: with: package-dir: ./swmm-toolkit env: + # remove system swig (cmake bug doesn't respect python venv) + # https://github.com/swig/swig/issues/2481#issuecomment-1949573105 + CIBW_BEFORE_BUILD_LINUX: rm -f $(which swig) && rm -f $(which swig4.0) # configure cibuildwheel to build native archs ('auto'), and some emulated ones CIBW_ARCHS_LINUX: aarch64 CIBW_ARCHS_MACOS: arm64 From 11f60fe560a07ecf1b21397b5967330215478eca Mon Sep 17 00:00:00 2001 From: ckaros Date: Wed, 17 Apr 2024 14:01:13 -0400 Subject: [PATCH 126/126] bump version to v0.15.5 --- swmm-toolkit/CMakeLists.txt | 2 +- swmm-toolkit/setup.py | 2 +- swmm-toolkit/src/swmm/toolkit/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm-toolkit/CMakeLists.txt b/swmm-toolkit/CMakeLists.txt index b899ca44..e73fc735 100644 --- a/swmm-toolkit/CMakeLists.txt +++ b/swmm-toolkit/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17) project(swmm-toolkit VERSION - 0.15.4 + 0.15.5 ) diff --git a/swmm-toolkit/setup.py b/swmm-toolkit/setup.py index 275e6915..846887ca 100644 --- a/swmm-toolkit/setup.py +++ b/swmm-toolkit/setup.py @@ -112,7 +112,7 @@ def exclude_files(cmake_manifest): setup( name = "swmm-toolkit", - version = "0.15.4", + version = "0.15.5", packages = ["swmm_toolkit", "swmm.toolkit"], package_dir = package_dir, diff --git a/swmm-toolkit/src/swmm/toolkit/__init__.py b/swmm-toolkit/src/swmm/toolkit/__init__.py index 6440085c..9d09fa28 100644 --- a/swmm-toolkit/src/swmm/toolkit/__init__.py +++ b/swmm-toolkit/src/swmm/toolkit/__init__.py @@ -19,7 +19,7 @@ __credits__ = "Colleen Barr, Sam Hatchett" __license__ = "CC0 1.0 Universal" -__version__ = "0.15.4" +__version__ = "0.15.5" __date__ = "June 7, 2021" __maintainer__ = "Michael Tryby"