correct_bias#

geobricks.correct_bias(data: Dataset, variables: str | List[str] | Dict[str, float], bias_factors: float | Dict[str, float] | None = None, region: str | None = None, progressive: bool = False, progressive_factors: Dict[str, ndarray] | None = None) Dataset[source]#

Apply bias correction to climate variables using either constant or monthly progressive factors.

The correction is multiplicative:

corrected = original * factor

Parameters#

dataxr.Dataset

Input dataset containing the variables to be corrected.

variablesUnion[str, List[str], Dict[str, float]]

Variables to correct. Can be string, list of strings, or dict mapping variable names to factors.

bias_factorsOptional[Union[float, Dict[str, float]]], default None

Base multiplicative factors. Float for uniform factor, dict for per-variable factors.

regionOptional[str], default None

Region key for predefined factors from configuration.

progressivebool, default False

If True, apply monthly progressive factors instead of base factors.

progressive_factorsOptional[Dict[str, np.ndarray]], default None

Dict mapping variable names to 12-element monthly multiplier arrays.

Returns#

xr.Dataset

Dataset with bias correction applied to specified variables.

Raises#

ValueError

If variables parameter has invalid type.

Notes#

Multiplicative correction only. Progressive mode ignores base factors. Variables not found in dataset are skipped with warning.