From ad9477531f2e5f199e60d026d59d3e8f7a7d8ab6 Mon Sep 17 00:00:00 2001 From: Daniel Holmberg Date: Thu, 5 Jun 2025 09:48:33 +0300 Subject: [PATCH 1/3] Calculate step length properly Updated step_length account for dt >= 24h --- neural_lam/datastore/mdp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neural_lam/datastore/mdp.py b/neural_lam/datastore/mdp.py index f3a81b725..6e75e3e4f 100644 --- a/neural_lam/datastore/mdp.py +++ b/neural_lam/datastore/mdp.py @@ -143,7 +143,8 @@ def step_length(self) -> int: """ da_dt = self._ds["time"].diff("time") - return (da_dt.dt.seconds[0] // 3600).item() + total_sec = da_dt.dt.total_seconds().isel(time=0) + return (total_sec // 3600).item() def get_vars_units(self, category: str) -> List[str]: """Return the units of the variables in the given category. From dad111a755c4e807f248d475abb70442052a06af Mon Sep 17 00:00:00 2001 From: Daniel Holmberg Date: Thu, 5 Jun 2025 10:09:05 +0300 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bad37866e..c98b4586e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Set ci/cd badges to refer to the new test matrix [\#130](https://github.com/mllam/neural-lam/pull/130) @SimonKamuk +- Fix step length calculation when dt >= 24h [\#141](https://github.com/mllam/neural-lam/pull/141) @deinal + ### Maintenance - update AWS GPU ci/cd to use ami with larger (200GB) root volume and ensure nvme drive is used for pip venvn From c28f8dafaf927329200e49c30914554cf2db65e5 Mon Sep 17 00:00:00 2001 From: Daniel Holmberg Date: Wed, 11 Jun 2025 16:49:39 +0300 Subject: [PATCH 3/3] Cast to int --- neural_lam/datastore/mdp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neural_lam/datastore/mdp.py b/neural_lam/datastore/mdp.py index 6e75e3e4f..879f8575f 100644 --- a/neural_lam/datastore/mdp.py +++ b/neural_lam/datastore/mdp.py @@ -143,7 +143,7 @@ def step_length(self) -> int: """ da_dt = self._ds["time"].diff("time") - total_sec = da_dt.dt.total_seconds().isel(time=0) + total_sec = da_dt.dt.total_seconds().isel(time=0).astype(int) return (total_sec // 3600).item() def get_vars_units(self, category: str) -> List[str]: