home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 326818830

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1473#issuecomment-326818830 https://api.github.com/repos/pydata/xarray/issues/1473 326818830 MDEyOklzc3VlQ29tbWVudDMyNjgxODgzMA== 1217238 2017-09-03T17:28:46Z 2017-09-03T17:28:46Z MEMBER

I considered the rasm data, where the original object stays on the logical coordinates x and y. If we have conversion DataArrays, such as a table of x and y values as a function of target coordinates lat and lon, then the coordinate projection from (x, y) to (lat, lon) can be done by .sel(x=x, y=y, method='nearest'). This might be a kind of multi-dimensional reindex?

In such a use case, it would be better for sel (or multi-dimensional reindex) to return NaN than to raise an error.

I agree, this feels closer to a use-case for multi-dimensional reindex rather than sel.

Let's recall the use cases fro these methods: - sel is for selecting data on its existing coordinates - reindex is for imposing new coordinates on data

So one possible way to define multi-dimensional reindexing would be as follows: - Given reindex arguments of the form dim=array where array is a 1D unlabeled array/list, convert them into DataArray(array, [(dim, array)]). - Do multi-dimensional indexing with broadcasting like sel, but fill in NaN for missing values (we could allow for customizing this with a fill_value argument). - Join coordinates like for sel, but coordinates from the indexers take precedence over coordinates from the object being indexed.

In practice, multi-dimensional reindex and sel are very similar if there is no overlap between coordinates on the indexer/indexed objects.

I also would like to try that, but it might be a bit tough and it would be better to do after the next release.

:+1:

So for now, let's raise a FutureWarning if supplying a DataArray with array.coords[dim].values != array.values.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  241578773
Powered by Datasette · Queries took 0.888ms · About: xarray-datasette