diff --git a/src/underworld3/checkpoint/disk_snapshot.py b/src/underworld3/checkpoint/disk_snapshot.py index 91716fcea..442e93579 100644 --- a/src/underworld3/checkpoint/disk_snapshot.py +++ b/src/underworld3/checkpoint/disk_snapshot.py @@ -38,6 +38,7 @@ import datetime import json import os +import warnings from typing import Any, Optional import numpy as np @@ -311,12 +312,20 @@ def write_snapshot(model, path: str) -> str: # path: lazy-allocated vars with _gvec == None have no data. mesh_vars = [v for v in mesh_vars if v._gvec is not None] - mesh.write_checkpoint( - mesh_safe, - outputPath=bulk_dir, - meshVars=mesh_vars, - index=0, - ) + # write_checkpoint is user-deprecated in favour of write_timestep, but + # the snapshot backend is a legitimate internal user: it relies on the + # `{base}.mesh.00000.h5` / `{base}.{var}.00000.h5` filename convention + # (consumed by the reload path below). Suppress the FutureWarning for + # this internal call rather than spam every snapshot. (Migrating the + # snapshot to write_timestep is tracked in #252.) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", FutureWarning) + mesh.write_checkpoint( + mesh_safe, + outputPath=bulk_dir, + meshVars=mesh_vars, + index=0, + ) mesh_records.append({ "name": mesh.name, diff --git a/src/underworld3/discretisation/discretisation_mesh.py b/src/underworld3/discretisation/discretisation_mesh.py index db9669098..4c003b07d 100644 --- a/src/underworld3/discretisation/discretisation_mesh.py +++ b/src/underworld3/discretisation/discretisation_mesh.py @@ -6039,7 +6039,6 @@ def checkpoint_xdmf( ) numCells = cells.shape[0] numCorners = cells.shape[1] - cellDim = topo["cells"].attrs["cell_dim"] topology_precision = cells.dtype.itemsize if numCorners <= 1: