home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 554317768

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/issues/3535#issuecomment-554317768 https://api.github.com/repos/pydata/xarray/issues/3535 554317768 MDEyOklzc3VlQ29tbWVudDU1NDMxNzc2OA== 10194086 2019-11-15T11:05:44Z 2019-11-15T11:08:29Z MEMBER

This happens in xr.combinde_by_coords. Note that the OverflowError is "ignored in: pandas._libs.algos.are_diff'". Soxr.combinde_by_coords` can return a wrong dataset (although this does not happen silently):

``` python

import xarray as xr i1 = xr.cftime_range("4500-12-31", periods=1) i2 = xr.cftime_range("4600-12-31", periods=1) i3 = xr.cftime_range("5100-12-31", periods=1)

d1 = xr.DataArray([0], dims=("time", ), coords={"time": ("time", i1)}).to_dataset(name="a") d2 = xr.DataArray([1], dims=("time", ), coords={"time": ("time", i2)}).to_dataset(name="a") d3 = xr.DataArray([2], dims=("time", ), coords={"time": ("time", i3)}).to_dataset(name="a")

xr.combine_by_coords([d1, d2, d3]).time ```

returns:

python <xarray.DataArray 'time' (time: 2)> array([cftime.DatetimeGregorian(4500-12-31 00:00:00), cftime.DatetimeGregorian(5100-12-31 00:00:00)], dtype=object) Coordinates: * time (time) object 4500-12-31 00:00:00 5100-12-31 00:00:00 note how d2 is missing.


Within xr.combine_by_coords the error happens here:

https://github.com/pydata/xarray/blob/7b4a286f59bc7d60d4e4d03be65562ff63f9b111/xarray/core/combine.py#L98

``` python import pandas as pd

indexes = [i1, i2, i3]

the code from _infer_concat_order_from_coords

first_items = pd.Index([index.take([0]) for index in indexes])

series = first_items.to_series() rank = series.rank(method="dense", ascending=ascending) order = rank.astype(int).values - 1

order

array([0, 1, 1]) ```

This causes the second item to be dropped.

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