rename_legacy_dimensions#

movement.io.load.rename_legacy_dimensions(ds)[source]#

Rename deprecated plural dimension names to singular form.

Datasets created with movement versions prior to 0.17.0 used plural dimension names ("keypoints", "individuals"). This function renames them to the current singular convention ("keypoint", "individual").

If no legacy dimensions are found, the dataset is returned unchanged.

Deprecated since version 0.17.0: This function is deprecated and will be removed in a future release. It is a temporary migration helper for datasets created with movement versions prior to 0.17.0.

Parameters:

ds (Dataset) – A dataset containing legacy plural dimension names.

Returns:

Dataset with dimension names updated to singular form.

Return type:

Dataset

Examples

Load a dataset created with movement < 0.17.0 and rename its dimensions to the current convention:

>>> import xarray as xr
>>> from movement.io.load import rename_legacy_dimensions
>>> ds = xr.open_dataset("old_dataset.nc")
>>> ds = rename_legacy_dimensions(ds)
>>> ds.to_netcdf("new_dataset.nc")