Skip to content

Commit

Permalink
Return radarcode as lowercase when parsing filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhoey committed Aug 21, 2023
1 parent 54d4d30 commit 58102db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vptstools/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
13 changes: 13 additions & 0 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 58102db

Please sign in to comment.