1 units
units
1.1 Functions
| Name | Description |
|---|---|
| check_units | Validate that a DataArray has the expected units. |
| convert | Use pint-xarray for units conversion |
1.1.1 check_units
units.check_units(da, expected_units)Validate that a DataArray has the expected units.
1.1.1.1 Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The DataArray to check for units. | required |
| expected_units | str | The expected units string (e.g., ‘Dobson’, ’kg/m**2’). | required |
1.1.2 convert
units.convert(da, new_units)Use pint-xarray for units conversion
Example: # Detect the input data units (through the ‘units’ attribute) and # convert, if necessary, to ‘Dobson’ convert(total_ozone, ‘Dobson’)