4141import cartopy .mpl .patch as cpatch
4242from cartopy .mpl .slippy_image_artist import SlippyImageArtist
4343from cartopy .vector_transform import vector_scalar_to_grid
44+ from cartopy .io import Downloader
4445
4546
4647assert mpl .__version__ >= '1.5.1' , ('Cartopy is only supported with '
@@ -1005,9 +1006,13 @@ def stock_img(self, name='ne_shaded'):
10051006 """
10061007 Add a standard image to the map.
10071008
1008- Currently, the only (and default) option is a downsampled version of
1009- the Natural Earth shaded relief raster.
1009+ Currently, there are 2 options:
10101010
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.
10111016 """
10121017 if name == 'ne_shaded' :
10131018 import os
@@ -1016,6 +1021,19 @@ def stock_img(self, name='ne_shaded'):
10161021 'raster' , 'natural_earth' ,
10171022 '50-natural-earth-1-downsampled.png' )
10181023
1024+ return self .imshow (imread (fname ), origin = 'upper' ,
1025+ transform = source_proj ,
1026+ extent = [- 180 , 180 , - 90 , 90 ])
1027+ elif name == 'etopo' :
1028+ import os
1029+ source_proj = ccrs .PlateCarree ()
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' })
1036+
10191037 return self .imshow (imread (fname ), origin = 'upper' ,
10201038 transform = source_proj ,
10211039 extent = [- 180 , 180 , - 90 , 90 ])
0 commit comments