diff --git a/README.rst b/README.rst
index 01a38d9337..9d31b83471 100644
--- a/README.rst
+++ b/README.rst
@@ -184,6 +184,7 @@ The required dependencies to install Py-ART in addition to Python are:
* `pooch `_
* `Cython `_
* `setuptools `_
+* `cartopy `_
A working C/C++ compiler is required for some optional modules. An easy method
to install these dependencies is by using a
diff --git a/pyart/graph/gridmapdisplay.py b/pyart/graph/gridmapdisplay.py
index 80ca87b877..518ac6e89f 100644
--- a/pyart/graph/gridmapdisplay.py
+++ b/pyart/graph/gridmapdisplay.py
@@ -6,16 +6,10 @@
import warnings
+import cartopy
import matplotlib.pyplot as plt
import numpy as np
-try:
- import cartopy # noqa
-
- _CARTOPY_AVAILABLE = True
-except ImportError:
- _CARTOPY_AVAILABLE = False
-
try:
import metpy # noqa
@@ -76,11 +70,6 @@ class GridMapDisplay:
def __init__(self, grid, debug=False):
"""initalize the object."""
- # check that cartopy and xarray are available
- if not _CARTOPY_AVAILABLE:
- raise MissingOptionalDependency(
- "Cartopy is required to use GridMapDisplay but is not installed!"
- )
if not _XARRAY_AVAILABLE:
raise MissingOptionalDependency(
"Xarray is required to use GridMapDisplay but is not installed!"
diff --git a/requirements.txt b/requirements.txt
index c1fe381533..736c3569c0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,4 +11,5 @@ xradar>=0.5.0
pandas
mda-xdrlib
xarray!=0.21.0
+cartopy
pint
diff --git a/tests/graph/test_gridmapdisplay.py b/tests/graph/test_gridmapdisplay.py
index 7068bb142c..2180edf5ca 100644
--- a/tests/graph/test_gridmapdisplay.py
+++ b/tests/graph/test_gridmapdisplay.py
@@ -12,9 +12,6 @@
import pyart
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_gridmapdisplay_simple(outfile=None):
# test basic GridMapDisplat functionally.
grid = pyart.testing.make_target_grid()
@@ -26,9 +23,6 @@ def test_gridmapdisplay_simple(outfile=None):
fig.savefig(outfile)
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_gridmapdisplay_fancy(outfile=None):
import cartopy.crs as ccrs
@@ -79,9 +73,6 @@ def test_gridmapdisplay_fancy(outfile=None):
fig.savefig(outfile)
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_generate_filename():
grid = pyart.testing.make_target_grid()
display = pyart.graph.GridMapDisplay(grid)
@@ -89,9 +80,6 @@ def test_generate_filename():
assert isinstance(filename, str)
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_generate_titles():
grid = pyart.testing.make_target_grid()
display = pyart.graph.GridMapDisplay(grid)
@@ -103,9 +91,6 @@ def test_generate_titles():
assert isinstance(title, str)
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_error_raising():
grid = pyart.testing.make_target_grid()
display = pyart.graph.GridMapDisplay(grid)
diff --git a/tests/graph/test_plot_maxcappi.py b/tests/graph/test_plot_maxcappi.py
index 857183fcd2..0b05cf5b11 100644
--- a/tests/graph/test_plot_maxcappi.py
+++ b/tests/graph/test_plot_maxcappi.py
@@ -1,14 +1,10 @@
import os
import matplotlib.pyplot as plt
-import pytest
import pyart
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_plot_maxcappi_simple(outfile=None):
"""
Test the basic functionality of plot_maxcappi.
@@ -31,9 +27,6 @@ def test_plot_maxcappi_simple(outfile=None):
plt.close()
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_plot_maxcappi_with_save(outfile=None):
"""
Test plot_maxcappi and save the output to a file.
@@ -62,9 +55,6 @@ def test_plot_maxcappi_with_save(outfile=None):
assert os.path.exists(outfile), "The plot was not saved as expected."
-@pytest.mark.skipif(
- not pyart.graph.gridmapdisplay._CARTOPY_AVAILABLE, reason="Cartopy is not installed"
-)
def test_plot_maxcappi_with_all_options(outfile=None):
"""
Test plot_maxcappi with all options enabled.