home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 498180644

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
498180644 MDU6SXNzdWU0OTgxODA2NDQ= 3342 Error when using xarray's built in interp function with dask chunking 20382006 closed 0     4 2019-09-25T10:00:13Z 2019-09-26T13:56:19Z 2019-09-26T13:56:19Z NONE      

This is a copied issue posted on stack overflow: https://stackoverflow.com/questions/57572433/error-when-using-xarrays-built-in-interp-function-with-dask

I am trying to use xarray's interp function together with the chunk function, which is a dask array feature.

Taking the example under 'Example' at http://xarray.pydata.org/en/stable/interpolation.html I am able to use the interp function just fine. The simplified code I use to do this is:

``` at = xr.tutorial.open_dataset('air_temperature').isel(time=0)

x = np.linspace(240, 300, 100) z = np.linspace(20, 70, 100) lat = xr.DataArray(z, dims=['z'], coords={'z': z}) lon = xr.DataArray((x[:, np.newaxis]-270)/np.cos(z*np.pi/180)+270, dims=['x', 'z'], coords={'x': x, 'z': z})

dsi = at.interp(lon=lon, lat=lat)` ```

The problem arises when I try to combine this interp function with xarray chunk by modifying the above code in the following way:

``` at = xr.tutorial.open_dataset('air_temperature').isel(time=0) at = at.chunk({'lat':10}) # added chunking inducing a dask array

x = np.linspace(240, 300, 100) z = np.linspace(20, 70, 100) lat = xr.DataArray(z, dims=['z'], coords={'z': z}) lon = xr.DataArray((x[:, np.newaxis]-270)/np.cos(z*np.pi/180)+270, dims=['x', 'z'], coords={'x': x, 'z': z})

dsi = at.interp(lon=lon, lat=lat) ```

The code fails at line dsi = at.interp(lon=lon, lat=lat) The error I get is:

ValueError: Can't specify drop_axis and new_axis together

I think what is happening is that the interp function is replacing a coordinate and dask cannot deal with this. Is this a bug that needs fixing within xarray or is there something that I have done wrong?

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.6 |Anaconda custom (64-bit)| (default, Oct 9 2018, 12:34:16) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-957.5.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 libhdf5: 1.8.18 libnetcdf: 4.4.1.1 xarray: 0.12.3 pandas: 0.25.0 numpy: 1.16.4 scipy: 1.3.0 netCDF4: 1.3.1 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: None dask: 0.13.0 distributed: None matplotlib: 2.2.2 cartopy: None seaborn: 0.7.1 numbagg: None setuptools: 40.8.0 pip: 9.0.1 conda: 4.7.11 pytest: 3.0.5 IPython: 5.1.0 sphinx: 1.5.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3342/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
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 0.737ms · About: xarray-datasette