credit.preblock.scaler
======================

.. py:module:: credit.preblock.scaler


Classes
-------

.. autoapisummary::

   credit.preblock.scaler.BridgeScalerTransformer


Module Contents
---------------

.. py:class:: BridgeScalerTransformer(scaler_path: str, variables: list[str], method: str)

   Bases: :py:obj:`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"


   .. py:attribute:: variables


   .. py:attribute:: method


   .. py:attribute:: scaler_path


   .. py:attribute:: scaler


   .. py:method:: forward(batch: dict) -> dict


