Skip to content

Commit

Permalink
Merge pull request #56 from noaa-ocs-modeling/depend/python
Browse files Browse the repository at this point in the history
Bump Python version
  • Loading branch information
SorooshMani-NOAA authored Jan 18, 2023
2 parents b138502 + 3b4b38f commit 1fe13b0
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/functional_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]

steps:
- uses: actions/checkout@v2
Expand All @@ -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 .
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/functional_test_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]

steps:
- name: Checkout
Expand All @@ -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 .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.7', '3.8', '3.9' ]
python-version: [ '3.10' ]
steps:
- name: checkout repository
uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ name: ocsmesh
channels:
- conda-forge
dependencies:
- python
- python>=3.8, <3.11 # 3.11 not supported by numba
- gdal
- geos
- proj
- netcdf4
- udunits2
- pyproj
- shapely>=1.8
- shapely>=1.8, <2
- rasterio
- fiona
- 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
Expand Down
6 changes: 3 additions & 3 deletions ocsmesh/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)] # ??
Expand All @@ -2089,15 +2089,15 @@ 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
)
# Pick nodes NOT "contaminated" by masked values
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
)
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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, <3.11' # 3.11 no supported by numba
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"]
Expand Down
8 changes: 4 additions & 4 deletions tests/api/hfun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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):
Expand All @@ -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)


Expand All @@ -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):
Expand Down

0 comments on commit 1fe13b0

Please sign in to comment.