home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1057335460

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1057335460 I_kwDOAMm_X84_Baik 6002 Abnormal process termination when using bottleneck function on xarray data after transposing and having a dimension with length 1 34062862 closed 0     5 2021-11-18T13:06:25Z 2021-11-19T13:20:28Z 2021-11-19T13:20:28Z NONE      

When running the following example the python interpreter exists abnormally (exit code -1073741819)

The code that causes the exception is the maxnan() function in bottleneck.

This error only occurs when:

  1. The data contains a dimension with length 1
  2. The data is transposed
  3. bottleneck is used

So I suspect that the transpose function changes the data somehow such that bottleneck can not handle it anymore.

  • Calling bn.maxnan on a normal ndarray works fine
  • Calling data.max() before transposing works fine
  • Running the example without using bottleneck (either by not installing it or by disabling it in OPTIONS) works fine
  • Running the example with len(time) > 1 works fine

What happened:

Process finished with exit code -1073741819 (0xC0000005)

What you expected to happen:

Script should run without crashing

Minimal Complete Verifiable Example:

```python from collections import OrderedDict import numpy as np import xarray as xr

xr.show_versions()

n_time = 1 # 1 : Fails, 2 : everything is fine

from xarray.core.options import OPTIONS OPTIONS["use_bottleneck"] = True # Set to False for work-around

Build some dataset

dirs = np.linspace(0,360, num=121) freqs = np.linspace(0,4,num=192) spec_data = np.random.random(size=(n_time,192,121))

dims = ('time', 'freq', 'dir') coords = OrderedDict() coords['time'] = range(n_time) coords['freq'] = freqs coords['dir'] = dirs

xdata = xr.DataArray( data=spec_data, coords=coords, dims=dims, name='Spec name', ).to_dataset()

xdata = xdata.transpose(..., "freq") # remove this line and the script will run

tm = xdata.max() print('Done') ```

Anything else we need to know?:

Uhm... it was really hard to dig this deep? :-)

Environment:

Tested with python 3.8 and 3.9 on win64. Only required packages are xarray and bottleneck. For example:

yml name: ws dependencies: - python=3.9 - xarray channels: - defaults - conda-forge

note: xarray requires pandas which installs bottleneck. To install without bottleneck pin pandas to 1.2.4

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD byteorder: little LC_ALL: None LANG: None LOCALE: ('English_United States', '1252') libhdf5: None libnetcdf: None xarray: 0.20.1 pandas: 1.2.4 numpy: 1.21.4 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 59.1.1 pip: 21.3.1 conda: None pytest: None IPython: None sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6002/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 1.022ms · About: xarray-datasette