# xarray.coding.variables.CFScaleOffsetCoder

### *class* xarray.coding.variables.CFScaleOffsetCoder(decode_times=False, decode_timedelta=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/coding/variables.py#L505-L573)

Scale and offset variables according to CF conventions.

Follows the formula:
: decode_values = encoded_values \* scale_factor + add_offset

#### \_\_init_\_(decode_times=False, decode_timedelta=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/coding/variables.py#L512-L518)

### Methods

| [`__init__`](#xarray.coding.variables.CFScaleOffsetCoder.__init__)([decode_times, decode_timedelta])   |                                                   |
|-----------------------------------------------------------------------------------------------|---------------------------------------------------|
| `decode`(variable[, name])                                                                    | Convert a decoded variable to an encoded variable |
| `encode`(variable[, name])                                                                    | Convert an encoded variable to a decoded variable |
