home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 252193599

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/1041#issuecomment-252193599 https://api.github.com/repos/pydata/xarray/issues/1041 252193599 MDEyOklzc3VlQ29tbWVudDI1MjE5MzU5OQ== 900941 2016-10-07T09:26:28Z 2016-10-07T09:26:59Z CONTRIBUTOR

Hi @shoyer:

Does a2.resample("D", "time") work in your second example?

with a2.resample("D", "time") I get the following exception:

ValueError: 'time' not found in array dimensions ('t',)

but I think this is working as intended -- if you only supply the name of a dimension with integer labels, xarray has no way to know how what times to use for resampling.

I am not sure how it is done now or whether it is possible to implement, but I feel like it searches for the coordinate with the same name as the supplied dimension. Probably searching for a coordinate containing only the dimension specified in resample could do the trick.

Maybe there is a better way to do what I am trying to do?: I needed it to calculate daily means. But I have a hole in my data in the middle of the year and resample is masking this hole, by adding masked fields. So I've done it with groupby as follows, but it seems there should be an easier way to achieve this:

python day_dates = [datetime(d.year, d.month, d.day) for d in pd.to_datetime(snfl.coords["t"].values)] day_dates = DataArray(day_dates, name="time", dims="t") snfl = snfl.groupby(day_dates).mean(dim="t")

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