Skip to content

Commit

Permalink
Always include minuts in initialization time
Browse files Browse the repository at this point in the history
To ensure that our Zarr groups have a uniform format, we append ":00" to
the init time if the ingested NetCDF file has only a year, month, day,
and hour for the init time.
  • Loading branch information
esheehan-gsl committed Jun 6, 2023
1 parent 05a9ebd commit a1a535d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/unified_graphics/etl/diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def parse_diag_filename(filename: str) -> DiagMeta:
init_time = f"{year}-{month}-{day}T{hour}"
if minute:
init_time += ":" + minute
else:
init_time += ":00"

return DiagMeta(
variables, loop, init_time, model, system, domain, frequency, background
Expand Down
6 changes: 3 additions & 3 deletions tests/etl/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"ncdiag_conv_ps_anl.2022050514.nc4",
["ps"],
"anl",
"2022-05-05T14",
"2022-05-05T14:00",
None,
None,
None,
Expand All @@ -76,7 +76,7 @@
"ncdiag_conv_uv_ges.2023010204.nc4",
["u", "v"],
"ges",
"2023-01-02T04",
"2023-01-02T04:00",
None,
None,
None,
Expand Down Expand Up @@ -193,7 +193,7 @@ def test_load(
variable, loop, init_time, model, system, domain, frequency, background
)
expected_init_time = (
f"{init_time[:4]}-{init_time[4:6]}-{init_time[6:8]}T{init_time[-2:]}"
f"{init_time[:4]}-{init_time[4:6]}-{init_time[6:8]}T{init_time[-2:]}:00"
)
expected = diag_dataset(
variable,
Expand Down
2 changes: 1 addition & 1 deletion tests/etl/test_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def zarr_file(tmp_path):

@pytest.fixture(scope="module")
def analysis():
init_time = "2022-05-05T14"
init_time = "2022-05-05T14:00"
model = "RTMA"
system = "WCOSS"
domain = "CONUS"
Expand Down

0 comments on commit a1a535d

Please sign in to comment.