pisces.particles.base.ParticleDataset.rename_field#

ParticleDataset.rename_field(group_name: str, old_name: str, new_name: str)[source]#

Rename a field within a particle group.

This method renames the dataset (field) old_name to new_name in the specified group. Metadata is preserved during the renaming. This operation is destructive and cannot be undone.

Parameters:
  • group_name (str) – The name of the particle group containing the field.

  • old_name (str) – The current name of the field to rename.

  • new_name (str) – The new name to assign to the field.

Raises:
  • KeyError – If the specified group or field does not exist.

  • ValueError – If the new field name already exists in the group.