Skip to content

Commit

Permalink
srtm: SrtmConf: fix cache_clear handling on download/server option ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
Benjamin Winkel committed Apr 24, 2019
1 parent 96c8c42 commit 2e8cd68
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pycraf/pathprof/srtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,18 @@ def hook(cls, **kwargs):
if kwargs['srtm_dir'] != cls.srtm_dir:
get_tile_interpolator.cache_clear()

if 'download' in kwargs or 'server' in kwargs:
if 'download' in kwargs:
# check if 'download' strategy was changed and clear cache
# this is necessary, because missing tiles will lead to
# zero heights in the tile cache (for that tile) and if user
# later sets the option to download missing tiles, the reading
# routine needs to run again
if (
kwargs['download'] != cls.download or
kwargs['server'] != cls.server
):
if kwargs['download'] != cls.download:
get_tile_interpolator.cache_clear()

if 'server' in kwargs:
# dito
if kwargs['server'] != cls.server:
get_tile_interpolator.cache_clear()


Expand Down

0 comments on commit 2e8cd68

Please sign in to comment.