Skip to content

data.prep_data_array

Import path: earth2studio.data.prep_data_array

View source on GitHub

Documentation

Prepares a data array from a data source for inference workflows by converting the data array to a torch tensor and the coordinate system to an OrderedDict.

If desired, xarray interpolation/regridding in the spatial domain can be used by passing a target coordinate system via the optional interp_to argument.

Parameters:

  • da (DataArray) –

    Input data array

  • device (device, default: 'cpu' ) –

    Torch devive to load data tensor to, by default "cpu"

  • interp_to (CoordSystem, default: None ) –

    If provided, the fetched data will be interpolated to the coordinates specified by lat/lon arrays in this CoordSystem

  • interp_method (str, default: 'nearest' ) –

    Interpolation method to use with xarray (by default 'nearest')

Returns:

  • tuple[Tensor, CoordSystem] –

    Tuple containing output tensor and coordinate OrderedDict