From abd599b07e544f6cdff6d4883a99c7e82dc8bf05 Mon Sep 17 00:00:00 2001 From: Mathias157 Date: Sun, 20 Oct 2024 15:56:16 +0200 Subject: [PATCH] Making the plot maps function work for any cases in the commodity input --- src/pybalmorel/plotting/maps_balmorel.py | 1 + tests/test_postprocessing.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pybalmorel/plotting/maps_balmorel.py b/src/pybalmorel/plotting/maps_balmorel.py index 71e5c2d..cd1aee8 100644 --- a/src/pybalmorel/plotting/maps_balmorel.py +++ b/src/pybalmorel/plotting/maps_balmorel.py @@ -159,6 +159,7 @@ def plot_map(path_to_result: str, font_hub = 12 #Font size of hub labels font_region = 10 #Font size of region labels line_decimals = 1 #Number of decimals shown for line capacities + COMMODITY = COMMODITY.capitalize() # For Elec if COMMODITY == 'Electricity': line_width_constant = .2 #Constant related to thickness of lines: the higher the number, the narrower the lines will be diff --git a/tests/test_postprocessing.py b/tests/test_postprocessing.py index d7d07f4..2c9fd72 100644 --- a/tests/test_postprocessing.py +++ b/tests/test_postprocessing.py @@ -54,8 +54,8 @@ def test_MainResults(): assert 'electricity_profile.png' in os.listdir('tests/output') and 'heat_profile.png' in os.listdir('tests/output') and 'hydrogen_profile.png' in os.listdir('tests/output') # Test map - fig, ax = res.plot_map('SC2', 'Electricity', 2050) + fig, ax = res.plot_map('SC2', 'elecTriciTY', 2050) fig.savefig('tests/output/electricity_map.png') - fig, ax = res.plot_map('SC2', 'Hydrogen', 2050) + fig, ax = res.plot_map('SC2', 'HYDROGEN', 2050) fig.savefig('tests/output/hydrogen_map.png') assert 'electricity_map.png' in os.listdir('tests/output') and 'hydrogen_map.png' in os.listdir('tests/output') \ No newline at end of file