Skip to content

Commit

Permalink
Don't try to find max_diff from empty datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Jan 30, 2024
1 parent 2304460 commit aafc20c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion damnit/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aafc20c

Please sign in to comment.