Skip to content

Commit

Permalink
fix #184: cartopy dependency (#185)
Browse files Browse the repository at this point in the history
* fix: cartopy `outline_patch` deprecation

* test: add tests for plots
  • Loading branch information
lkstrp authored Jul 29, 2024
1 parent 8885715 commit 5e064da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions powerplantmatching/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def powerplant_map(

fig.tight_layout(pad=0.5)
if cartopy_present:
ax.outline_patch.set_visible(False)
ax.spines["geo"].set_visible(False)
return fig, ax


Expand Down Expand Up @@ -389,7 +389,7 @@ def draw_basemap(
ax.coastlines(linewidth=0.4, zorder=-1, resolution=resolution)
border = cartopy.feature.BORDERS.with_scale(resolution)
ax.add_feature(border, linewidth=0.3)
ax.outline_patch.set_visible(False)
ax.spines["geo"].set_visible(False)
if fillcontinents:
land = cartopy.feature.LAND.with_scale(resolution)
ax.add_feature(land, facecolor="lavender", alpha=0.25)
Expand Down
21 changes: 21 additions & 0 deletions test/test_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

import powerplantmatching as pm
from powerplantmatching import data

config = pm.get_config()
sources = [s if isinstance(s, str) else list(s)[0] for s in config["matching_sources"]]

if not config["entsoe_token"] and "ENTSOE" in sources:
sources.remove("ENTSOE")


def test_powerplant_map():
pm.plot.powerplant_map(pm.powerplants())


@pytest.mark.parametrize("source", sources)
def test_source_plots(source):
func = getattr(data, source)
df = func(update=True)
df.powerplant.plot_map(figsize=(11, 8))

0 comments on commit 5e064da

Please sign in to comment.