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 8a22d6f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Binary file removed lib/cartopy/data/raster/etopo1.jpg
Binary file not shown.
25 changes: 18 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,16 @@ 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)
cfg = {('etopo1'): d}
dl = Downloader.from_config(('etopo1'),config_dict = cfg)
fname = dl.path({'name':'color_etopo1_ice_low'})

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

0 comments on commit 8a22d6f

Please sign in to comment.