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 .vector_transform import vector_scalar_to_grid
43+ from cartopy .io import Downloader
4244
4345
4446assert mpl .__version__ >= '3.1' , \
@@ -988,9 +990,13 @@ def stock_img(self, name='ne_shaded'):
988990 """
989991 Add a standard image to the map.
990992
991- Currently, the only (and default) option is a downsampled version of
992- the Natural Earth shaded relief raster.
993+ Currently, there are 2 options:
993994
995+ 1. 'ne_shaded'(default) a downsampled version of the Natural Earth
996+ shaded relief raster.
997+ 2. 'etopo' a downsampled version of global relief model of Earth's
998+ surface that integrates land topography and ocean bathymetry. This
999+ option is the same as the etopo from Basemap.
9941000 """
9951001 if name == 'ne_shaded' :
9961002 import os
@@ -999,6 +1005,19 @@ def stock_img(self, name='ne_shaded'):
9991005 'raster' , 'natural_earth' ,
10001006 '50-natural-earth-1-downsampled.png' )
10011007
1008+ return self .imshow (imread (fname ), origin = 'upper' ,
1009+ transform = source_proj ,
1010+ extent = [- 180 , 180 , - 90 , 90 ])
1011+ elif name == 'etopo' :
1012+ import os
1013+ source_proj = ccrs .PlateCarree ()
1014+
1015+ url_template = 'https://www.ngdc.noaa.gov/mgg/image/{name}.jpg'
1016+ target_path_template = os .path .join (config ["data_dir" ],
1017+ 'raster' , '{name}.jpg' )
1018+ d = Downloader (url_template , target_path_template )
1019+ fname = d .path ({'name' : 'color_etopo1_ice_low' })
1020+
10021021 return self .imshow (imread (fname ), origin = 'upper' ,
10031022 transform = source_proj ,
10041023 extent = [- 180 , 180 , - 90 , 90 ])
0 commit comments