Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
14d1f6b
misc fixes
timcera Apr 30, 2024
9b73aac
fixes for publish.py and pyproject.toml
timcera Apr 30, 2024
bfe5ef9
this action does not work, it hangs indefinately
austinorr Apr 30, 2024
3886a15
this action is not yet needed, should likely be a simple matrix in th…
austinorr Apr 30, 2024
2e414f9
Merge pull request #160 from Geosyntec/cleanup-actions
PaulDudaRESPEC Apr 30, 2024
059ea16
OXRX_Class.py -- explicitly set tcginv and len_ to avoid future issue…
PaulDudaRESPEC May 1, 2024
9e8abaa
Test10 -- fixed sedment option flag in the UCI
PaulDudaRESPEC May 1, 2024
63b8e86
utilities.py and io.py -- small improvements to get into the next rel…
PaulDudaRESPEC May 1, 2024
dc02461
Merge pull request #159 from timcera/fix
PaulDudaRESPEC May 3, 2024
01497f1
readUCI.py -- go back to old way fix_df for now
PaulDudaRESPEC May 3, 2024
9f89944
added pytest to deps and python application ci job
austinorr Apr 29, 2024
6e80095
tests/test10/HSP2results fails due to df.append in readUCI line 86; p…
austinorr Apr 29, 2024
312bec5
rm no-op pytest since there is now an actual test to call
austinorr Apr 29, 2024
16fd3ae
use this to manually hide personal files; todo: rm all the personal p…
austinorr May 4, 2024
58cae81
(fix) cleanup the utilities.versions function so that it can't fail a…
austinorr May 4, 2024
9b553f7
add pytest apparatus that works with test10, and hopefully others. mu…
austinorr May 4, 2024
566a1a9
refactor commands for reuse in test helpers
austinorr May 4, 2024
ddf80fd
lint pyproject.toml
austinorr May 4, 2024
5396ea2
support pandas versions 1.5-2+
austinorr May 5, 2024
d88ac0a
fix packaging bug that excluded data files for HSP2tools
austinorr May 5, 2024
b30eea0
parallelize ci tests & lint; test python 3.9-3.12; test pandas<1.5 & …
austinorr May 5, 2024
8da75e9
fix test suite to include 3.9
austinorr May 5, 2024
a487020
fix quotes for pandas version
austinorr May 5, 2024
e584386
speed up tests not under coverage
austinorr May 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/workflows/hsp2-conda-install-test-dev.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/hsp2-pip-install-test-dev.yml

This file was deleted.

108 changes: 74 additions & 34 deletions .github/workflows/hsp2-pip-install-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Python application
# this is a standard setup copied from
# https://docs.github.com/en/enterprise-server@3.10/actions/automating-builds-and-tests/building-and-testing-python

