Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Sep 6, 2022
1 parent c3b9dce commit 6578031
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions oggm/core/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ def process_custom_climate_data(gdir, y0=None, y1=None,
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
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=RuntimeWarning)
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]
Expand All @@ -112,8 +114,8 @@ def process_custom_climate_data(gdir, y0=None, y1=None,
'millimeter']

# geoloc
lon = nc_ts._nc.variables['lon'][:]
lat = nc_ts._nc.variables['lat'][:]
lon = nc_ts.get_vardata('lon')
lat = nc_ts.get_vardata('lat')

ilon = np.argmin(np.abs(lon - gdir.cenlon))
ilat = np.argmin(np.abs(lat - gdir.cenlat))
Expand Down

0 comments on commit 6578031

Please sign in to comment.