From 7bc066577f7f7db3aefdf23b74d45e41e90c9918 Mon Sep 17 00:00:00 2001 From: Matthias Dusch Date: Wed, 13 Oct 2021 13:36:24 +0200 Subject: [PATCH 1/2] add download lock for multiprocessing LMR data --- oggm/shop/gcm_climate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oggm/shop/gcm_climate.py b/oggm/shop/gcm_climate.py index 5025022fc..e722f385d 100644 --- a/oggm/shop/gcm_climate.py +++ b/oggm/shop/gcm_climate.py @@ -370,12 +370,14 @@ def process_lmr_data(gdir, fpath_temp=None, fpath_precip=None, **kwargs: any kwarg to be passed to ref:`process_gcm_data` """ - # Get the path of GCM temperature & precipitation data + # Get the path of GCM temperature & precipitation data base_url = 'https://atmos.washington.edu/%7Ehakim/lmr/LMRv2/' if fpath_temp is None: - fpath_temp = utils.file_downloader(base_url + 'air_MCruns_ensemble_mean_LMRv2.1.nc') + with utils.get_lock(): + fpath_temp = utils.file_downloader(base_url + 'air_MCruns_ensemble_mean_LMRv2.1.nc') if fpath_precip is None: - fpath_precip = utils.file_downloader(base_url + 'prate_MCruns_ensemble_mean_LMRv2.1.nc') + with utils.get_lock(): + fpath_precip = utils.file_downloader(base_url + 'prate_MCruns_ensemble_mean_LMRv2.1.nc') # Glacier location glon = gdir.cenlon From f5ffbb257d4bcd4c461b3514f1db0b0f583ef889 Mon Sep 17 00:00:00 2001 From: Matthias Dusch Date: Wed, 13 Oct 2021 13:40:46 +0200 Subject: [PATCH 2/2] fix indent --- oggm/shop/gcm_climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oggm/shop/gcm_climate.py b/oggm/shop/gcm_climate.py index e722f385d..967c6e728 100644 --- a/oggm/shop/gcm_climate.py +++ b/oggm/shop/gcm_climate.py @@ -370,7 +370,7 @@ def process_lmr_data(gdir, fpath_temp=None, fpath_precip=None, **kwargs: any kwarg to be passed to ref:`process_gcm_data` """ - # Get the path of GCM temperature & precipitation data + # Get the path of GCM temperature & precipitation data base_url = 'https://atmos.washington.edu/%7Ehakim/lmr/LMRv2/' if fpath_temp is None: with utils.get_lock():