Coverage for check_python_install/check_cartopy.py: 17%

12 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2024-05-10 06:54 +0200

1""" 

2@file 

3@brief Test for :epkg:`cartopy`. 

4""" 

5import matplotlib.pyplot as plt 

6 

7 

8def check_cartopy(): 

9 """ 

10 Runs a sample with :epkg:`cartopy`. 

11 Returns a graph. 

12 """ 

13 # delayed import to avoid failure 

14 import cartopy.crs as ccrs 

15 import cartopy.feature as cfeature 

16 fig = plt.figure(figsize=(7, 7)) 

17 ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) 

18 ax.set_extent([-5, 10, 42, 52]) 

19 ax.add_feature(cfeature.OCEAN) 

20 ax.add_feature(cfeature.COASTLINE) 

21 ax.add_feature(cfeature.BORDERS, linestyle=':') 

22 ax.set_title('France') 

23 return ax