Skip to content

Commit

Permalink
Merge pull request #34 from jrenaud90/dev
Browse files Browse the repository at this point in the history
v0.3.5 fixes issues introduced in v0.3.4
  • Loading branch information
jrenaud90 authored Apr 7, 2022
2 parents 0e5c179 + 7868bc1 commit 8feda4d
Show file tree
Hide file tree
Showing 40 changed files with 434 additions and 343 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,22 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install flake8
python -m pip install -r requirements.txt
- name: Lint with flake8
run: |
$CONDA/bin/conda install flake8
# stop the build if there are Python syntax errors or undefined names
$CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# 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
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Run a test suite with numba on to test functionality, no coverage.
test-numba:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: 0
strategy:
matrix:
group: [1, 2, 3, 4, 5]
Expand All @@ -41,10 +44,11 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install -r requirements.txt
- name: Run pytest
run: $CONDA/bin/pytest --splits 5 --group ${{ matrix.group }}
run: python -m pytest --splits 5 --group ${{ matrix.group }}

# Run a test suite with numba off to somewhat test functionality but more to get coverage.
test-no-numba:
Expand All @@ -62,10 +66,11 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install -r requirements.txt
- name: Run pytest
run: $CONDA/bin/pytest --cov=TidalPy --splits 5 --group ${{ matrix.group }}
run: python -m pytest --cov=TidalPy --splits 5 --group ${{ matrix.group }}
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand All @@ -84,14 +89,15 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install -r requirements.txt
- name: Download all artifacts
# Downloads coverage1, coverage2, etc.
uses: actions/download-artifact@v3
- name: Run coverage
run: |
$CONDA/bin/coverage combine coverage*/.coverage*
$CONDA/bin/coverage report --fail-under=50
$CONDA/bin/coverage xml
coverage combine coverage*/.coverage*
coverage report --fail-under=50
coverage xml
- uses: codecov/codecov-action@v3.0.0
29 changes: 16 additions & 13 deletions .github/workflows/push_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install flake8
python -m pip install -r requirements.txt
- name: Lint with flake8
run: |
$CONDA/bin/conda install flake8
# stop the build if there are Python syntax errors or undefined names
$CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# 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
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Run a test suite with numba off to somewhat test functionality but more to get coverage.
test-no-numba:
Expand All @@ -43,10 +44,11 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install -r requirements.txt
- name: Run pytest
run: $CONDA/bin/pytest --cov --splits 5 --group ${{ matrix.group }}
run: python -m pytest --cov=TidalPy --splits 5 --group ${{ matrix.group }}
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand All @@ -65,14 +67,15 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda env update --file environment.yml --name base
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-split
python -m pip install -r requirements.txt
- name: Download all artifacts
# Downloads coverage1, coverage2, etc.
uses: actions/download-artifact@v3
- name: Run coverage
run: |
$CONDA/bin/coverage combine coverage*/.coverage*
$CONDA/bin/coverage report --fail-under=50
$CONDA/bin/coverage xml
coverage combine coverage*/.coverage*
coverage report --fail-under=50
coverage xml
- uses: codecov/codecov-action@v3.0.0
3 changes: 2 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# TidalPy Major Change Log

### Version 0.3.5 Alpha (Spring 2022)

* Minor Changes
* Removed the soon-to-be deprecated np.float, np.complex, np.int references.
* Added a check to see if cartopy is installed before functions that depend on it are imported.
* Bug Fixes
* Fixed coverage problem with github actions.
* Fixed issue importing nbTuple.
* Fixed issues with GitHub actions and coverage.

### Version 0.3.4 Alpha (Winter/Spring 2022)

