Skip to content

Commit

Permalink
fix outdated discrimination between webp/png and geojson, as filename…
Browse files Browse the repository at this point in the history
  • Loading branch information
charlienegri authored and thorbjoernl committed Feb 11, 2025
1 parent 6611aae commit ac8f3f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions pyaerocom/aeroval/experiment_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,7 @@ def _info_from_contour_dir_file(file: pathlib.PosixPath):
spl = os.path.basename(file.name).split(suffix)[0].split("_")

if len(spl) == 3:
if suffix == ".png" or suffix == ".webp":
name = spl[0]
var_name = spl[1]
per = spl[2]
return (name, var_name, per)
elif suffix == ".geojson":
if suffix == ".png" or suffix == ".webp" or suffix == ".geojson":
name = spl[1]
var_name = spl[0]
per = spl[2]
Expand Down
4 changes: 2 additions & 2 deletions tests/aeroval/test_experiment_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def test_ExperimentOutput__info_from_map_file_error(filename: str):


def test_ExperimentOutput__info_from_contour_dir_file_webp():
file = pathlib.PosixPath("path/to/name_vertical_period.webp")
file = pathlib.PosixPath("path/to/var_name_period.webp")
output = ExperimentOutput._info_from_contour_dir_file(file)
assert output == ("name", "vertical", "period")
assert output == ("name", "var", "period")


def test_ExperimentOutput__info_from_contour_dir_file_geojson():
Expand Down

0 comments on commit ac8f3f9

Please sign in to comment.