Skip to content

Commit 5b2f6ff

Browse files
authored
* check mask AntSimi#145 * update python version for doc * switch order in requirement * fix pint version
1 parent af0d6af commit 5b2f6ff

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
# os: [ubuntu-latest, macos-latest, windows-latest]
1313
os: [ubuntu-latest, windows-latest]
14-
python_version: [3.7, 3.8, 3.9]
14+
python_version: [3.7, 3.8, 3.9, '3.10']
1515
name: Run py eddy tracker build tests
1616
runs-on: ${{ matrix.os }}
1717
defaults:

doc/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ channels:
22
- conda-forge
33
- defaults
44
dependencies:
5-
- python=3.8
5+
- python=3.10
66
- ffmpeg
77
- pip:
88
- sphinx-gallery

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
matplotlib
2-
netCDF4
3-
numba>=0.53
4-
numpy<1.21
52
opencv-python
6-
pint
3+
pint==0.18
74
polygon3
85
pyyaml
96
requests
107
scipy
118
zarr
9+
netCDF4<1.6
10+
numpy<1.23
11+
numba<0.56

src/py_eddy_tracker/dataset/grid.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,14 @@ def load(self):
402402

403403
self.setup_coordinates()
404404

405+
@staticmethod
406+
def get_mask(a):
407+
if len(a.mask.shape):
408+
m = a.mask
409+
else:
410+
m = ones(a.shape, dtype='bool') if a.mask else zeros(a.shape, dtype='bool')
411+
return m
412+
405413
@staticmethod
406414
def c_to_bounds(c):
407415
"""
@@ -1126,7 +1134,7 @@ def _low_filter(self, grid_name, w_cut, factor=8.0):
11261134
bins = (x_array, y_array)
11271135

11281136
x_flat, y_flat, z_flat = x.reshape((-1,)), y.reshape((-1,)), data.reshape((-1,))
1129-
m = ~z_flat.mask
1137+
m = ~self.get_mask(z_flat)
11301138
x_flat, y_flat, z_flat = x_flat[m], y_flat[m], z_flat[m]
11311139

11321140
nb_value, _, _ = histogram2d(x_flat, y_flat, bins=bins)
@@ -1936,14 +1944,6 @@ def regrid(self, other, grid_name, new_name=None):
19361944
# self.variables_description[new_name]['infos'] = False
19371945
# self.variables_description[new_name]['kwargs']['dimensions'] = ...
19381946

1939-
@staticmethod
1940-
def get_mask(a):
1941-
if len(a.mask.shape):
1942-
m = a.mask
1943-
else:
1944-
m = ones(a.shape) if a.mask else zeros(a.shape)
1945-
return m
1946-
19471947
def interp(self, grid_name, lons, lats, method="bilinear"):
19481948
"""
19491949
Compute z over lons, lats

0 commit comments

Comments
 (0)