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

Upgrade NumPy and python #83

Merged
merged 40 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cde1ce3
remove nan nodes of poly from edges
alcoat Jun 24, 2022
cc1e465
remove nan from nodes for in_poly2
alcoat Jun 24, 2022
6ec738b
fix E261
alcoat Jun 24, 2022
f3c15e9
reformat with black
alcoat Jun 24, 2022
2a4543d
doc after black
alcoat Jun 24, 2022
7e66133
Update testing.yml
alcoat Jun 25, 2022
21981ce
Update testing.yml
alcoat Jun 25, 2022
a5018b8
upgrade black 22.3.0
alcoat Jun 25, 2022
a7d9977
try rasterio>=1.3a1 for python 3.10
alcoat Jun 26, 2022
5a3d009
apply black to setup.py
alcoat Jun 26, 2022
f41fd71
Update README.md
Jun 26, 2022
b4c1c81
remove duplicate points from Shoreline
alcoat Jun 28, 2022
169930e
better nan removal
alcoat Jun 29, 2022
78b1193
more explict edges buildind
alcoat Jun 29, 2022
1afbfa6
remove stray print statement
Jun 29, 2022
e11d3f3
Merge branch 'CHLNDDEV:master' into master
alcoat Jun 29, 2022
8a5d72b
Merge branch 'CHLNDDEV:master' into master
alcoat May 22, 2023
44fb981
Merge branch 'CHLNDDEV:master' into master
alcoat Oct 19, 2023
5551f8e
Merge branch 'CHLNDDEV:master' into master
alcoat Dec 10, 2023
a2f7eeb
Merge branch 'CHLNDDEV:master' into master
alcoat Jan 13, 2024
3576be6
Merge branch 'CHLNDDEV:master' into master
alcoat Apr 25, 2024
12ce85f
update python version
alcoat Jan 8, 2025
27511a1
Update testing.yml
alcoat Jan 8, 2025
3f02702
Add fiona
alcoat Jan 8, 2025
82a2869
keep python 3.8
alcoat Jan 8, 2025
1dc56c6
fix black format
alcoat Jan 8, 2025
8122f62
numpy deprecated
alcoat Jan 8, 2025
dbe55cc
fix black
alcoat Jan 8, 2025
9e8734c
back to np.character
alcoat Jan 11, 2025
0dc55d0
back to np.character
alcoat Jan 11, 2025
145c99c
black
alcoat Jan 11, 2025
ca9726d
change dtype
alcoat Jan 12, 2025
9d6c361
upgrade target version
alcoat Jan 12, 2025
3f35bb6
remove depracated np.matrix
alcoat Jan 12, 2025
a496420
numpy 2 compat
alcoat Jan 12, 2025
add3127
adjust python3.8 requirements
alcoat Jan 12, 2025
28e2009
black
alcoat Jan 12, 2025
68a379b
adjust requirements
alcoat Jan 12, 2025
7b91a53
fix requirements
alcoat Jan 12, 2025
214f8cd
Remove python 3.12
alcoat Jan 12, 2025
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/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.9"
- uses: actions/checkout@v2
- name: Lint with flake8
run: |
Expand All @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, '3.10' ]
python-version: [ 3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion oceanmesh/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def _closest_node(node, nodes):
L[L < eps] = eps
L = L[:, None]
for it in range(max_iter):
pnew = np.divide(S * np.matrix(vertices), np.hstack((W, W)))
pnew = np.divide(S @ np.array(vertices), np.hstack((W, W)))
pnew[bnd, :] = vertices[bnd, :]
vertices = pnew
Lnew = np.sqrt(
Expand Down
2 changes: 1 addition & 1 deletion oceanmesh/edgefx.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import numpy as np
import scipy.spatial
import skfmm
from _HamiltonJacobi import gradient_limit
from inpoly import inpoly2
from shapely.geometry import LineString
from skimage.morphology import medial_axis

from _HamiltonJacobi import gradient_limit
from oceanmesh.filterfx import filt2

from . import edges
Expand Down
4 changes: 3 additions & 1 deletion oceanmesh/fix_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ def unique_rows(A, return_index=False, return_inverse=False):

orig_dtype = A.dtype
ncolumns = A.shape[1]
dtype = np.dtype((np.character, orig_dtype.itemsize * ncolumns))
dtype = np.dtype((f"S{orig_dtype.itemsize * ncolumns}"))
B, I, J = np.unique(A.view(dtype), return_index=True, return_inverse=True)
# NUMPY 2 compatibility
J = J.reshape(-1)

B = B.view(orig_dtype).reshape((-1, ncolumns), order="C")

Expand Down
8 changes: 4 additions & 4 deletions oceanmesh/geodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def _read(self):
raise ValueError(f"Unsupported geometry type: {g.geom_type}")

poly = remove_dup(poly)
polys.append(np.row_stack((poly, delimiter)))
polys.append(np.vstack((poly, delimiter)))

if len(polys) == 0:
raise ValueError("Shoreline data does not intersect with bbox")
Expand Down Expand Up @@ -794,9 +794,9 @@ def __init__(self, dem, crs="EPSG:4326", bbox=None, extrapolate=False):
topobathy = np.transpose(topobathy, (1, 0))
# Ensure its a floating point array
topobathy = topobathy.astype(np.float64)
topobathy[
topobathy == nodata_value
] = np.nan # set the no-data value to nan
topobathy[topobathy == nodata_value] = (
np.nan
) # set the no-data value to nan
elif not dem.exists():
raise FileNotFoundError(f"File {dem} could not be located.")

Expand Down
1 change: 1 addition & 0 deletions oceanmesh/idw.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" invdisttree.py: inverse-distance-weighted interpolation using KDTree
fast, solid, local
"""

from __future__ import division

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion oceanmesh/mesh_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import matplotlib.tri as tri
import numpy as np
import scipy.sparse as spsparse

from _delaunay_class import DelaunayTriangulation as DT
from _fast_geometry import unique_edges

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requires = ["setuptools>=42", "wheel", "pybind11>=2.6.0", "versioneer-518"]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ['py37']
target-version = ['py39']
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_requires =
pyproj
scipy
geopandas
fiona
shapely
matplotlib
rasterio>=1.3a1
Expand Down
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import configparser

from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup # , find_packages
Expand Down Expand Up @@ -44,8 +45,26 @@
cmdclass = versioneer.get_cmdclass()
cmdclass.update({"build_ext": build_ext})


def get_requirements():
"""
Fix
"""

config = configparser.ConfigParser()
config.read("setup.cfg")
requirements = config["options"]["install_requires"].split()

if sys.version_info < (3, 9):
requirements.remove("fiona")
requirements.append("fiona<1.10")

return requirements


if __name__ == "__main__":
setup(
install_requires=get_requirements(),
cmdclass=cmdclass,
version=versioneer.get_version(),
ext_modules=ext_modules,
Expand Down
1 change: 1 addition & 0 deletions tests/test_bathymetric_gradient_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import pytest

import oceanmesh as om

fname = os.path.join(os.path.dirname(__file__), "GSHHS_i_L1.shp")
Expand Down
Loading