From c6cc034d5ecf60652edaed44699037287d31ae62 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Fri, 13 Jan 2023 14:01:17 -0500 Subject: [PATCH 01/12] Remove py3.7 add 3.10 and 3.11 --- .github/workflows/documentation.yml | 2 +- .github/workflows/functional_test.yml | 2 +- .github/workflows/functional_test_2.yml | 2 +- .github/workflows/pylint.yml | 2 +- .github/workflows/release.yml | 2 +- environment.yml | 2 +- pyproject.toml | 5 ++--- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 2d1c20ed..1ccdb95c 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -23,7 +23,7 @@ jobs: environment-file: ./environment.yml environment-name: ocsmesh-env extra-specs: | - python=3.9 + python=3.* - name: Install dependencies shell: bash -l {0} run: | diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index b4095c63..bd962646 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.7', '3.8', '3.9' ] + python-version: [ '3.8', '3.9', '3.10', '3.11' ] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/functional_test_2.yml b/.github/workflows/functional_test_2.yml index 1039f8ba..cbf88dae 100644 --- a/.github/workflows/functional_test_2.yml +++ b/.github/workflows/functional_test_2.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9' ] + python-version: [ '3.8', '3.9', '3.10', '3.11' ] steps: - name: Checkout diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 744654eb..ace1b048 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -15,7 +15,7 @@ jobs: environment-file: ./environment.yml environment-name: ocsmesh-env extra-specs: | - python=3.9 + python=3.* - name: Install dependencies shell: bash -l {0} run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d69a172..541b1b2a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - python-version: [ '3.7', '3.8', '3.9' ] + python-version: [ ''3.8', '3.9', '3.10', '3.11' ] steps: - name: checkout repository uses: actions/checkout@v2 diff --git a/environment.yml b/environment.yml index 1ef5fb06..74860649 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: ocsmesh channels: - conda-forge dependencies: - - python + - python>=3.8, <4 - gdal - geos - proj diff --git a/pyproject.toml b/pyproject.toml index d5382878..577a687d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,13 +19,12 @@ maintainers = [ description = "Package to generate computational unstructured meshes from planetary modeling." license = {file = "LICENSE"} readme = "README.md" -requires-python = '>=3.7, <3.10' +requires-python = '>=3.8, <4' dependencies = [ "colored-traceback", "fiona", "geoalchemy2", "geopandas", "jigsawpy", "matplotlib", "netCDF4", "numba", "numpy>=1.21", # introduce npt.NDArray - "pyarrow", "pygeos", "pyproj>=3.0", "rasterio", "requests", - "scipy<1.8", # dropping python 3.7 + "pyarrow", "pygeos", "pyproj>=3.0", "rasterio", "requests", "scipy", "shapely>=1.8, <2", "tqdm", "typing_extensions", "utm", ] dynamic = ["version"] From ff9d46bd195c455e3d9757017478250c3ee4175b Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Fri, 13 Jan 2023 14:06:02 -0500 Subject: [PATCH 02/12] Fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 541b1b2a..04f10404 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - python-version: [ ''3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.8', '3.9', '3.10', '3.11' ] steps: - name: checkout repository uses: actions/checkout@v2 From 9c95c6f79a7ad841410bc85477271157ff4c683c Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Fri, 13 Jan 2023 14:35:43 -0500 Subject: [PATCH 03/12] Remove py3.11, add 3.* --- .github/workflows/functional_test.yml | 2 +- .github/workflows/functional_test_2.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index bd962646..5f313937 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.8', '3.9', '3.10', '3.*' ] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/functional_test_2.yml b/.github/workflows/functional_test_2.yml index cbf88dae..d0a6e676 100644 --- a/.github/workflows/functional_test_2.yml +++ b/.github/workflows/functional_test_2.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.8', '3.9', '3.10', '3.*' ] steps: - name: Checkout From f1b2e040a221adfed111b3ea7789135a38245ebf Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Fri, 13 Jan 2023 14:46:35 -0500 Subject: [PATCH 04/12] Remove py3.* due to numba issue with 3.11 --- .github/workflows/functional_test.yml | 2 +- .github/workflows/functional_test_2.yml | 2 +- .github/workflows/release.yml | 2 +- environment.yml | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index 5f313937..d11890d3 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.*' ] + python-version: [ '3.8', '3.9', '3.10' ] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/functional_test_2.yml b/.github/workflows/functional_test_2.yml index d0a6e676..b2862755 100644 --- a/.github/workflows/functional_test_2.yml +++ b/.github/workflows/functional_test_2.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.*' ] + python-version: [ '3.8', '3.9', '3.10' ] steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04f10404..57749ff2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.10' ] steps: - name: checkout repository uses: actions/checkout@v2 diff --git a/environment.yml b/environment.yml index 74860649..581e3112 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: ocsmesh channels: - conda-forge dependencies: - - python>=3.8, <4 + - python>=3.8, <3.11 # 3.11 not supported by numba - gdal - geos - proj diff --git a/pyproject.toml b/pyproject.toml index 577a687d..f817bd04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ maintainers = [ description = "Package to generate computational unstructured meshes from planetary modeling." license = {file = "LICENSE"} readme = "README.md" -requires-python = '>=3.8, <4' +requires-python = '>=3.8, <3.11' # 3.11 no supported by numba dependencies = [ "colored-traceback", "fiona", "geoalchemy2", "geopandas", "jigsawpy", "matplotlib", "netCDF4", "numba", From 75dca81a3230df4f13e6603dd2352452ef3c63f9 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Fri, 13 Jan 2023 15:21:52 -0500 Subject: [PATCH 05/12] Update conda dependencies --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 581e3112..261a3d87 100644 --- a/environment.yml +++ b/environment.yml @@ -15,9 +15,9 @@ dependencies: - pygeos - geopandas - utm - - scipy<1.8 + - scipy - numba - - numpy>=1.21,<1.23 # numpy.typing, scipy 1.7.x support + - numpy>=1.21 # numpy.typing - matplotlib - requests - tqdm From 4e76d4b9c824869a3dadec9e5077bc979a3d8afe Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 10:38:06 -0500 Subject: [PATCH 06/12] Fix interpolation issue with contiguouness of constructor grid --- ocsmesh/mesh/mesh.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ocsmesh/mesh/mesh.py b/ocsmesh/mesh/mesh.py index 7905160b..ea8e2e96 100644 --- a/ocsmesh/mesh/mesh.py +++ b/ocsmesh/mesh/mesh.py @@ -2078,7 +2078,7 @@ def _mesh_interpolate_worker( if method == 'spline': f = RectBivariateSpline( xi, - np.flip(yi), + np.ascontiguousarray(np.flip(yi)), np.flipud(zi).T, kx=3, ky=3, s=0, # bbox=[min(x), max(x), min(y), max(y)] # ?? @@ -2089,7 +2089,7 @@ def _mesh_interpolate_worker( # Inspired by StackOverflow 35807321 if np.any(zi.mask): m_interp = RegularGridInterpolator( - (xi, np.flip(yi)), + (xi, np.ascontiguousarray(np.flip(yi))), np.flipud(zi.mask).T.astype(bool), method=method ) @@ -2097,7 +2097,7 @@ def _mesh_interpolate_worker( interp_mask = m_interp(coords[_idxs]) > 0 f = RegularGridInterpolator( - (xi, np.flip(yi)), + (xi, np.ascontiguousarray(np.flip(yi))), np.flipud(zi).T, method=method ) From 0129f1022345efe62c4c51552e0b20f0d6903c84 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 10:39:15 -0500 Subject: [PATCH 07/12] Fix shapely version to be below 2 --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 261a3d87..a0c2d3a0 100644 --- a/environment.yml +++ b/environment.yml @@ -9,7 +9,7 @@ dependencies: - netcdf4 - udunits2 - pyproj - - shapely>=1.8 + - shapely>=1.8, <2 - rasterio - fiona - pygeos From 541646b96d9f585d04c326c9d2554f6fb0383353 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 10:58:25 -0500 Subject: [PATCH 08/12] Fix issue due to jigsawpy dependency --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f817bd04..0e92c4db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ dependencies = [ "colored-traceback", "fiona", "geoalchemy2", "geopandas", "jigsawpy", "matplotlib", "netCDF4", "numba", "numpy>=1.21", # introduce npt.NDArray + "packagin", # required by jigsawpy "pyarrow", "pygeos", "pyproj>=3.0", "rasterio", "requests", "scipy", "shapely>=1.8, <2", "tqdm", "typing_extensions", "utm", ] From c8aa0515124fac73cc30701d5f2feecb9df68d83 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 13:06:16 -0500 Subject: [PATCH 09/12] Fix typo! --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0e92c4db..cdc0f7fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ "colored-traceback", "fiona", "geoalchemy2", "geopandas", "jigsawpy", "matplotlib", "netCDF4", "numba", "numpy>=1.21", # introduce npt.NDArray - "packagin", # required by jigsawpy + "packaging", # required by jigsawpy "pyarrow", "pygeos", "pyproj>=3.0", "rasterio", "requests", "scipy", "shapely>=1.8, <2", "tqdm", "typing_extensions", "utm", ] From 5583052ccf1f954bb887ac0ddc6ba69d79464a17 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 13:32:25 -0500 Subject: [PATCH 10/12] Attempt 2 to fix jigsaw dependency! --- .github/workflows/functional_test.yml | 1 + .github/workflows/functional_test_2.yml | 1 + pyproject.toml | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index d11890d3..064f967a 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -28,6 +28,7 @@ jobs: - name: Install other dependencies shell: bash -l {0} run: | + pip install packaging # jigsaw dependency in its setup.py python ./setup.py install_jigsaw pip install . diff --git a/.github/workflows/functional_test_2.yml b/.github/workflows/functional_test_2.yml index b2862755..324cbdbb 100644 --- a/.github/workflows/functional_test_2.yml +++ b/.github/workflows/functional_test_2.yml @@ -31,6 +31,7 @@ jobs: - name: Install packages shell: bash -l {0} run: | + pip install packaging # jigsaw dependency in its setup.py python ./setup.py install_jigsaw pip install . diff --git a/pyproject.toml b/pyproject.toml index cdc0f7fa..f817bd04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ dependencies = [ "colored-traceback", "fiona", "geoalchemy2", "geopandas", "jigsawpy", "matplotlib", "netCDF4", "numba", "numpy>=1.21", # introduce npt.NDArray - "packaging", # required by jigsawpy "pyarrow", "pygeos", "pyproj>=3.0", "rasterio", "requests", "scipy", "shapely>=1.8, <2", "tqdm", "typing_extensions", "utm", ] From 50ac831f892fbb09613912a417f90dfbd5afb7c7 Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 16:57:20 -0500 Subject: [PATCH 11/12] Update test since jigsaw size enforcement has changed --- tests/api/hfun.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/api/hfun.py b/tests/api/hfun.py index 98030d7f..9f81f28f 100755 --- a/tests/api/hfun.py +++ b/tests/api/hfun.py @@ -565,7 +565,7 @@ def _check_applied_refinement(self, msh_t, refine_gdf, target_size): rest_msh_t.size_from_mesh() rest_avg = np.mean(rest_msh_t.msh_t().value) - self.assertTrue(np.isclose(refine_avg, target_size, rtol=1e-1)) + self.assertTrue(np.isclose(refine_avg, target_size, rtol=3e-1)) self.assertTrue(rest_avg > target_size * 10) def _is_refined_by_shape1(self, hfun, target_size): @@ -576,7 +576,7 @@ def _is_refined_by_shape1(self, hfun, target_size): gdf_feature = gpd.GeoDataFrame( geometry=[self.shape1], crs=4326 ) - gdf_clip = gdf_feature.to_crs(hfun_msh_t.crs).buffer(target_size) + gdf_clip = gdf_feature.to_crs(hfun_msh_t.crs).buffer(target_size*1.1) self._check_applied_refinement(hfun_msh_t, gdf_clip, target_size) @@ -586,7 +586,7 @@ def _is_refined_by_feat1(self, hfun, target_size): # Nodes close to the feature line must be small gdf_feature = gpd.read_file(self.feat1) - gdf_clip = gdf_feature.to_crs(hfun_msh_t.crs).buffer(target_size) + gdf_clip = gdf_feature.to_crs(hfun_msh_t.crs).buffer(target_size*1.1) self._check_applied_refinement(hfun_msh_t, gdf_clip, target_size) def _is_refined_by_feat2(self, hfun, target_size): From 3b4b38f4144c2e57706f59f48a719fd2476590cc Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Tue, 17 Jan 2023 17:21:50 -0500 Subject: [PATCH 12/12] Increase error tolerance for test due to changes in Jigsaw --- tests/api/hfun.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/api/hfun.py b/tests/api/hfun.py index 9f81f28f..900c8e4a 100755 --- a/tests/api/hfun.py +++ b/tests/api/hfun.py @@ -410,7 +410,7 @@ def test_hfun_coll_cfl_constraint(self): # Fast method is much less accurate! method_tolerance = { 'exact': 0.03, - 'fast': 0.1 + 'fast': 0.2 } for method, tol in method_tolerance.items():