Skip to content

Commit

Permalink
Merge pull request #584 from djhoese/bugfix-unstable-ci
Browse files Browse the repository at this point in the history
Add no build isolation to unstable CI installs
  • Loading branch information
djhoese authored Feb 16, 2024
2 parents df92fb9 + 9c94b08 commit 56da958
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ jobs:
if: matrix.experimental == true
shell: bash -l {0}
run: |
python -m pip install versioneer extension-helpers setuptools-scm configobj pkgconfig;
python -m pip install \
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \
--no-deps --pre --upgrade \
matplotlib \
numpy \
pandas \
scipy; \
mamba remove --force-remove -y pykdtree
python -m pip install \
--no-deps --upgrade \
--no-deps --upgrade --pre --no-build-isolation \
git+https://github.com/storpipfugl/pykdtree \
git+https://github.com/dask/dask \
git+https://github.com/dask/distributed \
git+https://github.com/zarr-developers/zarr \
Expand All @@ -64,11 +67,13 @@ jobs:
git+https://github.com/pydata/bottleneck \
git+https://github.com/pydata/xarray \
git+https://github.com/shapely/shapely;
python -m pip install -e . --no-deps --no-build-isolation;
- name: Install pyresample
if: matrix.experimental != true
shell: bash -l {0}
run: |
pip install --no-deps -e .
python -m pip install --no-deps -e .
- name: Run unit tests
shell: bash -l {0}
Expand Down
4 changes: 2 additions & 2 deletions pyresample/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def get_resampled_image(target_area_def, source_area_def, source_image_data,
result = next_result
else:
if isinstance(next_result, np.ma.core.MaskedArray):
stack = np.ma.row_stack
stack = np.ma.vstack
else:
stack = np.row_stack
stack = np.vstack
result = stack((result, next_result))

return result
Expand Down
4 changes: 2 additions & 2 deletions pyresample/kd_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,14 @@ def _calculate_uncertainty(neighbours, new_data, index_mask_list, weight_list,
v2 = norm_sqr[new_valid_index, i]
stddev[new_valid_index, i] = np.sqrt(
(v1 / (v1 ** 2 - v2)) * stddev[new_valid_index, i])
stddev[~new_valid_index, i] = np.NaN
stddev[~new_valid_index, i] = np.nan
else:
# If given single input data array
v1 = norm[new_valid_index]
v2 = norm_sqr[new_valid_index]
stddev[new_valid_index] = np.sqrt(
(v1 / (v1 ** 2 - v2)) * stddev[new_valid_index])
stddev[~new_valid_index] = np.NaN
stddev[~new_valid_index] = np.nan
return stddev, count


Expand Down
4 changes: 2 additions & 2 deletions pyresample/spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ def __eq__(self, other):

def __str__(self):
"""Get simplified representation of lon/lat arrays in degrees."""
return str((np.rad2deg(self.lon), np.rad2deg(self.lat)))
return str((float(np.rad2deg(self.lon)), float(np.rad2deg(self.lat))))

def __repr__(self):
"""Get simplified representation of lon/lat arrays in degrees."""
return str((np.rad2deg(self.lon), np.rad2deg(self.lat)))
return str((float(np.rad2deg(self.lon)), float(np.rad2deg(self.lat))))

def __iter__(self):
"""Get iterator over lon/lat pairs."""
Expand Down
2 changes: 1 addition & 1 deletion pyresample/test/test_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_get_gradients(self):
def test_get_chunk_mappings(self):
"""Test that chunk overlap, and source and target slices are correct."""
chunks = (10, 10)
num_chunks = np.product(chunks)
num_chunks = np.prod(chunks)
self.resampler._get_projection_coordinates(chunks)
self.resampler._get_gradients()
assert self.resampler.coverage_status is None
Expand Down
4 changes: 2 additions & 2 deletions pyresample/test/test_kd_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ def test_nearest(self):
self.assertEqual(cross_sum, expected)

def test_nearest_complex(self):
data = np.fromfunction(lambda y, x: y + complex("j") * x, (50, 10), dtype=np.complex_)
data = np.fromfunction(lambda y, x: y + complex("j") * x, (50, 10), dtype=np.complex128)
lons = np.fromfunction(lambda y, x: 3 + x, (50, 10))
lats = np.fromfunction(lambda y, x: 75 - y, (50, 10))
swath_def = geometry.SwathDefinition(lons=lons, lats=lats)
res = kd_tree.resample_nearest(swath_def, data.ravel(),
self.area_def, 50000, segments=1)
assert np.issubdtype(res.dtype, np.complex_)
assert np.issubdtype(res.dtype, np.complex128)
cross_sum = res.sum()
assert cross_sum.real == 3530219.0
assert cross_sum.imag == 688723.0
Expand Down
18 changes: 9 additions & 9 deletions pyresample/test/test_resample_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def fun(dst_array=None, block_info=None, **kwargs):
assert dst_area.shape == dst_array.shape
return dst_array

dst_array = da.arange(np.product(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
dst_array = da.arange(np.prod(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
res = resample_blocks(fun, self.src_area, [], self.dst_area, dst_arrays=[dst_array], chunk_size=40, dtype=float)
res = res.compute()
np.testing.assert_allclose(res[:, 40:], dst_array[:, 40:])
Expand All @@ -290,7 +290,7 @@ def fun(dst_array=None, block_info=None, **kwargs):
prev_block_info.append(block_info[0])
return dst_array

dst_array = da.arange(np.product(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
dst_array = da.arange(np.prod(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
res = resample_blocks(fun, self.src_area, [], self.dst_area, dst_arrays=[dst_array], chunk_size=40, dtype=float)
_ = res.compute()

Expand All @@ -311,7 +311,7 @@ def fun(dst_array=None, block_info=None, **kwargs):
prev_block_info.append(block_info[None])
return dst_array

dst_array = da.arange(np.product(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
dst_array = da.arange(np.prod(self.dst_area.shape)).reshape(self.dst_area.shape).rechunk(40)
res = resample_blocks(fun, self.src_area, [], self.dst_area, dst_arrays=[dst_array], chunk_size=40, dtype=float)
_ = res.compute()

Expand All @@ -325,7 +325,7 @@ def fun(dst_array=None, block_info=None, **kwargs):
assert dst_area.shape == dst_array.shape[1:]
return dst_array[0, :, :]

dst_array = da.arange(np.product(self.dst_area.shape)).reshape((1, *self.dst_area.shape)).rechunk(40)
dst_array = da.arange(np.prod(self.dst_area.shape)).reshape((1, *self.dst_area.shape)).rechunk(40)
res = resample_blocks(fun, self.src_area, [], self.dst_area, dst_arrays=[dst_array],
chunk_size=(40, 40), dtype=float)
res = res.compute()
Expand Down Expand Up @@ -359,7 +359,7 @@ def fun(src_array, block_info=None, **kwargs):
assert src_area.shape == src_array.shape[-2:]
return np.full(src_array.shape[:-2] + dst_area.shape, 18)

src_array = da.arange(np.product(self.src_area.shape) * 3).reshape((3, *self.src_area.shape)).rechunk(40)
src_array = da.arange(np.prod(self.src_area.shape) * 3).reshape((3, *self.src_area.shape)).rechunk(40)
res = resample_blocks(fun, self.src_area, [src_array], self.dst_area, chunk_size=(3, 40, 40), dtype=float)
res = res.compute()
assert res.ndim == 3
Expand All @@ -377,7 +377,7 @@ def fun(src_array, block_info=None, **kwargs):
assert src_array.shape[0] == 3
return np.full(src_array.shape[:-2] + dst_area.shape, 18)

src_array = da.arange(np.product(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = da.arange(np.prod(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = src_array.rechunk((1, 40, 40))

res = resample_blocks(fun, self.src_area, [src_array], self.dst_area, chunk_size=(3, 40, 40), dtype=float)
Expand Down Expand Up @@ -408,7 +408,7 @@ def fun(src_array, block_info=None, **kwargs):
dst_area = block_info[None]["area"]
return np.full(src_array.shape[:-2] + dst_area.shape, 18)

src_array = da.arange(np.product(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = da.arange(np.prod(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = src_array.rechunk((1, 40, 40))

res = resample_blocks(fun, self.src_area, [src_array], self.dst_area, chunk_size=(3, "auto", "auto"),
Expand Down Expand Up @@ -453,10 +453,10 @@ def fun(src_array, dst_array, block_info=None, **kwargs):
dst_area = block_info[None]["area"]
return np.full(src_array.shape[:-2] + dst_area.shape, 18)

src_array = da.arange(np.product(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = da.arange(np.prod(self.src_area.shape) * 3).reshape((3, *self.src_area.shape))
src_array = src_array.rechunk((1, 40, 40))

dst_array = da.arange(np.product(self.dst_area.shape) * 2).reshape((2, *self.dst_area.shape))
dst_array = da.arange(np.prod(self.dst_area.shape) * 2).reshape((2, *self.dst_area.shape))
dst_array = src_array.rechunk((1, 40, 40))

res = resample_blocks(fun, self.src_area, [src_array], self.dst_area, [dst_array],
Expand Down
2 changes: 1 addition & 1 deletion pyresample/utils/row_appendable_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def append_row(self, next_array):
if len(next_array.shape) == 1:
self._data = np.append(self._data, next_array[remaining:])
else:
self._data = np.row_stack((self._data, next_array[remaining:]))
self._data = np.vstack((self._data, next_array[remaining:]))
else:
self._data[self._cursor:cursor_end] = next_array
self._cursor = cursor_end
Expand Down

0 comments on commit 56da958

Please sign in to comment.