Skip to content

Commit fcfa10b

Browse files
committed
Address flake8 requirement
1 parent a67fee0 commit fcfa10b

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

lib/cartopy/data/raster/etopo1.jpg

-1.28 MB
Binary file not shown.

lib/cartopy/mpl/geoaxes.py

Lines changed: 15 additions & 8 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. 'etopo' 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 etopo from Basemap.
10131016
"""
10141017
if name == 'ne_shaded':
10151018
import os
@@ -1021,11 +1024,15 @@ def stock_img(self, name='ne_shaded'):
10211024
return self.imshow(imread(fname), origin='upper',
10221025
transform=source_proj,
10231026
extent=[-180, 180, -90, 90])
1024-
elif name == 'etopo1':
1027+
elif name == 'etopo':
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+
d = Downloader(url_template, target_path_template)
1035+
fname = d.path({'name': 'color_etopo1_ice_low'})
10291036

10301037
return self.imshow(imread(fname), origin='upper',
10311038
transform=source_proj,

lib/cartopy/tests/mpl/test_images.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ def test_stock_img():
183183
reason='Proj Orthographic projection is buggy.',
184184
strict=True)
185185
@ImageTesting(['imshow_etopo1_ortho'], tolerance=0.7)
186-
def test_stock_img_etopo1():
186+
def test_stock_img_etopo():
187187
ax = plt.axes(projection=ccrs.Orthographic())
188-
ax.stock_img(name='etopo1')
188+
ax.stock_img(name='etopo')
189189

190190

191191
@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ4_VERSION < (5, 1, 0),

0 commit comments

Comments
 (0)