Skip to content

Commit

Permalink
Merge pull request #1446 from metno/contour_dir_file_info_fix
Browse files Browse the repository at this point in the history
Bug fix: infer info from geojson files in contour dir as well
  • Loading branch information
lewisblake authored Dec 9, 2024
2 parents 03caf2e + dd55523 commit f56f9d6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pyaerocom/aeroval/experiment_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,18 @@ def _info_from_contour_dir_file(file: pathlib.PosixPath):
"""
spl = os.path.basename(file.name).split(file.suffix)[0].split("_")

if len(spl) != 3:
raise ValueError(
f"invalid contour filename: {file}. Must "
f"contain exactly 2 underscores _ to separate "
f"name, vertical, and periods"
)
name = spl[0]
var_name = spl[1]
per = spl[2]
return (name, var_name, per)
if len(spl) == 3: # png, webp
name = spl[0]
var_name = spl[1]
per = spl[2]
return (name, var_name, per)
elif len(spl) == 2: # geojson
name = spl[1]
var_name = spl[0]
per = None
return (name, var_name, per)
else:
raise ValueError(f"invalid contour filename: {file}")

def _results_summary(self) -> dict[str, list[str]]:
if self.cfg.processing_opts.only_model_maps:
Expand Down

0 comments on commit f56f9d6

Please sign in to comment.