Skip to content

Commit

Permalink
new cdsapi fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aldotapia committed Sep 17, 2024
1 parent f21f96b commit d3dd778
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Binary file modified dist/hidrocl-0.0.23-py3-none-any.whl
Binary file not shown.
Binary file modified dist/hidrocl-0.0.23.tar.gz
Binary file not shown.
12 changes: 6 additions & 6 deletions src/hidrocl/products/extractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def load_era5(file, var, reducer='mean'):
da = da[var]
match var:
case ('e' | 'pev' | 'swvl1' | 'swvl2' | 'swvl3' | 'swvl4'):
return da.sel(time=da.time.values[-1])
return da.sel(time=da.valid_time.values[-1])
match reducer:
case 'mean':
da = da.mean(dim='valid_time')
Expand Down Expand Up @@ -123,12 +123,12 @@ def load_era5acc(file, var, reducer='max'):
da = xarray.open_dataset(file, mask_and_scale=True)
da = da[var]
# check if "expver" is in the file
if 'expver' in da.coords:
da = da.sel(expver=1)
# drop "expver" coordinate
da = da.drop('expver')
# if 'expver' in da.coords:
# da = da.sel(expver=1)
# # drop "expver" coordinate
# da = da.drop('expver')
# aggregate to 3-hourly
da = da.resample(time='3H')
da = da.resample(valid_time='3H')
match reducer:
case 'mean':
da = da.mean(dim='valid_time')
Expand Down

0 comments on commit d3dd778

Please sign in to comment.