Skip to content

Commit 60a601d

Browse files
authored
Merge pull request #227 from GeoStat-Framework/meshio5.1_fix
Field: make Field.mesh compatible with meshio v5.1+
2 parents d8941c2 + 73c0de7 commit 60a601d

File tree

9 files changed

+31
-24
lines changed

9 files changed

+31
-24
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
fetch-depth: '0'
6767

6868
- name: Build wheels
69-
uses: pypa/cibuildwheel@v2.2.2
69+
uses: pypa/cibuildwheel@v2.3.1
7070
env:
7171
CIBW_ARCHS: ${{ matrix.cfg.arch }}
7272
with:

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to **GSTools** will be documented in this file.
44

55

6+
## [1.3.5] - Pure Pink - ?
7+
8+
### Bugfixes
9+
- `Field.mesh` was not compatible with [meshio](https://github.com/nschloe/meshio) v5.1+ [#227](https://github.com/GeoStat-Framework/GSTools/pull/227)
10+
11+
612
## [1.3.4] - Pure Pink - 2021-11
713

814
### Enhancements
@@ -321,7 +327,7 @@ See: [#197](https://github.com/GeoStat-Framework/GSTools/issues/197)
321327
First release of GSTools.
322328

323329

324-
[Unreleased]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.4...HEAD
330+
[1.3.5]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.4...HEAD
325331
[1.3.4]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.3...v1.3.4
326332
[1.3.3]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.2...v1.3.3
327333
[1.3.2]: https://github.com/GeoStat-Framework/gstools/compare/v1.3.1...v1.3.2

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ in memory for immediate 3D plotting in Python.
338338

339339
- [NumPy >= 1.14.5](https://www.numpy.org)
340340
- [SciPy >= 1.1.0](https://www.scipy.org/scipylib)
341-
- [hankel >= 1.0.2](https://github.com/steven-murray/hankel)
341+
- [hankel >= 1.0.0](https://github.com/steven-murray/hankel)
342342
- [emcee >= 3.0.0](https://github.com/dfm/emcee)
343343
- [pyevtk >= 1.1.1](https://github.com/pyscience-projects/pyevtk)
344-
- [meshio>=4.0.3, <5.0](https://github.com/nschloe/meshio)
344+
- [meshio >= 4.0.0](https://github.com/nschloe/meshio)
345345

346346
### Optional
347347

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,10 @@ Requirements
407407

408408
- `Numpy >= 1.14.5 <http://www.numpy.org>`_
409409
- `SciPy >= 1.1.0 <http://www.scipy.org>`_
410-
- `hankel >= 1.0.2 <https://github.com/steven-murray/hankel>`_
410+
- `hankel >= 1.0.0 <https://github.com/steven-murray/hankel>`_
411411
- `emcee >= 3.0.0 <https://github.com/dfm/emcee>`_
412412
- `pyevtk >= 1.1.1 <https://github.com/pyscience-projects/pyevtk>`_
413-
- `meshio>=4.0.3, <5.0 <https://github.com/nschloe/meshio>`_
413+
- `meshio >= 4.0.0 <https://github.com/nschloe/meshio>`_
414414

415415

416416
Optional

examples/03_variogram/01_find_best_model.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@
5555
###############################################################################
5656
# Create a ranking based on the score and determine the best models
5757

58-
ranking = [
59-
(k, v)
60-
for k, v in sorted(scores.items(), key=lambda item: item[1], reverse=True)
61-
]
62-
print("RANKING")
58+
ranking = sorted(scores.items(), key=lambda item: item[1], reverse=True)
59+
print("RANKING by Pseudo-r2 score")
6360
for i, (model, score) in enumerate(ranking, 1):
64-
print(i, model, score)
61+
print(f"{i:>6}. {model:>15}: {score:.5}")
6562

6663
plt.show()

examples/04_vector_field/01_3d_vector_field.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
###############################################################################
1818
# create a uniform grid with PyVista
19-
dim, spacing, origin = (40, 30, 10), (1, 1, 1), (-10, 0, 0)
20-
mesh = pv.UniformGrid(dim, spacing, origin)
19+
dims, spacing, origin = (40, 30, 10), (1, 1, 1), (-10, 0, 0)
20+
mesh = pv.UniformGrid(dims=dims, spacing=spacing, origin=origin)
2121

2222
###############################################################################
2323
# create an incompressible random 3d velocity field on the given mesh

gstools/field/tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
__all__ = ["fmt_mean_norm_trend", "to_vtk_helper", "generate_on_mesh"]
2323

2424

25+
MESHIO_VERSION = list(map(int, meshio.__version__.split(".")[:2]))
26+
27+
2528
def _fmt_func_val(f_cls, func_val): # pragma: no cover
2629
if func_val is None:
2730
return str(None)
@@ -190,7 +193,8 @@ def generate_on_mesh(
190193
raise ValueError("Field.mesh: mesh dimension too low!")
191194
pnts = np.empty((0, mesh_dim), dtype=np.double)
192195
for cell in mesh.cells:
193-
pnt = np.mean(mesh.points[cell[1]], axis=1)
196+
cell_points = cell[1] if MESHIO_VERSION < [5, 1] else cell.data
197+
pnt = np.mean(mesh.points[cell_points], axis=1)
194198
offset.append(pnts.shape[0])
195199
length.append(pnt.shape[0])
196200
pnts = np.vstack((pnts, pnt))

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ test-command = "pytest -v {package}/tests"
8181
test-skip = "*-macosx_arm64 *-macosx_universal2:arm64"
8282

8383
[[tool.cibuildwheel.overrides]]
84-
# use manylinux2014 for py3.10
85-
select = "cp310-*"
86-
manylinux-x86_64-image = "manylinux2014"
84+
select = "*manylinux_i686"
85+
# no wheels for 32 bit anymore
86+
before-test = "pip install 'numpy<1.22'"

setup.cfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ project_urls =
4747
[options]
4848
packages = find:
4949
install_requires =
50-
emcee>=3.0.0,<4
51-
hankel>=1.0.2,<2
52-
meshio>=4.0.3,<6
53-
numpy>=1.14.5,<2
54-
pyevtk>=1.1.1,<2
55-
scipy>=1.1.0,<2
50+
emcee>=3.0.0
51+
hankel>=1.0.0
52+
meshio>=4.0.0
53+
numpy>=1.14.5
54+
pyevtk>=1.1.1
55+
scipy>=1.1.0
5656
python_requires = >=3.6
5757
zip_safe = False
5858

0 commit comments

Comments
 (0)