Skip to content

Commit

Permalink
Speed up process custom data
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Sep 6, 2022
1 parent 57ff957 commit c3b9dce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions oggm/core/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def process_custom_climate_data(gdir, y0=None, y1=None,
fpath = cfg.PATHS['climate_file']
nc_ts = salem.GeoNetcdf(fpath)

# Avoid reading all data
nc_ts.set_subset(((gdir.cenlon, gdir.cenlat),
(gdir.cenlon, gdir.cenlat)),
margin=2) # 2 is to be sure - also on small files

# set temporal subset for the ts data (hydro years)
sm = cfg.PARAMS['hydro_month_' + gdir.hemisphere]
em = sm - 1 if (sm > 1) else 12
Expand Down

0 comments on commit c3b9dce

Please sign in to comment.