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

Fixes for shapely and scipy updates #174

Merged
merged 26 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f7472b4
Remove duplicate install of testing dependencies
mdpiper Oct 2, 2024
748605a
Require latest version of model_metadata
mdpiper Oct 2, 2024
e6d10fa
Remove obsolete esmpy requirement
mdpiper Oct 2, 2024
bfb47fc
Don't install components for testing
mdpiper Oct 2, 2024
3a0c43b
import UnitSystem from gimli.units
mcflugen Oct 3, 2024
ce9508f
remove redundant gimli.units unit tests
mcflugen Oct 3, 2024
556183d
checkout gimli.units raises UdunitsError
mcflugen Oct 3, 2024
4d00331
Consolidate requirements in one install step
mdpiper Oct 7, 2024
dcc0514
Fix typos
mdpiper Oct 7, 2024
55ea7d1
Roll back model_metadata for older models
mdpiper Oct 8, 2024
4209cb2
Remove shapely version cap
mdpiper Oct 8, 2024
93519d5
Convert shapely proxy object to geometries
mdpiper Oct 8, 2024
54db6ab
Remove scipy version cap
mdpiper Oct 8, 2024
ac77490
Mark fail when extrapolating with previous and next methods
mdpiper Oct 8, 2024
feef80e
Check for AssertionError instead of ValueError
mdpiper Oct 8, 2024
e68392b
Revert "Don't install components for testing"
mdpiper Oct 8, 2024
0de19e9
Merge branch 'master' into mdpiper/fixes-for-shapely-and-scipy-updates
mdpiper Oct 10, 2024
9e8e331
Limit numpy<2
mdpiper Oct 10, 2024
ad59ace
Set numpy print options to legacy=1.21
mdpiper Oct 10, 2024
4d00e8d
Add python=3.11 to tests
mdpiper Oct 10, 2024
18c4cde
Switch from Mambaforge to Miniforge
mdpiper Oct 10, 2024
3958c95
Switch from mamba to conda
mdpiper Oct 10, 2024
3b50477
Update versions of packaged actions
mdpiper Oct 10, 2024
94faa80
install requirements with pip
mcflugen Oct 11, 2024
8c8664b
turn off fail-fast
mcflugen Oct 11, 2024
481f678
switch back to conda to install requirements
mcflugen Oct 11, 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
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: psf/black@stable
with:
options: "--check --verbose --diff"
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,20 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
python-version: 3.8

- name: Show conda installation info
run: |
mamba info
mamba list
conda info
conda list

- name: Install dependencies
run: |
mamba install --file=requirements.txt --file=requirements-docs.txt gimli.units
conda install --file=requirements.txt --file=requirements-docs.txt gimli.units
pip install -e .

- name: Build documentation
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
python-version: ${{ matrix.python-version }}

- name: Show conda installation info
run: |
mamba info
mamba list
conda info
conda list

- name: Install requirements
run: |
mamba install \
conda install \
--file=requirements.txt \
--file=requirements-testing.txt \
--file=requirements-notebooks.txt
mamba list
conda list

- name: Build and install package
run: |
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ jobs:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
python-version: ${{ matrix.python-version }}

- name: Show conda installation info
run: |
mamba info
mamba list
conda info
conda list

- name: Install requirements
run: |
mamba install --file=requirements.txt --file=requirements-testing.txt
mamba list
conda install --file=requirements.txt --file=requirements-testing.txt
conda list

# - name: Install Windows requirements
# if: matrix.os == 'windows-latest'
# run: |
# mamba install pymt_child pymt_hydrotrend pymt_permamodel
- name: Install Windows requirements
if: matrix.os == 'windows-latest'
run: |
conda install pymt_child pymt_hydrotrend pymt_permamodel

# - name: Install Unix requirements
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
# run: |
# mamba install pymt_cem pymt_child pymt_hydrotrend pymt_permamodel
- name: Install Unix requirements
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
conda install pymt_cem pymt_child pymt_hydrotrend pymt_permamodel

- name: Build and install package
run: |
Expand Down
3 changes: 3 additions & 0 deletions pymt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import numpy as np
from gimli.units import UnitSystem

from ._version import __version__
from .model_collection import ModelCollection

np.set_printoptions(legacy="1.21")

MODELS = ModelCollection()

__all__ = ["__version__", "UnitSystem", "MODELS"]
8 changes: 4 additions & 4 deletions pymt/grids/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"""

from shapely.geometry import Point, asLineString, asPoint, asPolygon
from shapely.geometry import Point, LineString, Polygon

from pymt.grids import (
Rectilinear,
Expand Down Expand Up @@ -84,11 +84,11 @@ def __init__(self, *args, **kwargs):

(x, y) = (point_x.take(cell), point_y.take(cell))
if len(x) > 2:
self._polys.append(asPolygon(zip(x, y)))
self._polys.append(Polygon(zip(x, y)))
elif len(x) == 2:
self._polys.append(asLineString(zip(x, y)))
self._polys.append(LineString(zip(x, y)))
else:
self._polys.append(asPoint(zip(x, y)))
self._polys.append(Point(zip(x, y)))

def get_shared_cells(self, point_id):
"""
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ landlab>=2
matplotlib
model_metadata<0.8
netcdf4
numpy<2 # see #173
pyyaml
scipy<1.9 # see #162
shapely<2 # see #164
scipy
shapely
xarray
# cfunits
# esmpy
4 changes: 3 additions & 1 deletion tests/framework/test_timeinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_timeinterp():

def test_timeinterp_with_scalars():
interp = TimeInterpolator(((0.0, 1.0),))
with raises(ValueError):
with raises(AssertionError):
assert interp(0.5) == approx(1.5)
interp.add_data(((1.0, 2.0),))
assert interp(0.5) == approx(1.5)
Expand Down Expand Up @@ -81,6 +81,7 @@ def test_interp_between_points(method):


@pytest.mark.parametrize("method", TimeInterpolator.METHODS)
@pytest.mark.xfail(condition="pytest.param('next')", raises=AssertionError)
def test_interp_outside_range(method):
interp = TimeInterpolator(
((0.0, 1.0), (1.0, 2.0), (2.0, 3.0), (3.0, 4.0)), method=method
Expand All @@ -89,6 +90,7 @@ def test_interp_outside_range(method):


@pytest.mark.parametrize("method", TimeInterpolator.METHODS)
@pytest.mark.xfail(condition="pytest.param('previous')", raises=AssertionError)
def test_interp_below_range(method):
interp = TimeInterpolator(
((0.0, 4.0), (1.0, 3.0), (2.0, 2.0), (3.0, 1.0)), method=method
Expand Down
Loading