home / github / pull_requests

Menu
  • GraphQL API
  • Search all tables

pull_requests: 1787259708

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
1787259708 PR_kwDOAMm_X85qh2s8 8867 closed 0 Avoid in-place multiplication of a large value to an array with small integer dtype 14371165 Upstream numpy has become a bit more particular with which types you can use for inplace operations. This PR fixes ``` _______________ TestImshow.test_imshow_rgb_values_in_valid_range _______________ self = <xarray.tests.test_plot.TestImshow object at 0x7f88320c2780> def test_imshow_rgb_values_in_valid_range(self) -> None: da = DataArray(np.arange(75, dtype="uint8").reshape((5, 5, 3))) _, ax = plt.subplots() > out = da.plot.imshow(ax=ax).get_array() /home/runner/work/xarray/xarray/xarray/tests/test_plot.py:2034: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/runner/work/xarray/xarray/xarray/plot/accessor.py:421: in imshow return dataarray_plot.imshow(self._da, *args, **kwargs) /home/runner/work/xarray/xarray/xarray/plot/dataarray_plot.py:1601: in newplotfunc primitive = plotfunc( /home/runner/work/xarray/xarray/xarray/plot/dataarray_plot.py:1853: in imshow alpha *= 255 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = masked_array( data=[[[1], [1], [1], [1], [1]], [[1], [1], ..., [1], [1], [1], [1]]], mask=False, fill_value=np.int64(999999), dtype=uint8) other = 255 def __imul__(self, other): """ Multiply self by other in-place. """ m = getmask(other) if self._mask is nomask: if m is not nomask and m.any(): self._mask = make_mask_none(self.shape, self.dtype) self._mask += m elif m is not nomask: self._mask += m other_data = getdata(other) other_data = np.where(self._mask, other_data.dtype.type(1), other_data) > self._data.__imul__(other_data) E numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'multiply' output from dtype('int64') to dtype('uint8') with casting rule 'same_kind' /home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/numpy/ma/core.py:4415: UFuncTypeError ``` Some curious behaviors seen while debugging: ```python alpha = np.array([1], dtype=np.int8) alpha *= 255 repr(alpha) # 'array([-1], dtype=int8)' alpha = np.array([1], dtype=np.int16) alpha *= 255 repr(alpha) # 'array([255], dtype=int16)' ``` xref: #8844 2024-03-22T20:22:22Z 2024-03-29T15:26:38Z 2024-03-29T15:26:38Z 2024-03-29T15:26:38Z afce18f774b6b57b696f7223c3bd179a91b7f7d1     0 4db9d46475ad630b1f11332d3e7ca9f98b87f474 473b87f19e164e508566baf7c8750ac4cb5b50f7 MEMBER   13221727 https://github.com/pydata/xarray/pull/8867  

Links from other tables

  • 2 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 0.711ms