Skip to content

Commit

Permalink
Merge d4ff09e into fd6ce6c
Browse files Browse the repository at this point in the history
  • Loading branch information
d-otto committed Nov 17, 2022
2 parents fd6ce6c + d4ff09e commit ebc20c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Bug fixes
- corrected a but in ``apparent_mb_from_any_mb``, where only two years of MB
would be used instead of a range of years (:pull:`1426`).
By `Bowen <https://github.com/bowenbelongstonature>`_
- Corrected ``source`` argument in ``tasks.define_glacier_region`` to handle a
list of DEM sources. (:pull:`1506`).
By `Daniel Otto <https://github.com/d-otto>`_

Migrating guide
~~~~~~~~~~~~~~~
Expand Down
11 changes: 10 additions & 1 deletion oggm/core/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,16 @@ def define_glacier_region(gdir, entity=None, source=None):

# Open DEM
# We test DEM availability for glacier only (maps can grow big)
if not is_dem_source_available(source, *gdir.extent_ll):
if isinstance(source, list): # when multiple sources are provided, try them sequentially
for i, src in enumerate(source):
source_exists = is_dem_source_available(src, *gdir.extent_ll)
if source_exists:
source = source[i] # pick the first source which exists
break
else:
source_exists = is_dem_source_available(source, *gdir.extent_ll)

if source_exists is False:
raise InvalidWorkflowError(f'Source: {source} is not available for '
f'glacier {gdir.rgi_id} with border '
f"{cfg.PARAMS['border']}")
Expand Down

0 comments on commit ebc20c1

Please sign in to comment.