*Multilayer scripts based on 0.3.3 or earlier will likely break with this version!*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
"outputs": [],
"source": [
"N_range = np.logspace(0, 6, 20, dtype=np.int)\n",
"N_range = np.logspace(0, 6, 20, dtype=np.int32)\n",
"order_ls = {'-': 2, '--': 3, '-.': 4}\n",
"eccen_truncs = {'b': 2, 'g': 6, 'orange': 10, 'r': 20}\n",
"\n",
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<h1 align="center">TidalPy</h1>
<h3 align="center">v0.3 Alpha</h3>

<p align="center">
<a href="https://github.com/jrenaud90/TidalPy/actions/workflows/push_tests.yml?query=branch%3Amaster" /><img src="https://github.com/jrenaud90/TidalPy/actions/workflows/push_tests.yml/badge.svg?branch=master" /></a> <a href="https://codecov.io/gh/jrenaud90/TidalPy"><img src="https://codecov.io/gh/jrenaud90/TidalPy/branch/master/graph/badge.svg?token=35OY4ZLOA5"/></a><br />
<a href="https://mybinder.org/v2/gh/jrenaud90/TidalPy/master?filepath=%2FCookbooks%2F"><img src="https://mybinder.org/badge_logo.svg" /></a>
<a href="https://gitter.im/TidalPy/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge"><img src="https://badges.gitter.im/TidalPy/community.svg" /></a>
<h1 style="text-align: center">TidalPy</h1>
<h3 style="text-align: center">v0.3.5 Beta</h3>

<p style="text-align: center">
<a href="https://github.com/jrenaud90/TidalPy/actions/workflows/push_tests.yml?query=branch%3Amaster"><img src="https://github.com/jrenaud90/TidalPy/actions/workflows/push_tests.yml/badge.svg?branch=master" alt="Push Test Pass/Fail" /></a>
<a href="https://codecov.io/gh/jrenaud90/TidalPy"><img src="https://codecov.io/gh/jrenaud90/TidalPy/branch/master/graph/badge.svg?token=35OY4ZLOA5" alt="Code Coverage"/></a><br />
<a href="https://mybinder.org/v2/gh/jrenaud90/TidalPy/master?filepath=%2FCookbooks%2F"><img src="https://mybinder.org/badge_logo.svg" alt="Binder" /></a>
<a href="https://gitter.im/TidalPy/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge"><img src="https://badges.gitter.im/TidalPy/community.svg" alt="Gitter" /></a>
</p>

## Purpose
Expand Down Expand Up @@ -78,6 +79,11 @@ following in a terminal:
However, there can be several gotchas that come with this simple installation process. It is recommended to use the
advanced installation described in the next section.

_Note: As of TidalPy v0.3.4, if you do not install via anaconda then you will need to manually install
[proj v8.0.0+](https://proj.org/install.html) and [geos 3.7.2+](https://anaconda.org/conda-forge/geos)
(before installing TidalPy. Otherwise, the project map graphic utility may not work.
[Read more here](https://scitools.org.uk/cartopy/docs/latest/installing.html)_

### Advanced Installation

It is highly recommended that you use the [Anaconda](https://www.anaconda.com/distribution/) distribution of Python.
Expand Down
26 changes: 13 additions & 13 deletions Tests/Test_SetB_Package/test_c_tools_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

def test_sec2myr():
# Build arrays for testing
zero_array = np.zeros(10, dtype=np.float)
one_array = np.ones(10, dtype=np.float)
sec_array = 3.154e13 * np.ones(10, dtype=np.float)
zero_array = np.zeros(10, dtype=np.float64)
one_array = np.ones(10, dtype=np.float64)
sec_array = 3.154e13 * np.ones(10, dtype=np.float64)

# Test sec2myr - Floats
assert sec2myr(0.) == 0.
Expand All @@ -43,9 +43,9 @@ def test_sec2myr():

def test_Au2m():
# Build arrays for testing
zero_array = np.zeros(10, dtype=np.float)
one_array = np.ones(10, dtype=np.float)
meter_array = 1.496e11 * np.ones(10, dtype=np.float)
zero_array = np.zeros(10, dtype=np.float64)
one_array = np.ones(10, dtype=np.float64)
meter_array = 1.496e11 * np.ones(10, dtype=np.float64)

# Test m2Au - Floats
assert m2Au(0.) == 0.
Expand All @@ -71,10 +71,10 @@ def test_Au2m():
def test_rads2days():
# Build arrays for testing
day_to_radians = 2. * np.pi / 86400.
zero_array = np.zeros(10, dtype=np.float)
inf_array = np.inf * np.ones(10, dtype=np.float)
one_array = np.ones(10, dtype=np.float)
radian_array = day_to_radians * np.ones(10, dtype=np.float)
zero_array = np.zeros(10, dtype=np.float64)
inf_array = np.inf * np.ones(10, dtype=np.float64)
one_array = np.ones(10, dtype=np.float64)
radian_array = day_to_radians * np.ones(10, dtype=np.float64)

# Test rads2days - Floats
with pytest.raises(ZeroDivisionError) as e_info:
Expand Down Expand Up @@ -106,9 +106,9 @@ def test_semi_a2orbital_motion():
sun_mass = 1.988435e30 # kg
earth_orb_motion = (G * (earth_mass + sun_mass) / earth_distance**3)**(1 / 2) # radians second-1

zero_array = np.zeros(10, dtype=np.float)
distance_array = earth_distance * np.ones(10, dtype=np.float)
frequency_array = earth_orb_motion * np.ones(10, dtype=np.float)
zero_array = np.zeros(10, dtype=np.float64)
distance_array = earth_distance * np.ones(10, dtype=np.float64)
frequency_array = earth_orb_motion * np.ones(10, dtype=np.float64)

# Test semi_a2orbital_motion - Floats
with pytest.raises(ZeroDivisionError) as e_info:
Expand Down
6 changes: 3 additions & 3 deletions Tests/Test_SetB_Package/test_c_tools_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def test_convert_hms():
assert type(result) == tuple

day, hour, minute, second = result
assert type(day) in [int, np.int, np.int32]
assert type(hour) in [int, np.int, np.int32]
assert type(minute) in [int, np.int, np.int32]
assert type(day) in [int, np.int32]
assert type(hour) in [int, np.int32]
assert type(minute) in [int, np.int32]
assert type(second) in [float, np.float64]

assert day == 0
Expand Down
8 changes: 4 additions & 4 deletions Tests/Test_SetB_Package/test_h_voxel_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def test_voxel_volume_numpy():
""" Test the voxel volume calculation using the numpy version of the func.
Check that the results match expectations. """

radius_array = np.linspace(0., planet_radius, 50)
radius_array = np.linspace(0., planet_radius, 20)
longitude_array_deg = np.linspace(0., 360., 20)
colatitude_array_deg = np.linspace(0., 180., 25)
colatitude_array_deg = np.linspace(0., 180., 20)
longitude_array = np.radians(longitude_array_deg)
colatitude_array = np.radians(colatitude_array_deg)

Expand All @@ -63,8 +63,8 @@ def test_voxel_volume_numba_higherN():
""" See if using a higher N will result in better results. """

radius_array = np.linspace(0., planet_radius, 400)
longitude_array_deg = np.linspace(0., 360., 400)
colatitude_array_deg = np.linspace(0., 180., 400)
longitude_array_deg = np.linspace(0., 360., 100)
colatitude_array_deg = np.linspace(0., 180., 100)
longitude_array = np.radians(longitude_array_deg)
colatitude_array = np.radians(colatitude_array_deg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ def test_single_disp_arrays():
assert result[0].dtype in [float, np.float64]
assert result[0].shape == (10,)
assert type(result[1]) == np.ndarray
assert result[1].dtype in [float, np.float, np.float64]
assert result[1].dtype in [float, np.float64]
assert result[1].shape == (10,)
10 changes: 5 additions & 5 deletions Tests/Test_SetF_Functional/Test_Integrate/test_RK_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def diffeq(t, y):
assert success
assert type(message) == str
assert type(ts) == np.ndarray
assert ts.dtype in (float, np.float, np.float64)
assert ts.dtype in (float, np.float64)
assert type(ys) == np.ndarray
assert ys.dtype in (complex, np.complex128)
np.testing.assert_almost_equal(ts[0], t_span[0])
Expand Down Expand Up @@ -264,9 +264,9 @@ def diffeq(t, z):
assert success
assert type(message) == str
assert type(ts) == np.ndarray
assert ts.dtype in (float, np.float, np.float64)
assert ts.dtype in (float, np.float64)
assert type(ys) == np.ndarray
assert ys.dtype in (float, np.float, np.float64)
assert ys.dtype in (float, np.float64)
np.testing.assert_almost_equal(ts[0], t_span[0])
np.testing.assert_almost_equal(ts[-1], t_span[-1])
assert ys.shape[0] == 2
Expand Down Expand Up @@ -303,9 +303,9 @@ def diffeq(t, z):
assert success
assert type(message) == str
assert type(ts) == np.ndarray
assert ts.dtype in (float, np.float, np.float64)
assert ts.dtype in (float, np.float64)
assert type(ys) == np.ndarray
assert ys.dtype in (float, np.float, np.float64)
assert ys.dtype in (float, np.float64)
np.testing.assert_almost_equal(ts[0], t_span[0])
np.testing.assert_almost_equal(ts[-1], t_span[-1])
assert ys.shape[0] == 2
Expand Down
Loading

0 comments on commit 8feda4d

Please sign in to comment.