Skip to content

Transition to "unit" instead of "units" within xarray dataset-related code

Description

I noticed (while making this PR to xarray) that xarray 0.19.0 now supports:

    def _get_units_from_attrs(da):
        if da.attrs.get("units"):
            units = " [{}]".format(da.attrs["units"])
        elif da.attrs.get("unit"):
            units = " [{}]".format(da.attrs["unit"])
        else:
            units = ""
        return units

from: https://github.com/pydata/xarray/blob/v0.19.0/xarray/plot/utils.py#L478

NB backwards compatibility might be still relevant, I would suggest doing this conversion with the dataset conversion of #255 (closed).

@AdriaanRol

Motivation

Use "unit" instead of "units" for settables/gettables attribute.


You can also find us on Slack. For reference, the issues workflow is described in the contribution guidelines.

Edited by Victor Negîrneac