From 04f31d5716aa5de9d0c6d08bce4bdae6f02799ee Mon Sep 17 00:00:00 2001 From: Lesley De Cruz Date: Sun, 22 Feb 2026 14:48:39 +0100 Subject: [PATCH 1/3] Allow tiny round-off exceedence of max_resolution in spatial check --- mlcast_dataset_validator/checks/coords/spatial.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mlcast_dataset_validator/checks/coords/spatial.py b/mlcast_dataset_validator/checks/coords/spatial.py index 9abbede..dfa6047 100644 --- a/mlcast_dataset_validator/checks/coords/spatial.py +++ b/mlcast_dataset_validator/checks/coords/spatial.py @@ -1,4 +1,5 @@ import xarray as xr +import math from ...specs.reporting import ValidationReport, log_function_call from . import SECTION_ID as PARENT_SECTION_ID @@ -35,9 +36,10 @@ def check_spatial_requirements( if len(x_vals) > 1 and len(y_vals) > 1: x_res = abs(float(x_vals[1] - x_vals[0])) y_res = abs(float(y_vals[1] - y_vals[0])) + max_resolution_m = max_resolution_km * 1000 if ( - x_res <= max_resolution_km * 1000 - and y_res <= max_resolution_km * 1000 + (x_res <= max_resolution_m or math.isclose(x_res, max_resolution_m, rel_tol=1e-6)) + and (y_res <= max_resolution_m or math.isclose(y_res, max_resolution_m, rel_tol=1e-6)) ): report.add( SECTION_ID, From a3d3856dcc038990ccf09f751ac2a7fbdbe32f9c Mon Sep 17 00:00:00 2001 From: Lesley De Cruz Date: Sun, 22 Feb 2026 15:49:17 +0100 Subject: [PATCH 2/3] Fix indentation in spatial.py --- mlcast_dataset_validator/checks/coords/spatial.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mlcast_dataset_validator/checks/coords/spatial.py b/mlcast_dataset_validator/checks/coords/spatial.py index dfa6047..cd2b2d5 100644 --- a/mlcast_dataset_validator/checks/coords/spatial.py +++ b/mlcast_dataset_validator/checks/coords/spatial.py @@ -1,6 +1,7 @@ -import xarray as xr import math +import xarray as xr + from ...specs.reporting import ValidationReport, log_function_call from . import SECTION_ID as PARENT_SECTION_ID @@ -38,8 +39,11 @@ def check_spatial_requirements( y_res = abs(float(y_vals[1] - y_vals[0])) max_resolution_m = max_resolution_km * 1000 if ( - (x_res <= max_resolution_m or math.isclose(x_res, max_resolution_m, rel_tol=1e-6)) - and (y_res <= max_resolution_m or math.isclose(y_res, max_resolution_m, rel_tol=1e-6)) + x_res <= max_resolution_m + or math.isclose(x_res, max_resolution_m, rel_tol=1e-6) + ) and ( + y_res <= max_resolution_m + or math.isclose(y_res, max_resolution_m, rel_tol=1e-6) ): report.add( SECTION_ID, From 35930f261bec00c99784bd9ebf6f77fdf400f814 Mon Sep 17 00:00:00 2001 From: Lesley De Cruz Date: Wed, 25 Feb 2026 12:22:43 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md with PR #30. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ccd33a..f8179bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Make checks on max spatial resolution (1km) more lenient using math.isclose [\#30](https://github.com/mlcast-community/mlcast-dataset-validator/pull/30), @ladc - Detect Zarr v3 format from store files (`zarr.json`) instead of relying on `getattr(ds, "zarr_format", 2)` which always defaulted to v2, causing v3 stores to incorrectly fail the consolidated metadata check [\#27](https://github.com/mlcast-community/mlcast-dataset-validator/pull/27), @franchg ## [v0.2.0](https://github.com/mlcast-community/mlcast-dataset-validator/releases/tag/v0.2.0)