credit.preblock.scaler#

Classes#

BridgeScalerTransformer

Scaling preblock using a fitted bridgescaler dict.

Module Contents#

class credit.preblock.scaler.BridgeScalerTransformer(scaler_path: str, variables: list[str], method: str)#

Bases: credit.preblock.base.BasePreblock

Scaling preblock using a fitted bridgescaler dict.

Applies per-variable z-score scaling (or its inverse) to tensors in a nested batch dict of the form batch[source][data_type][var_key].

The scaler dict must have been fit with bridgescaler.scale_var_dict using the same nested structure and saved with bridgescaler.save_scaler_dict.

Example config:

type: "bridgescaler_transform"
args:
    scaler_path: "/path/to/scaler.json"
    variables:
        - "era5/prognostic/3d/T"
        - "era5/prognostic/3d/U"
    method: "transform"
variables#
method#
scaler_path#
scaler#
forward(batch: dict) dict#