on:
push:
branches: [ "master" ]
Expand All @@ -11,37 +10,78 @@ permissions:
contents: read

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install mando numba pandas tables
- name: Install hsp2
run: |
# install the hsp2 executable
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics --exclude=HSP2/ACIDPH.py,build/lib/HSP2/ACIDPH.py
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests/ptest/test_sysexit.py
# add additional test, ex:
# pytest tests/testcbp/HSP2results/benchmark.py
- name: Run hsp2 test10
run: |
cd tests/test10/HSP2results
hsp2 import_uci test10.uci test10.h5
hsp2 run test10.h5
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics --exclude=build/*
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

test-pytest:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
pandas-version: [""]
include:
- python-version: "3.11"
pandas-version: "pandas>2.0"
coverage: true
- python-version: "3.11"
pandas-version: "pandas>1.5,<2.0"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install hsp2
run: |
# install the hsp2 executable
pip install .[dev]
- if: ${{ matrix.pandas-version }}
run: pip install "${{ matrix.pandas-version }}"
- if: ${{ matrix.coverage }}
run: |
# python coverage
NUMBA_DISABLE_JIT=1 pytest --cov --cov-branch --cov-report term-missing
- if: ${{ ! matrix.coverage }}
run: pytest

test-cmd:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install hsp2
run: |
# install the hsp2 executable
pip install .
- name: Run hsp2
run: |
# TODO: find much shorter test case.
hsp2 import_uci ./tests/test10/HSP2results/test10.uci _temp_test10.h5
hsp2 run _temp_test10.h5

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Manual
_no_git*

# Editors & IDEs
.vscode
.vs
Expand Down Expand Up @@ -42,6 +45,7 @@ htmlcov
*.log
*.hbnhead
*.units.dbf
*_temp*.h5

# Translations
*.mo
Expand Down
4 changes: 2 additions & 2 deletions HSP2/ADCALC.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def _adcalc_(ui, ts):
for index in range(nexits):
ts['EOVOL' + str(index + 1)] = EOVOL[:, index]

ROS = ui['ROS']
ROS = ui.get('ROS', 0.0)
OS = zeros(nexits)
for index in range(nexits):
OS[index] = ui['OS' + str(index + 1)]
OS[index] = ui.get('OS' + str(index + 1), 0.0)

# external time series
O = zeros((simlen, nexits))
Expand Down
8 changes: 4 additions & 4 deletions HSP2/GENER.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class Gener():
"""

def __init__(self, segment: str, siminfo: Dict, copies: Dict, geners: Dict, ddlinks: Dict, ddmasslinks: Dict, tsin: Dict, ddgener: Dict) -> None:
self.ts_input_1 = pd.Series() # type: pd.Series
self. ts_input_2 = pd.Series() # type: pd.Series
self.ts_output = pd.Series() # type: pd.Series
self.ts_input_1 = pd.Series(dtype="float64") # type: pd.Series
self.ts_input_2 = pd.Series(dtype="float64") # type: pd.Series
self.ts_output = pd.Series(dtype="float64") # type: pd.Series
self.opcode = 0 # type: int
self.k = -1.0E30 # type: float

Expand All @@ -27,7 +27,7 @@ def __init__(self, segment: str, siminfo: Dict, copies: Dict, geners: Dict, ddli
self.ts_input_1 = ts

for link in ddlinks[segment]:
ts = pd.Series()
ts = pd.Series(dtype="float64")
if link.SVOL == 'COPY':
copy = copies[link.SVOLNO]
ts = copy.get_ts(link.SMEMN,link.SMEMSB1)
Expand Down
9 changes: 6 additions & 3 deletions HSP2/OXRX_Class.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,20 @@ def __init__(self, siminfo, nexits, vol, ui_rq, ui, ts):
self.expred = 0.0; self.exprev = 0.0
self.expod = 0.0; self.exprel = 0.0

self.len_ = ui['LEN'] * 5280.0 # mi to feet
if self.uunits == 2:
self.len_ = ui['LEN'] * 1000.0 # length of reach, in meters

if self.LKFG == 1:
self.cforea = ui['CFOREA'] # reaeration parameter from table-type ox-cforea
self.tcginv = 0

elif self.REAMFG == 1: # tsivoglou method; table-type ox-tsivoglou
self.reakt = ui['REAKT']
self.tcginv = ui['TCGINV']

self.len_ = ui['LEN'] * 5280.0 # mi to feet

self.delth = ui['DELTH']
if self.uunits == 2:
self.len_ = ui['LEN'] * 1000.0 # length of reach, in meters
self.delth = ui['DELTH'] * 1000.0 # convert to meters

elif self.REAMFG == 2: # owen/churchill/o'connor-dobbins; table-type ox-tcginv
Expand Down
4 changes: 3 additions & 1 deletion HSP2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
Authors: Robert Heaphy, Ph.D. and Paul Duda
License: LGPL2
'''
from importlib.metadata import version

from HSP2.main import main
from HSP2.mainDoE import main as mainDoE
from HSP2.utilities import versions, flowtype
from _version import __version__

__version__ = version("hsp2")

Loading