credit.postblock.scaler#

Classes#

BridgeScalerTransformer

Scaling postblock using a fitted bridgescaler dict.

Module Contents#

class credit.postblock.scaler.BridgeScalerTransformer(scaler_path: str, variables: list[str], method: str, key: str = 'y_processed')#

Bases: credit.postblock.base.BasePostblock

Scaling postblock using a fitted bridgescaler dict.

Applies per-variable scaling (or its inverse) to the nested prediction dict at batch_dict[key], which has the form batch_dict[key][source][var_key] where var_key is "source/field_type/dim/varname" (e.g. "era5/prognostic/3d/T").

Defaults to operating on "y_processed" — the nested dict written by Reconstruct. Use method="inverse_transform" to convert normalized predictions back to physical units before physics fixers.

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: "inverse_transform"
variables#
method#
scaler_path#
key = 'y_processed'#
scaler#
forward(batch_dict: dict) dict#