issue_comments: 296274069
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/1380#issuecomment-296274069 | https://api.github.com/repos/pydata/xarray/issues/1380 | 296274069 | MDEyOklzc3VlQ29tbWVudDI5NjI3NDA2OQ== | 8699967 | 2017-04-21T18:49:57Z | 2017-04-21T19:44:00Z | CONTRIBUTOR | Thank you @spencerahill and @shoyer. That was brilliant. Here is the solution: ```python path_to_files = '*.grib2' def extract_date(ds): for var in ds.variables: if 'initial_time' in ds[var].attrs.keys(): grid_time = pd.to_datetime(ds[var].attrs['initial_time'], format="%m/%d/%Y (%H:%M)") if 'forecast_time' in ds[var].attrs.keys(): time_units = 'h' if 'forecast_time_units' in ds[var].attrs.keys(): time_units = str(ds[var].attrs['forecast_time_units'][0]) grid_time += np.timedelta64(int(ds[var].attrs['forecast_time'][0]), time_units)
with xr.open_mfdataset(path_to_files, concat_dim='time', preprocess=extract_date, engine='pynio') as xd: print(xd) ``` |
{
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
223440405 |