home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 78008962

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/364#issuecomment-78008962 https://api.github.com/repos/pydata/xarray/issues/364 78008962 MDEyOklzc3VlQ29tbWVudDc4MDA4OTYy 167164 2015-03-10T07:51:45Z 2015-03-10T07:51:45Z NONE

Nice.

Ok, I have hit a stumbling block, and this is much more of a support request, so feel free to direct me else where, but since we're on the topic, I want to do something like:

start = 2002 n_years = 4 new_data = [] for year in range(start, start + n_years): days = 365 if year%4 else 365 for d in range(days): day_data = mean + annual_cycle.isel(dayofyear=d) + daily_cycle day_data.coords['time'] = datetime.datetime(year,1,1) + datetime.timedelta(day=d, hour=day_data.timeofday.hour, minute=day_data.timeofday.minute) new_data.append(day_data) xray.concat(new_data)

where mean, annual_cycle, and daily_cycle are overall mean, annual cycle at daily resolution, and daily cycle at 30 minute resolution (the latter two bias corrected by subtracting the mean). I'm trying to make a synthetic dataset 4 years long that only includes the mean, seasonal, and daily cycles, but no other variability.

The assignment of day_data['time'] fails because the day_data.timeofday.hour (and .minute) don't work. These are datetime.times, is there an efficient way of converting these to datetime.timedeltas, without first manually taking them out of the DataArray?

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