Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to packaging push plus fixes #158

Closed
wants to merge 88 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
e78f84c
first cut at implementing other gener operations
PaulDudaRESPEC Oct 31, 2023
4431180
first draft of enhancement to allow output aggregated to daily, month…
PaulDudaRESPEC Nov 1, 2023
9c435e3
small clean-ups to fully implement GENER operations
PaulDudaRESPEC Nov 27, 2023
9bb8109
Added a couple R files to ignore to keep the repo clean when includin…
rburghol Nov 29, 2023
e1140fc
Merge pull request #124 from HARPgroup/devignore
PaulDudaRESPEC Dec 1, 2023
85ce951
Merge pull request #125 from respec/master
PaulDudaRESPEC Dec 15, 2023
fece38c
clean up details of ParseTable.csv
PaulDudaRESPEC Dec 15, 2023
fc9846e
add hdf5 file name to output message
PaulDudaRESPEC Dec 20, 2023
d2bc9cc
refinements to include multiple canopy layer enhancement
PaulDudaRESPEC Dec 20, 2023
274eaab
Create python-app.yml
rburghol Feb 12, 2024
dfa9e75
Update python-app.yml
rburghol Feb 12, 2024
34530b4
Update python-app.yml
rburghol Feb 12, 2024
26dd7aa
Update python-app.yml
rburghol Feb 12, 2024
4b938da
Update python-app.yml
rburghol Feb 12, 2024
aa625f3
Update python-app.yml
rburghol Feb 26, 2024
32bf2a7
Create python-app1.yml
rburghol Feb 26, 2024
23de13b
Update python-app.yml
rburghol Feb 26, 2024
b819471
Update python-app.yml
rburghol Feb 26, 2024
e15a76d
Update python-app.yml
rburghol Feb 26, 2024
2a05f92
delete superfluous workflow
Feb 26, 2024
3b718c0
add actions folder to see if it fixes
Feb 26, 2024
2f39354
Update python-app.yml
rburghol Feb 26, 2024
419dc23
Update python-app.yml
rburghol Feb 26, 2024
20009c6
disable the custom action yml to see if it still works (as tutorial s…
Feb 26, 2024
92941eb
Merge branch 'master' of github.com:HARPgroup/HSPsquared
Feb 26, 2024
40d52f5
Update python-app.yml
rburghol Feb 26, 2024
f996426
Update python-app.yml
rburghol Feb 26, 2024
c129dca
Update python-app.yml
rburghol Feb 26, 2024
2b5c89b
Update python-app.yml
rburghol Feb 26, 2024
238388e
add ptest
Feb 26, 2024
9fa2d9c
Merge branch 'master' of github.com:HARPgroup/HSPsquared
Feb 26, 2024
411facc
Update python-app.yml
rburghol Feb 26, 2024
219716f
Update python-app.yml
rburghol Feb 26, 2024
790b18d
Update python-app.yml
rburghol Feb 26, 2024
c401751
Update python-app.yml
rburghol Feb 26, 2024
6fd649b
Update python-app.yml
rburghol Feb 27, 2024
c008638
Update environment.yml
rburghol Feb 27, 2024
f85f89d
Update environment.yml
rburghol Feb 27, 2024
c42de0b
Update python-app.yml
rburghol Feb 27, 2024
fe5bb14
Update python-app.yml
rburghol Feb 27, 2024
0ce080d
Create hsp2_dev_env
rburghol Feb 28, 2024
25cf2e8
Update python-app.yml
rburghol Feb 28, 2024
c607417
Update hsp2_dev_env
rburghol Feb 28, 2024
dc3270b
Update hsp2_dev_env
rburghol Feb 28, 2024
11b8a5a
dev environment test yml file
Feb 28, 2024
a769432
Update hsp2-install-dev.yml
rburghol Feb 28, 2024
3bd434f
Update hsp2-install-dev.yml
rburghol Feb 28, 2024
bb527e2
Update hsp2-install-dev.yml
rburghol Feb 28, 2024
30e4083
Update hsp2-install-dev.yml
rburghol Feb 28, 2024
3a4adff
dont save test h5 files
Feb 28, 2024
40aac69
initial set of tests for CI
Feb 28, 2024
d2aeef6
Merge pull request #90 from HARPgroup/testx
rburghol Feb 28, 2024
96bdf1e
update test file with hsp2 run
Feb 28, 2024
3ac6b9c
add test of hdf5 exists
Feb 28, 2024
6dc9b84
add test of hdf5 exists
Feb 28, 2024
19c6d2f
rename pytest
Feb 28, 2024
a9001cb
rename pytest call
Feb 28, 2024
42363f9
add a failing test
Feb 28, 2024
577c850
format
Feb 28, 2024
ad51109
disble purposely failing test
Feb 28, 2024
9e09e61
adding new dev config from dependency_options branch
Feb 29, 2024
cfb12e5
set py to 3.11 in dev
Feb 29, 2024
98b3e21
info
Feb 29, 2024
780c50f
rename scripts to show install env (i.e. pip / conda)
Feb 29, 2024
45b48db
attempt a conda install tester
Feb 29, 2024
f79bc56
attempt a conda install tester
Feb 29, 2024
e3dfaf0
attempt a conda install tester
Feb 29, 2024
4f31719
try looking for hsp2 in the CONDA path
Feb 29, 2024
71f58d8
call hsp wihtout path
Feb 29, 2024
5b6ca0a
Merge pull request #144 from respec/master
PaulDudaRESPEC Mar 5, 2024
ed3f2a5
merge in minor additions
PaulDudaRESPEC Mar 6, 2024
760b180
merging in changes from HARPgroup
PaulDudaRESPEC Mar 6, 2024
2df5a94
Merge branch 'develop' into testx
rburghol Mar 6, 2024
5e54508
Merge pull request #142 from HARPgroup/testx
PaulDudaRESPEC Mar 6, 2024
0bd5030
only run tests on 3 branches
Mar 18, 2024
34a56c8
Merge pull request #148 from HARPgroup/testx
PaulDudaRESPEC Apr 2, 2024
e84924b
ACIDPH.py is not yet valid python, preserving wip as text
austinorr Apr 19, 2024
07d1b78
prepare for disabling the jit during tests to enable code coverage
austinorr Apr 19, 2024
1decc4f
tests passing for IWater and PWater under pytest with ~70% code coverage
austinorr Apr 19, 2024
7bcae32
(feat) change to a pyproject.toml to publish to pypi
timcera Apr 22, 2024
43af3bc
(ci) update github workflows to work with pyproject.toml.
timcera Apr 23, 2024
1dca5ba
(fix) replaced mando with cltoolbox
timcera Apr 23, 2024
a6abcfb
Merge pull request #151 from Geosyntec/ipwater-tests
PaulDudaRESPEC Apr 23, 2024
3a40125
Merge pull request #152 from timcera/pypi_package
PaulDudaRESPEC Apr 23, 2024
681b842
README.md -- restore this file temporarily while resolving a merge co…
PaulDudaRESPEC Apr 23, 2024
d149b7d
Merge pull request #153 from respec/master
PaulDudaRESPEC Apr 23, 2024
fd31a26
Delete README.md after resolving merge conflict
PaulDudaRESPEC Apr 23, 2024
2288da3
misc fixes
timcera Apr 30, 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: 48 additions & 0 deletions .github/workflows/hsp2-conda-install-test-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Python conda dev application
# this is a standard setup copied from
# https://docs.github.com/en/[email protected]/actions/automating-builds-and-tests/building-and-testing-python
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop", "develop-specact" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
$CONDA/bin/conda env update --name base
$CONDA/bin/conda install -c conda-forge --name base mando numba pandas pytables
$CONDA/bin/conda install flake8
- name: Install hsp2
run: |
# install the hsp2 executable using dev environment
$CONDA/bin/conda-develop ./
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
$CONDA/bin/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
$CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
$CONDA/bin/conda install pytest
$CONDA/bin/pytest tests/ptest/test_sysexit.py
# Add more tests here. Example (note, benchmark takes a long time to run and could crush the free monthly 2,000 minutes during times of high activity)
# $CONDA/bin/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
48 changes: 48 additions & 0 deletions .github/workflows/hsp2-pip-install-test-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Python dev application
# this is a standard setup copied from
# https://docs.github.com/en/[email protected]/actions/automating-builds-and-tests/building-and-testing-python
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop", "develop-specact" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install flake8 pytest
pip install mando numba pandas tables
- name: Install hsp2
run: |
# install the hsp2 executable using dev environment
sudo pip install .[dev]
- 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 more tests here. Example (note, benchmark takes a long time to run and could crush the free monthly 2,000 minutes during times of high activity)
# 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
47 changes: 47 additions & 0 deletions .github/workflows/hsp2-pip-install-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Python application
# this is a standard setup copied from
# https://docs.github.com/en/[email protected]/actions/automating-builds-and-tests/building-and-testing-python
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop", "develop-specact" ]

permissions:
contents: read

jobs:
build:
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ tests/GLWACSO/HSP2results/hspp007.hdf
tests/GLWACSO/HSPFresults/hspf006.HBN
tests/GLWACSO/HSP2results/hspp007.uci
tests/test_report_conversion.html

# Omit big files
tests/land_spec/hwmA51800.h5
tests/testcbp/HSP2results/PL3_5250_0001.h5
tests/testcbp/HSP2results/*.csv
tests/test10/HSP2results/test10.h5

# R files
.Rdata
.Rhistory
File renamed without changes.
50 changes: 39 additions & 11 deletions HSP2/GENER.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Gener():
Currently supports OPCODES 1-7, 9-26
"""

def __init__(self, segment: str, siminfo: Dict, copies: Dict, geners: Dict, ddlinks: Dict, ddgener: Dict) -> None:
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
Expand All @@ -36,20 +36,48 @@ def __init__(self, segment: str, siminfo: Dict, copies: Dict, geners: Dict, ddli
if link.SVOLNO in geners:
gener = geners[link.SVOLNO]
ts = gener.get_ts()
if link.MFACTOR != 1: ts *= link.MFACTOR
if link.MFACTOR != 1 and link.MFACTOR != '': ts *= link.MFACTOR
else:
raise NotImplementedError(
f"Invalid SVOL. This GENER operation does not exist. '{link.SVOLNO}'")
else:
raise NotImplementedError(f"Invalid SVOL. GENER module does not currently support reading TimeSeries for '{link.SVOL}'")

if link.TGRPN == 'INPUT' and link.TMEMN == 'ONE':
self.ts_input_1 = ts
elif link.TGRPN == 'INPUT' and link.TMEMN == 'TWO':
self.ts_input_2 = ts
else:
raise AttributeError(f"No attribute {link.TGRPN}{link.THEMN} to assign TimeSeries. Should be either 'INPUTONE' or 'INPUTWO'")

# get timeseries from other operations
if 'ONE' in tsin:
self.ts_input_1 = tsin['ONE']
if 'TWO' in tsin:
self.ts_input_2 = tsin['TWO']
if not 'ONE' in tsin and not 'TWO' in tsin:
raise NotImplementedError(f"Invalid SVOL for '{link.SVOLNO}'")

if link.SVOL == 'COPY' or link.SVOL == 'GENER':
if link.MLNO != '':
# also have to loop thru associated masslinks
mldata = ddmasslinks[link.MLNO]
for dat in mldata:
mfactor = dat.MFACTOR
afactr = link.AFACTR
factor = afactr * mfactor
ts = ts * factor
if dat.TMEMN == 'ONE':
self.ts_input_1 = ts
elif dat.TMEMN == 'TWO':
self.ts_input_2 = ts
else:
raise AttributeError(
f"No attribute {dat.THEMN} to assign TimeSeries. Should be either 'INPUTONE' or 'INPUTTWO'")
else:
if link.TGRPN == 'INPUT' and link.TMEMN == 'ONE':
self.ts_input_1 = ts
elif link.TGRPN == 'INPUT' and link.TMEMN == 'TWO':
self.ts_input_2 = ts
else:
raise AttributeError(f"No attribute {link.TGRPN}{link.THEMN} to assign TimeSeries. Should be either 'INPUTONE' or 'INPUTTWO'")

if self.opcode in [16,17,18,19,20,21,22,23]:
# need to have 2 input timeseries for these
if self.ts_input_1.size == 0 or self.ts_input_2.size == 0:
raise NotImplementedError(f"Need 2 input timeseries for this gener '{link.SVOLNO}'")

self._execute_gener()

def get_ts(self) -> pd.Series:
Expand Down
13 changes: 11 additions & 2 deletions HSP2/PLANK_Class.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import numpy as np
from numpy import zeros, array
from math import log, exp
Expand All @@ -10,9 +12,16 @@
from HSP2.RQUTIL import sink, decbal
from HSP2.utilities import make_numba_dict, initm

if os.environ.get("NUMBA_DISABLE_JIT", 0): # jit should be on by default.
OXRX_Class_ = OXRX_Class
NUTRX_Class_ = NUTRX_Class
else:
OXRX_Class_ = OXRX_Class.class_type.instance_type
NUTRX_Class_ = NUTRX_Class.class_type.instance_type

spec = [
('OXRX', OXRX_Class.class_type.instance_type),
('NUTRX', NUTRX_Class.class_type.instance_type),
('OXRX', OXRX_Class_),
('NUTRX', NUTRX_Class_),
('aldh', nb.float64),
('aldl', nb.float64),
('alnpr', nb.float64),
Expand Down
21 changes: 17 additions & 4 deletions HSP2/RQUAL_Class.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import numpy as np
from numpy import where, zeros, array
from math import log
Expand All @@ -10,11 +12,22 @@
from HSP2.PHCARB_Class import PHCARB_Class
from HSP2.utilities import make_numba_dict, initm

if os.environ.get("NUMBA_DISABLE_JIT", 0): # jit should be on by default.
OXRX_Class_ = OXRX_Class
NUTRX_Class_ = NUTRX_Class
PLANK_Class_ = PLANK_Class
PHCARB_Class_ = PHCARB_Class
else:
OXRX_Class_ = OXRX_Class.class_type.instance_type
NUTRX_Class_ = NUTRX_Class.class_type.instance_type
PLANK_Class_ = PLANK_Class.class_type.instance_type
PHCARB_Class_ = PHCARB_Class.class_type.instance_type

spec = [
('OXRX', OXRX_Class.class_type.instance_type),
('NUTRX', NUTRX_Class.class_type.instance_type),
('PLANK', PLANK_Class.class_type.instance_type),
('PHCARB', PHCARB_Class.class_type.instance_type),
('OXRX', OXRX_Class_),#.class_type.instance_type),
('NUTRX', NUTRX_Class_),#.class_type.instance_type),
('PLANK', PLANK_Class_),#.class_type.instance_type),
('PHCARB', PHCARB_Class_),#.class_type.instance_type),
('AFACT', nb.float64),
('ALK', nb.float64[:]),
('AVDEP', nb.float64[:]),
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
Loading