decode.convert module#
- coord_units(da: DataArray, coord_names: Sequence[str] | str, new_units: DataArray | Unit | str, /, equivalencies: Equivalency | None = None) DataArray [source]#
Convert the units of coordinate(s) of a DataArray.
- Parameters:
da (DataArray) – Input DataArray.
coord_names (Sequence[str] | str) – Name(s) of the coordinate(s) to be converted.
new_units (DataArray | Unit | str) – Units to be converted from the current ones. A DataArray that has units attribute is also accepted.
equivalencies (Equivalency | None) – Optional Astropy equivalencies.
- Returns:
DataArray with the units of the coordinate converted.
- Return type:
DataArray
- frame(da: DataArray, new_frame: str, /) DataArray [source]#
Convert the skycoord frame of a DataArray.
- Parameters:
da (DataArray) – Input DataArray.
new_frame (str) – Frame to be converted from the current one.
- Returns:
DataArray with the skycoord frame converted.
- Return type:
DataArray
- units(da: DataArray, new_units: DataArray | Unit | str, /, equivalencies: Equivalency | None = None) DataArray [source]#
Convert the units of a DataArray.
- Parameters:
da (DataArray) – Input DataArray.
new_units (DataArray | Unit | str) – Units to be converted from the current ones. A DataArray that has units attribute is also accepted.
equivalencies (Equivalency | None) – Optional Astropy equivalencies.
- Returns:
DataArray with the units converted.
- Return type:
DataArray