home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

3 rows where repo = 13221727, type = "issue" and user = 56925856 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue · 3 ✖

state 1

  • closed 3

repo 1

  • xarray · 3 ✖
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() AndrewILWilliams 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 fill_value=None kwarg, as in the scipy docs it says that If None, values outside the domain are extrapolated.

What you expected to happen: However, this did not work and the array was filled with nans instead of being extrapolated. I had to explicitly add fill_value='extrapolate' in order to get extrapolation to work.

However, as far as I can tell, in this context interp_like() should be calling scipy.interpolate.interpn(), which doesn't seem to require fill_value='extrapolate'?

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 here

import 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 xarray 13221727 issue
617476316 MDU6SXNzdWU2MTc0NzYzMTY= 4055 Automatic chunking of arrays ? AndrewILWilliams 56925856 closed 0     11 2020-05-13T14:02:41Z 2020-05-25T19:23:45Z 2020-05-25T19:23:45Z CONTRIBUTOR      

Hi there,

Hopefully this turns out to be a basic issue, but I was wondering why the chunks='auto' that dask seems to provide (https://docs.dask.org/en/latest/array-chunks.html#automatic-chunking) isn't an option for xarray? I'm not 100% sure of how dask decides how to automatically chunk its arrays, so maybe there's a compatibility issue?

I get the impression that the dask method automatically tries to prevent the issues of "too many chunks" or "too few chunks" which can sometimes happen when choosing chunk sizes automatically. If so, it would maybe be a useful thing to include in future versions?

Happy to be corrected if I've misunderstood something here though, still getting my head around how the dask/xarray compatibility really works...

Cheers!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4055/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
568378007 MDU6SXNzdWU1NjgzNzgwMDc= 3784 Function for regressing/correlating multiple fields? AndrewILWilliams 56925856 closed 0     6 2020-02-20T15:24:14Z 2020-05-25T16:55:33Z 2020-05-25T16:55:33Z CONTRIBUTOR      

I came across this StackOverflow thread about applying linear regression across multi-dimensional arrays and there were some very efficient, xarray-based solutions suggested to the OP which leveraged vectorized operations. I was wondering if there was any interest in adding a function like this to future releases of xarray? It seems like a very neat and useful functionality to have, and not just for meteorological applications!

https://stackoverflow.com/questions/52108417/how-to-apply-linear-regression-to-every-pixel-in-a-large-multi-dimensional-array

Most answers draw from this blog post: https://hrishichandanpurkar.blogspot.com/2017/09/vectorized-functions-for-correlation.html

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3784/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 5117.824ms · About: xarray-datasette