Skip to content

Commit e8d8795

Browse files
author
Ben
committed
stickler
1 parent 288390b commit e8d8795

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pvlib/iotools/cgiar.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Get, read, and parse data from
2+
Get, read, and parse data from
33
`CGIAR GeoPortal <https://srtm.csi.cgiar.org/>`_.
44
55
For more information, see the following links:
@@ -43,7 +43,7 @@ def _lat_lon_to_query(longitude, latitude, srtm_arc_sec=3):
4343
raise Exception("Please use SRTM 1 Arc Second or SRTM 3 Arc Second")
4444

4545

46-
def download_SRTM(latitude, longitude, srtm_arc_sec=3,
46+
def download_SRTM(latitude, longitude, srtm_arc_sec=3,
4747
path_to_save="./", proxies=None):
4848
r'''Downloads a SRTM DEM tile from CGIAR,
4949
saves it to a path, and loads it as an array
@@ -71,14 +71,15 @@ def download_SRTM(latitude, longitude, srtm_arc_sec=3,
7171
'''
7272
import skimage
7373
long, lat = _lat_lon_to_query(longitude, latitude, srtm_arc_sec)
74-
base_url = 'https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/'
74+
org_url = 'https://srtm.csi.cgiar.org/'
75+
base_url = org_url + 'wp-content/uploads/files/srtm_5x5/TIFF/'
7576
query_URL = base_url + f'srtm_{ long:02d }_{ lat:02d }.zip'
7677
res = requests.get(query_URL, proxies=proxies, verify=False)
7778
res.raise_for_status()
7879
zipfile = ZipFile(io.BytesIO(res.content))
7980
ext = '.tif'
8081
files = zipfile.namelist()
81-
file = [f for f in files if ext in f][0]
82+
file = [ f for f in files if ext in f ][0]
8283
path= zipfile.extract(file, path=path_to_save)
8384
img = skimage.io.imread(path)
8485
return img, path

0 commit comments

Comments
 (0)