From aafc20ce5a1dc897b5f8f9c2a975ec0fbc1a58f7 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Tue, 30 Jan 2024 12:39:15 +0000 Subject: [PATCH] Don't try to find max_diff from empty datasets --- damnit/migrations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/damnit/migrations.py b/damnit/migrations.py index 57be261e..71f8245c 100644 --- a/damnit/migrations.py +++ b/damnit/migrations.py @@ -202,7 +202,7 @@ def migrate_v0_to_v1(db, db_dir, dry_run): if 'max_diff' in ds.attrs: max_diffs[(proposal, run_no, name)] = ds.attrs['max_diff'].item() - elif ds.ndim == 1 and np.issubdtype(ds.dtype, np.number): + elif ds.ndim == 1 and ds.size > 0 and np.issubdtype(ds.dtype, np.number): data = ds[()] max_diff = abs(np.nanmax(data) - np.nanmin(data)).item() max_diffs[(proposal, run_no, name)] = max_diff