credit.preblock.regrid#

Classes#

Regridder

Regridding layer using weights file provided by the ESMF library.

Module Contents#

class credit.preblock.regrid.Regridder(weight_file, variables: list[str], data_types: list[str] = None, reshape_to_xy=True, flip_axis=None)#

Bases: credit.preblock.base.BasePreblock

Regridding layer using weights file provided by the ESMF library. :param weight_file: path to weights file :param variables: list of variable keys to regrid (e.g. [‘era5/prognostic/3d/T’]) :param data_types: list of data types to process (default: [‘input’, ‘target’]) :param reshape_to_xy: whether to reshape the flattened array back to xy coordinates :param flip_axis: axes to flip before regridding (e.g. [-1, -2]) :type flip_axis: list, tuple, or None

variables#
data_types = ['input', 'target']#
reshape_to_xy = True#
flip_axis = None#
n_a#
n_b#
dst_shape#
_W = None#
_W_device = None#
_get_W(device)#
_regrid(x: torch.Tensor) torch.Tensor#
forward(batch: dict) dict#