Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadain committed Dec 29, 2021
2 parents 59508ea + 62bb102 commit f3a08e4
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 224 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint for Python 3.9
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# 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 nosetests
run: |
nosetests --verbosity=2
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 3.1.0

- Fix SummaryLoad outputs to include "Low-Density Open Space", and exclude
"Other Upland Areas"

## 3.0.0

- Official Release. No changes since `3.0.0-beta`.

## 3.0.0-beta

- **BREAKING** Drop support for Python 2.7
Expand Down
2 changes: 1 addition & 1 deletion CreateVariableFiles.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os


variable_name = raw_input("Enter the name of the variable:")
variable_name = input("Enter the name of the variable:")

#write variable file
var_filename = "%s.py"%(variable_name)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ Ensure you have Python 3.9 and [pipenv](https://pipenv.pypa.io/en/latest/) avail
$ pipenv sync
```

### Running Locally

```bash
$ pipenv run ./run.py --json test/integrationtests/input_4_output.json test/integrationtests/input_4.gms
```

### Testing

```bash
Expand Down
3 changes: 2 additions & 1 deletion gwlfe/DailyArrayConverter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import random

import numpy as np
import numpy.ma as ma
# from numba import jit
from numpy import array
Expand Down Expand Up @@ -63,7 +64,7 @@


def mask_builder(DaysMonth):
ones = ravel(ones((12, 31))).astype("int")
ones = ravel(np.ones((12, 31))).astype("int")
slices = []
for i, month in enumerate(DaysMonth[0]):
slices.append(slice(31 * i, 31 * i + month))
Expand Down
5 changes: 4 additions & 1 deletion gwlfe/WriteOutputFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,10 @@ def WriteOutput(z):
SumWxYrEnd = z.WxYrEnd

# Which land use sources to include in the totals.
sources = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
# These are indices of this array: https://github.com/WikiWatershed/model-my-watershed/blob/415be752ea7b66ae5e1d15afe1a11cf4051dbd5e/src/mmw/mmw/settings/gwlfe_settings.py#L23-L39
# This list matches the land type in the Loads list below
# 13 was added and 4, 5, 9 removed in https://github.com/WikiWatershed/gwlf-e/pull/84
sources = (0, 1, 2, 3, 6, 7, 8, 10, 11, 12, 13)

# ha
AreaTotal = sum(z.Area[l] for l in sources)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = [
"setuptools>=42",
"wheel>=0.31",
"twine>=1.11",
'numba==0.54.0',
]
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main():

if (args.json != None):
with open(args.json, "w") as file:
json.dump(result, file, indent=2, sort_keys=True)
json.dump(result, file, indent=4, sort_keys=True)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

setup(
name='gwlf-e',
version='3.0.0',
version='3.1.0',
description='A Python port of Generalized Watersheds Loading Functions - Enhanced (MapShed)',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down
Loading

0 comments on commit f3a08e4

Please sign in to comment.