Skip to content

Commit 43319e2

Browse files
committed
Fix _get_time_slice() end_time format when years <1000
1 parent 8b8faeb commit 43319e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

e3sm_diags/driver/utils/dataset_xr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,9 @@ def _get_time_slice(self, ds: xr.Dataset, filename: str) -> slice:
12541254

12551255
if self.is_sub_monthly:
12561256
start_time = f"{start_yr_str}-01-01"
1257-
end_time = f"{str(int(end_yr_str) + 1)}-01-01"
1257+
1258+
end_yr_str = str(int(end_yr_str) + 1).zfill(4)
1259+
end_time = f"{end_yr_str}-01-01"
12581260
else:
12591261
start_time = self._get_slice_with_bounds(ds, start_yr_str, "start")
12601262
end_time = self._get_slice_with_bounds(ds, end_yr_str, "end")

0 commit comments

Comments
 (0)