From 34efa7493bdf45dcb0fbcd3c31ed8609219fe43b Mon Sep 17 00:00:00 2001 From: danellecline Date: Wed, 21 Aug 2024 15:33:10 -0700 Subject: [PATCH] switch to jpg for coverage plot --- pbp/meta_gen/utils.py | 3 ++- tests/test_meta_generator.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pbp/meta_gen/utils.py b/pbp/meta_gen/utils.py index aa40318..ba7b4b1 100644 --- a/pbp/meta_gen/utils.py +++ b/pbp/meta_gen/utils.py @@ -99,6 +99,7 @@ def plot_daily_coverage(instrument_type: InstrumentType, df: pd.DataFrame, base_ :param base_dir: The base directory to store the plot :param start: The start date of the recordings :param end: The end date of the recordings + :return: The path to the plot file """ # Create a plot of the dataframe with the x-axis as the month, and the y-axis as the daily recording coverage, # which is percent of the day covered by recordings @@ -122,7 +123,7 @@ def plot_daily_coverage(instrument_type: InstrumentType, df: pd.DataFrame, base_ plot.set_title("Daily Coverage of icListen Recordings") elif instrument_type == InstrumentType.SOUNDTRAP: plot.set_title("Daily Coverage of SoundTrap Recordings") - plot_file = Path(base_dir) / f"soundtrap_coverage_{start:%Y%m%d}_{end:%Y%m%d}.png" + plot_file = Path(base_dir) / f"soundtrap_coverage_{start:%Y%m%d}_{end:%Y%m%d}.jpg" dpi = 300 fig = plot.get_figure() fig.set_size_inches(10, 5) diff --git a/tests/test_meta_generator.py b/tests/test_meta_generator.py index 2add659..f68fe69 100644 --- a/tests/test_meta_generator.py +++ b/tests/test_meta_generator.py @@ -80,7 +80,7 @@ def test_soundtrap_generator(): assert len(json_objects) == 5 # There should also be a coverage plot in the base json directory - coverage_plot = json_dir / "soundtrap_coverage_20230715_20230716.png" + coverage_plot = json_dir / "soundtrap_coverage_20230715_20230716.jpg" assert coverage_plot.exists() def test_iclisten_generator(): @@ -120,7 +120,7 @@ def test_iclisten_generator(): assert len(json_objects) == 145 # There should also be a coverage plot in the base json directory - coverage_plot = json_dir / "soundtrap_coverage_20230718_20230718.png" + coverage_plot = json_dir / "soundtrap_coverage_20230718_20230718.jpg" assert coverage_plot.exists() @@ -159,7 +159,7 @@ def test_nrs_generator(): assert len(json_objects) == 7 # There should also be a coverage plot in the base json directory - coverage_plot = json_dir / "soundtrap_coverage_20191024_20191024.png" + coverage_plot = json_dir / "soundtrap_coverage_20191024_20191024.jpg" assert coverage_plot.exists()