issues: 786839234
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
786839234 | MDU6SXNzdWU3ODY4MzkyMzQ= | 4816 | Possible bug with da.interp_like() | 56925856 | closed | 0 | 1 | 2021-01-15T11:54:50Z | 2021-01-15T12:17:18Z | 2021-01-15T12:17:18Z | CONTRIBUTOR | What happened:
When interpolating a multidimensional array, I used the What you expected to happen:
However, this did not work and the array was filled with However, as far as I can tell, in this context I might be misunderstanding something here, but if not then I think there might be a bug? Happy to be corrected if I've misunderstood the docs! Minimal Complete Verifiable Example: ```python Put your MCVE code hereimport xarray as xr import numpy as np da = xr.DataArray( np.array(([1,2,3,4,0],[1,2,3,9,0])), dims=["x", "y"], coords={"x": [0,1],"y": [0,1,2,3,4]} ) da2 = xr.DataArray( np.array(([2,3,0,4,5,6],[2,3,0,4,5,6],[2,3,0,4,5,6])), dims=["x", "y"], coords={"x": [0,1,2],"y": [0,1,2,3,4,5]} ) print(da.interp_like(da2)) <xarray.DataArray (x: 3, y: 6)> array([[ 1., 2., 3., 4., 0., nan], [ 1., 2., 3., 9., 0., nan], [nan, nan, nan, nan, nan, nan]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 5 print(da.interp_like(da2, kwargs={'fill_value':None})) <xarray.DataArray (x: 3, y: 6)> array([[ 1., 2., 3., 4., 0., nan], [ 1., 2., 3., 9., 0., nan], [nan, nan, nan, nan, nan, nan]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 5 print(da.interp_like(da2, kwargs={'fill_value':'extrapolate'})) <xarray.DataArray (x: 3, y: 6)> array([[ 1., 2., 3., 4., 0., -4.], [ 1., 2., 3., 9., 0., -9.], [ 1., 2., 3., 14., 0., -14.]]) Coordinates: * x (x) int64 0 1 2 * y (y) int64 0 1 2 3 4 5 ``` Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1127.19.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.10.5 libnetcdf: 4.6.2 xarray: 0.16.1 pandas: 1.1.5 numpy: 1.19.2 scipy: 1.5.2 netCDF4: 1.5.1.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.3.0 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.8 cfgrib: None iris: None bottleneck: 1.3.2 dask: 2.30.0 distributed: 2.30.1 matplotlib: 3.3.3 cartopy: 0.18.0 seaborn: None numbagg: None pint: None setuptools: 51.0.0.post20201207 pip: 20.3.3 conda: None pytest: None IPython: 7.16.1 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4816/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |