From aa8af14f2c6859221ea050e593496915336e67df Mon Sep 17 00:00:00 2001 From: Arthur Eigenbrot Date: Tue, 4 Feb 2025 10:38:44 -0700 Subject: [PATCH] Add `DKISTUserWarning` if calling `TiledDataset.plot` on stale metadata file --- dkist/dataset/tiled_dataset.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dkist/dataset/tiled_dataset.py b/dkist/dataset/tiled_dataset.py index b1cbb7af..2d04bb51 100644 --- a/dkist/dataset/tiled_dataset.py +++ b/dkist/dataset/tiled_dataset.py @@ -19,7 +19,7 @@ from dkist.io.file_manager import FileManager, StripedExternalArray from dkist.io.loaders import AstropyFITSLoader -from dkist.utils.exceptions import DKISTDeprecationWarning +from dkist.utils.exceptions import DKISTDeprecationWarning, DKISTUserWarning from .dataset import Dataset from .utils import dataset_info_str @@ -212,6 +212,11 @@ def plot(self, slice_index, share_zscale=False, figure=None, swap_tile_limits: L if swap_tile_limits not in ["x", "y", "xy", None]: raise RuntimeError("swap_tile_limits must be one of ['x', 'y', 'xy', None]") + if len(self.meta.get("history", {}).get("entries", [])) == 0: + warnings.warn("The metadata ASDF file that produced this dataset is out of date and " + "will result in incorrect plots. Please re-download the metadata ASDF file.", + DKISTUserWarning) + if isinstance(slice_index, int): slice_index = (slice_index,) vmin, vmax = np.inf, 0