sdf_xarray.dataset_accessor.EpochAccessor

sdf_xarray.dataset_accessor.EpochAccessor#

class sdf_xarray.dataset_accessor.EpochAccessor(xarray_obj)[source]#

Bases: object

Parameters:

xarray_obj (Dataset)

__init__(xarray_obj)[source]#
Parameters:

xarray_obj (Dataset)

Methods

__init__(xarray_obj)

rescale_coords(multiplier, unit_label, ...)

Rescales specified X and Y coordinates in the Dataset by a given multiplier and updates the unit label attribute.

rescale_coords(multiplier, unit_label, coord_names)[source]#

Rescales specified X and Y coordinates in the Dataset by a given multiplier and updates the unit label attribute.

Parameters:
  • multiplier (float) – The factor by which to multiply the coordinate values (e.g., 1e6 for meters to microns).

  • unit_label (str) – The new unit label for the coordinates (e.g., “µm”).

  • coord_names (str or list of str) – The name(s) of the coordinate variable(s) to rescale. If a string, only that coordinate is rescaled. If a list, all listed coordinates are rescaled.

Returns:

A new Dataset with the updated and rescaled coordinates.

Return type:

xr.Dataset

Examples

# Convert X, Y, and Z from meters to microns >>> ds_in_microns = ds.epoch.rescale_coords(1e6, “µm”, coord_names=[“X_Grid”, “Y_Grid”, “Z_Grid”])

# Convert only X to millimeters >>> ds_in_mm = ds.epoch.rescale_coords(1000, “mm”, coord_names=”X_Grid”)