set_dims

function of dascore.proc.basic source

set_dims(
    self: Patch ,
    **kwargs: str ,
)-> ‘PatchType’

Set dimension to non-dimensional coordinate.

Parameters

Parameter Description
**kwargs A mapping indicating old_dim: new_dim where new_dim refers to
the name of a non-dimensional coordinate which will become a
dimensional coordinate. The old dimensional coordinate will
become a non-dimensional coordinate.

Examples

import numpy as np
import dascore as dc
patch = dc.get_example_patch()
# add new coordinate, random numbers length of time dim
my_coord = np.random.random(patch.coord_shapes["time"])
out = (
   patch.update_coords(my_coord=("time", my_coord))  # add my_coord
   .set_dims(time="my_coord") # set mycoord as dim (rather than time)
)
assert "my_coord" in out.dims