3939import cartopy .mpl .feature_artist as feature_artist
4040import cartopy .mpl .patch as cpatch
4141from cartopy .mpl .slippy_image_artist import SlippyImageArtist
42+ from cartopy .io import Downloader
4243
4344
4445assert mpl .__version__ >= '3.1' , \
@@ -988,9 +989,13 @@ def stock_img(self, name='ne_shaded'):
988989 """
989990 Add a standard image to the map.
990991
991- Currently, the only (and default) option is a downsampled version of
992- the Natural Earth shaded relief raster.
992+ Currently, there are 2 options:
993993
994+ 1. 'ne_shaded'(default) a downsampled version of the Natural Earth
995+ shaded relief raster.
996+ 2. 'etopo' a downsampled version of global relief model of Earth's
997+ surface that integrates land topography and ocean bathymetry. This
998+ option is the same as the etopo from Basemap.
994999 """
9951000 if name == 'ne_shaded' :
9961001 import os
@@ -999,6 +1004,19 @@ def stock_img(self, name='ne_shaded'):
9991004 'raster' , 'natural_earth' ,
10001005 '50-natural-earth-1-downsampled.png' )
10011006
1007+ return self .imshow (imread (fname ), origin = 'upper' ,
1008+ transform = source_proj ,
1009+ extent = [- 180 , 180 , - 90 , 90 ])
1010+ elif name == 'etopo' :
1011+ import os
1012+ source_proj = ccrs .PlateCarree ()
1013+
1014+ url_template = 'https://www.ngdc.noaa.gov/mgg/image/{name}.jpg'
1015+ target_path_template = os .path .join (config ["data_dir" ],
1016+ 'raster' , '{name}.jpg' )
1017+ d = Downloader (url_template , target_path_template )
1018+ fname = d .path ({'name' : 'color_etopo1_ice_low' })
1019+
10021020 return self .imshow (imread (fname ), origin = 'upper' ,
10031021 transform = source_proj ,
10041022 extent = [- 180 , 180 , - 90 , 90 ])
0 commit comments