Skip to content

Commit

Permalink
Merge branch 'main' into gis_plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
kbonney committed Sep 30, 2024
2 parents 48ac43e + 9edc23d commit b1bd4f6
Show file tree
Hide file tree
Showing 19 changed files with 1,220 additions and 2,682 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down Expand Up @@ -47,7 +48,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -57,13 +59,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl
# - name: Discover
# run: |
# ls .
- name: Install wntr
run: |
python -m pip install --upgrade pip
pip install wheel numpy scipy networkx pandas matplotlib setuptools
pip install wheel "numpy>=1.2.1,<2.0" scipy networkx pandas matplotlib setuptools
pip install --no-index --pre --find-links=. wntr
- name: Usage of wntr
run: |
Expand All @@ -74,7 +73,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
54 changes: 39 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,72 @@ on:
jobs:

wheels:
name: Build distribution 📦 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, macOS-11, ubuntu-20.04]
os: [windows-latest, macOS-13, macos-13, ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.1
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
env:
CIBW_ENVIRONMENT: BUILD_WNTR_EXTENSIONS='true'
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-*
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

source:
name: Make SDist artifact 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: build the sdist
run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v3

- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: cibw-sdist
path: dist/*.tar.gz

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
needs: [wheels, source]
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
- uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # release/v1
with:
user: __token__
password: ${{ secrets.PYPI_WNTR_API_TOKEN }}
2 changes: 1 addition & 1 deletion documentation/attention.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. attention::
Version 1.1 is now available.
Version 1.2.0 is now available.
See `release notes <https://usepa.github.io/WNTR/whatsnew.html>`_
for more information.
2 changes: 1 addition & 1 deletion documentation/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ run simulations are described in more detail below, followed by a list of softwa
:class:`~wntr.network` Contains classes and methods to define a water network model, network controls, model options, and graph representation of the network.
:class:`~wntr.scenario` Contains classes and methods to define disaster scenarios and fragility/survival curves.
:class:`~wntr.sim` Contains classes and methods to run hydraulic and water quality simulations using the water network model.
:class:`~wntr.metrics` Contains functions to compute resilience, including hydraulic, water quality, water security, and economic metrics. Methods to compute topographic metrics are included in the wntr.network.graph module.
:class:`~wntr.metrics` Contains functions to compute resilience, including topographic, hydraulic, water quality, water security, and economic metrics.
:class:`~wntr.morph` Contains methods to modify water network model morphology, including network skeletonization, modifying node coordinates, and splitting or breaking pipes.
:class:`~wntr.gis` Contains geospatial capabilities, including a function to convert the water network model to GeoDataFrames.
:class:`~wntr.graphics` Contains functions to generate graphics.
Expand Down
41 changes: 22 additions & 19 deletions documentation/gis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ For example, the junctions GeoDataFrame contains the following information:
:skipif: gpd is None

>>> print(wn_gis.junctions.head())
node_type elevation initial_quality geometry
10 Junction 216.408 5.000e-04 POINT (20.00000 70.00000)
11 Junction 216.408 5.000e-04 POINT (30.00000 70.00000)
12 Junction 213.360 5.000e-04 POINT (50.00000 70.00000)
13 Junction 211.836 5.000e-04 POINT (70.00000 70.00000)
21 Junction 213.360 5.000e-04 POINT (30.00000 40.00000)
node_type elevation initial_quality geometry
name
10 Junction 216.408 5.000e-04 POINT (20.00000 70.00000)
11 Junction 216.408 5.000e-04 POINT (30.00000 70.00000)
12 Junction 213.360 5.000e-04 POINT (50.00000 70.00000)
13 Junction 211.836 5.000e-04 POINT (70.00000 70.00000)
21 Junction 213.360 5.000e-04 POINT (30.00000 40.00000)

Each GeoDataFrame contains attributes and geometry:

Expand Down Expand Up @@ -333,21 +334,23 @@ and then translates the GeoDataFrames coordinates to EPSG:3857.

>>> wn_gis = wntr.network.to_gis(wn, crs='EPSG:4326')
>>> print(wn_gis.junctions.head())
node_type elevation initial_quality geometry
10 Junction 216.408 5.000e-04 POINT (20.00000 70.00000)
11 Junction 216.408 5.000e-04 POINT (30.00000 70.00000)
12 Junction 213.360 5.000e-04 POINT (50.00000 70.00000)
13 Junction 211.836 5.000e-04 POINT (70.00000 70.00000)
21 Junction 213.360 5.000e-04 POINT (30.00000 40.00000)

node_type elevation initial_quality geometry
name
10 Junction 216.408 5.000e-04 POINT (20.00000 70.00000)
11 Junction 216.408 5.000e-04 POINT (30.00000 70.00000)
12 Junction 213.360 5.000e-04 POINT (50.00000 70.00000)
13 Junction 211.836 5.000e-04 POINT (70.00000 70.00000)
21 Junction 213.360 5.000e-04 POINT (30.00000 40.00000)

>>> wn_gis.to_crs('EPSG:3857')
>>> print(wn_gis.junctions.head())
node_type elevation initial_quality geometry
10 Junction 216.408 5.000e-04 POINT (2226389.816 11068715.659)
11 Junction 216.408 5.000e-04 POINT (3339584.724 11068715.659)
12 Junction 213.360 5.000e-04 POINT (5565974.540 11068715.659)
13 Junction 211.836 5.000e-04 POINT (7792364.356 11068715.659)
21 Junction 213.360 5.000e-04 POINT (3339584.724 4865942.280)
node_type elevation initial_quality geometry
name
10 Junction 216.408 5.000e-04 POINT (2226389.816 11068715.659)
11 Junction 216.408 5.000e-04 POINT (3339584.724 11068715.659)
12 Junction 213.360 5.000e-04 POINT (5565974.540 11068715.659)
13 Junction 211.836 5.000e-04 POINT (7792364.356 11068715.659)
21 Junction 213.360 5.000e-04 POINT (3339584.724 4865942.280)

Snap point geometries to the nearest point or line
----------------------------------------------------
Expand Down
21 changes: 14 additions & 7 deletions documentation/whatsnew/v1.2.0.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
v1.2.0 (main)
v1.2.0 (June 18, 2024)
---------------------------------------------------
WNTR version 1.2.0 includes the following updates:

* Added basic and geospatial jupyter notebook demos, updated documentation, dropped Python 3.7 and 3.8 from testing https://github.com/USEPA/WNTR/pull/419
* Fix: plot_network bug due to changed networkx draw function behavior https://github.com/USEPA/WNTR/pull/417
* Fix: Addressing bug caused when units="SI" in a call to write_inp() https://github.com/USEPA/WNTR/pull/410
* Added EpanetException class and subclasses that allow for cleaner error reporting during IO https://github.com/USEPA/WNTR/pull/381
* Added google analytics key https://github.com/USEPA/WNTR/pull/406
* Added setuptools and removed readthedocs config https://github.com/USEPA/WNTR/pull/396
* Documentation updates to install WNTR without Anaconda https://github.com/USEPA/WNTR/pull/403
* Added setuptools and removed readthedocs config https://github.com/USEPA/WNTR/pull/396
* Added google analytics key https://github.com/USEPA/WNTR/pull/406
* Added EpanetException class and subclasses that allow for cleaner error reporting during IO https://github.com/USEPA/WNTR/pull/381
* Fixed bug caused by units="SI" in a call to write_inp https://github.com/USEPA/WNTR/pull/410
* Fixed bug caused by changes in NetworkX draw function https://github.com/USEPA/WNTR/pull/417
* Added basic and geospatial jupyter notebook demos https://github.com/USEPA/WNTR/pull/419
* Dropped Python 3.7 and 3.8 from testing https://github.com/USEPA/WNTR/pull/419
* Resolved deprecation/future warnings and included GeoPandas in windows build test https://github.com/USEPA/WNTR/pull/423
* Added nodes/pipes to excluded in skeletonization https://github.com/USEPA/WNTR/pull/384
* Fixed bug related to link colormap https://github.com/USEPA/WNTR/pull/429
* Fixed bug in GIS I/O caused by index names https://github.com/USEPA/WNTR/pull/395
* Fixed bug in network_animation https://github.com/USEPA/WNTR/pull/405
* Updated workflow and testing to hold numpy < 2.0 and use macOS-13 https://github.com/USEPA/WNTR/pull/430
Loading

0 comments on commit b1bd4f6

Please sign in to comment.