Skip to content

Commit

Permalink
Address flake8 requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
smartlixx committed Mar 29, 2021
1 parent a67fee0 commit 8a0abd2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Binary file removed lib/cartopy/data/raster/etopo1.jpg
Binary file not shown.
23 changes: 16 additions & 7 deletions lib/cartopy/mpl/geoaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import cartopy.mpl.patch as cpatch
from cartopy.mpl.slippy_image_artist import SlippyImageArtist
from cartopy.vector_transform import vector_scalar_to_grid
from cartopy.io import Downloader


assert mpl.__version__ >= '1.5.1', ('Cartopy is only supported with '
Expand Down Expand Up @@ -1005,11 +1006,13 @@ def stock_img(self, name='ne_shaded'):
"""
Add a standard image to the map.
Currently, there are 2 options.
1: 'ne_shaded'(default) a downsampled version of the Natural Earth shaded relief raster.
2: 'etopo1' a downsampled version of global relief model of Earth's surface that
integrates land topography and ocean bathymetry. This option is the same as the etopo1
from Basemap.
Currently, there are 2 options:
1. 'ne_shaded'(default) a downsampled version of the Natural Earth
shaded relief raster.
2. 'etopo1' a downsampled version of global relief model of Earth's
surface that integrates land topography and ocean bathymetry. This
option is the same as the etopo1 from Basemap.
"""
if name == 'ne_shaded':
import os
Expand All @@ -1024,8 +1027,14 @@ def stock_img(self, name='ne_shaded'):
elif name == 'etopo1':
import os
source_proj = ccrs.PlateCarree()
fname = os.path.join(config["repo_data_dir"],
'raster', 'etopo1.jpg')

url_template = 'https://www.ngdc.noaa.gov/mgg/image/{name}.jpg'
target_path_template = os.path.join(config["data_dir"],
'raster', '{name}.jpg')
pre_downloaded_path_template = target_path_template
d = Downloader(url_template, target_path_template,
pre_downloaded_path_template)
fname = d.path({'name': 'color_etopo1_ice_low'})

return self.imshow(imread(fname), origin='upper',
transform=source_proj,
Expand Down

0 comments on commit 8a0abd2

Please sign in to comment.