Skip to content

Commit 5d388ba

Browse files
committed
Address flake8 requirement
1 parent a67fee0 commit 5d388ba

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

lib/cartopy/data/raster/etopo1.jpg

-1.28 MB
Binary file not shown.

lib/cartopy/mpl/geoaxes.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import cartopy.mpl.patch as cpatch
4242
from cartopy.mpl.slippy_image_artist import SlippyImageArtist
4343
from cartopy.vector_transform import vector_scalar_to_grid
44+
from cartopy.io import Downloader
4445

4546

4647
assert mpl.__version__ >= '1.5.1', ('Cartopy is only supported with '
@@ -1005,11 +1006,13 @@ def stock_img(self, name='ne_shaded'):
10051006
"""
10061007
Add a standard image to the map.
10071008
1008-
Currently, there are 2 options.
1009-
1: 'ne_shaded'(default) a downsampled version of the Natural Earth shaded relief raster.
1010-
2: 'etopo1' a downsampled version of global relief model of Earth's surface that
1011-
integrates land topography and ocean bathymetry. This option is the same as the etopo1
1012-
from Basemap.
1009+
Currently, there are 2 options:
1010+
1011+
1. 'ne_shaded'(default) a downsampled version of the Natural Earth
1012+
shaded relief raster.
1013+
2. 'etopo1' a downsampled version of global relief model of Earth's
1014+
surface that integrates land topography and ocean bathymetry. This
1015+
option is the same as the etopo1 from Basemap.
10131016
"""
10141017
if name == 'ne_shaded':
10151018
import os
@@ -1024,8 +1027,16 @@ def stock_img(self, name='ne_shaded'):
10241027
elif name == 'etopo1':
10251028
import os
10261029
source_proj = ccrs.PlateCarree()
1027-
fname = os.path.join(config["repo_data_dir"],
1028-
'raster', 'etopo1.jpg')
1030+
1031+
url_template = 'https://www.ngdc.noaa.gov/mgg/image/{name}.jpg'
1032+
target_path_template = os.path.join(config["data_dir"],
1033+
'raster', '{name}.jpg')
1034+
pre_downloaded_path_template = target_path_template
1035+
d = Downloader(url_template, target_path_template,
1036+
pre_downloaded_path_template)
1037+
cfg = {('etopo1'): d}
1038+
dl = Downloader.from_config(('etopo1'), config_dict=cfg)
1039+
fname = dl.path({'name': 'color_etopo1_ice_low'})
10291040

10301041
return self.imshow(imread(fname), origin='upper',
10311042
transform=source_proj,

0 commit comments

Comments
 (0)