home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1340771454

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/7363#issuecomment-1340771454 https://api.github.com/repos/pydata/xarray/issues/7363 1340771454 IC_kwDOAMm_X85P6ox- 5821660 2022-12-07T10:50:28Z 2022-12-07T10:50:28Z MEMBER

Does this more or less represent your Dataset?

```python import numpy as np import xarray as xr import datetime

create two timeseries', second is for reindex

itime = np.arange(0, 3208464).astype("<M8[s]") itime2 = np.arange(0, 4000000).astype("<M8[s]")

create two dataset with the time only

ds1 = xr.Dataset({"time": itime}) ds2 = xr.Dataset({"time": itime2})

add random data to ds1

ds1 = ds1.expand_dims("station") ds1 = ds1.assign({"test": (["station", "time"], np.random.rand(106, 3208464))}) ```

Now we reindex with the longer timeseries, it only takes a couple of seconds on my machine:

python %%time ds3 = ds1.reindex(time=ds2.time) CPU times: user 3.16 s, sys: 649 ms, total: 3.81 s Wall time: 3.81 s

Data is unchanged after reindex:

python xr.testing.assert_equal(ds1.test, ds3.test.isel(time=slice(0, 3208464)))

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