From 58102db84994d88f6cc2d75bf1006aff1d639c5e Mon Sep 17 00:00:00 2001 From: stijnvanhoey Date: Mon, 21 Aug 2023 14:29:30 +0200 Subject: [PATCH] Return radarcode as lowercase when parsing filenames --- src/vptstools/s3.py | 2 +- tests/test_s3.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/vptstools/s3.py b/src/vptstools/s3.py index 686aa93..be70c4b 100644 --- a/src/vptstools/s3.py +++ b/src/vptstools/s3.py @@ -106,7 +106,7 @@ def parse_file_name(file_name): file_name = Path(file_name).name country, radar, data_type, year, month, day, hour, minute = match.groups() radar_code = country + radar - return radar_code, data_type, year, month, day, hour, minute, file_name + return radar_code.lower(), data_type, year, month, day, hour, minute, file_name else: raise ValueError("File name is not a valid ODIM h5 file.") diff --git a/tests/test_s3.py b/tests/test_s3.py index f66b358..01b39cf 100644 --- a/tests/test_s3.py +++ b/tests/test_s3.py @@ -85,6 +85,19 @@ class TestOdimFilePath: "plrze_vp_20201027T172000Z_0x9.h5", ), ), + ( + "uva/hdf5/2008/02/15/NLDBL_vp_20080215T0000_NL50_v0-3-20.h5", + ( + "nldbl", + "vp", + "2008", + "02", + "15", + "00", + "00", + "NLDBL_vp_20080215T0000_NL50_v0-3-20.h5", + ), + ), ], ) def test_parse_file_name(self, file_path, components):