diff --git a/CHANGES.rst b/CHANGES.rst index 9f18f06a..d9e51d1c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -34,6 +34,7 @@ Bug fixes * `creep_weights` now correctly handles the case where the grid is small, `n` is large, and `mode=wrap`. (:issue:`367`). * Fixed a bug in ``tasmin_from_dtr`` and ``tasmax_from_dtr``, when `dtr` units differed from tasmin/max. (:pull:`372`). * Fixed a bug where the requested chunking would be ignored when saving a dataset (:pull:`379`). +* The missing value check in ``health_checks`` will no longer crasg if a variable has no time dimension. (:pull:`382`). v0.8.3 (2024-02-28) ------------------- diff --git a/xscen/diagnostics.py b/xscen/diagnostics.py index 41c9192c..c916cf53 100644 --- a/xscen/diagnostics.py +++ b/xscen/diagnostics.py @@ -262,11 +262,16 @@ def _message(): for method, kwargs in missing.items(): kwargs.setdefault("freq", "YS") for v in ds.data_vars: - ms = getattr(xc.core.missing, method)(ds[v], **kwargs) - if ms.any(): - _error( - f"The variable '{v}' has missing values according to the '{method}' method.", - "missing", + if "time" in ds[v].dims: + ms = getattr(xc.core.missing, method)(ds[v], **kwargs) + if ms.any(): + _error( + f"The variable '{v}' has missing values according to the '{method}' method.", + "missing", + ) + else: + logger.info( + f"Variable '{v}' has no time dimension. The missing data check will be skipped.", ) if flags is not None: