From f8c66c1c39f17a0fa7d953297293b344be6391d7 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 6 Jan 2019 16:23:52 +0100 Subject: [PATCH 1/2] Allows to specify crendentials for SRTM version repositories which needs registers users. --- srtm/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/srtm/main.py b/srtm/main.py index a8e91c7..50f845d 100644 --- a/srtm/main.py +++ b/srtm/main.py @@ -27,7 +27,8 @@ def get_data(srtm1=None, srtm3=None, version='v2.1a', fallback=True, leave_zipped=False, file_handler=None, - use_included_urls=True, batch_mode=False): + use_included_urls=True, batch_mode=False, + EDuser='', EDpass=''): """ Get the utility object for querying elevation data. @@ -79,8 +80,8 @@ def get_data(srtm1=None, srtm3=None, version='v2.1a', fallback=True, if not srtm1: srtm1_files = {} if not srtm3: srtm3_files = {} - return mod_data.GeoElevationData(srtm1_files, srtm3_files, file_handler=file_handler, - leave_zipped=leave_zipped, batch_mode=batch_mode) + return mod_data.GeoElevationData(srtm1_files, srtm3_files, version=version, file_handler=file_handler, + leave_zipped=leave_zipped, batch_mode=batch_mode, EDuser=EDuser, EDpass=EDpass) def _get_urls(use_included_urls, file_handler): files_list_file_name = 'list.json' From 87676463fc8b46c95546bb49229e15913cf4e8c0 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 8 Jan 2019 22:17:12 +0100 Subject: [PATCH 2/2] Fixed parameters handling since get_data() passed empty dict (which is not None but is converted to bool as False) for parameters srtm1_files and srtm3_files. Without this, v2.3a would be used whatever version value. --- srtm/data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/srtm/data.py b/srtm/data.py index f1aa35b..fb3899d 100644 --- a/srtm/data.py +++ b/srtm/data.py @@ -118,13 +118,13 @@ def __init__(self, srtm1_files=None, srtm3_files=None, version='v2.1a', """ # Deprecated parameter handling - if srtm1_files is not None or srtm3_files is not None: + if srtm1_files or srtm3_files: mod_warnings.warn("Use of srtm1_files and srtm3_files is " "deprecated. Use version instead", DeprecationWarning) - if srtm1_files is not None: + if srtm1_files: version = 'v2.1a' - elif srtm3_files is not None: + elif srtm3_files: version = 'v2.3a' # End deprecated parameter handling