diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1bd773e --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/CreateVariableFiles.py b/CreateVariableFiles.py index f8bbc35..42303ec 100644 --- a/CreateVariableFiles.py +++ b/CreateVariableFiles.py @@ -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) diff --git a/gwlfe/DailyArrayConverter.py b/gwlfe/DailyArrayConverter.py index 4e6709c..cf48e64 100644 --- a/gwlfe/DailyArrayConverter.py +++ b/gwlfe/DailyArrayConverter.py @@ -1,5 +1,6 @@ import random +import numpy as np import numpy.ma as ma # from numba import jit from numpy import array @@ -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))