home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 395384938

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
395384938 MDU6SXNzdWUzOTUzODQ5Mzg= 2644 DataArray concat with tolerance 4711805 closed 0     3 2019-01-02T21:23:21Z 2019-08-15T15:15:26Z 2019-08-15T15:15:26Z CONTRIBUTOR      

I would like to concatenate many DataArray whose dimension coordinates are almost aligned, allowing for some offset in the coordinates:

python import xarray as xr da1 = xr.DataArray([[0, 1], [2, 3]], coords=[[0, 1], [0, 1]], dims=['x', 'y']) da2 = xr.DataArray([[4, 5], [6, 7]], coords=[[1.1, 2.1], [1.1, 2.1]], dims=['x', 'y']) da = xr.concat([da1, da2], 'z', method='nearest', tolerance=0.2) # doesn't exist yet da

And I would get:

``` <xarray.DataArray (z: 2, x: 3, y: 3)> array([[[ 0., 1., nan], [ 2., 3., nan], [nan, nan, nan]],

   [[nan, nan, nan],
    [nan,  4.,  5.],
    [nan,  6.,  7.]]])

Coordinates: * x (x) float64 0 1 2.1 * y (y) float64 0 1 2.1 Dimensions without coordinates: z ```

@jhamman suggested to use reindex_like in this StackOverflow question, but it doesn't produce the union of coordinates, so I cannot chain them like this:

python da2 = da2.reindex_like(da1, method='nearest', tolerance=0.2)

Is there another work around? Do you think it would be worth having this feature in concat?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2644/reactions",
    "total_count": 1,
    "+1": 1,
    "-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
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.933ms · About: xarray-datasette