sup3r.preprocessing.batch_handling.Batch

class Batch(low_res, high_res)[source]

Bases: object

Batch of low_res and high_res data

Store low and high res data

Parameters:
  • low_res (np.ndarray) – 4D | 5D array (batch_size, spatial_1, spatial_2, features) (batch_size, spatial_1, spatial_2, temporal, features)

  • high_res (np.ndarray) – 4D | 5D array (batch_size, spatial_1, spatial_2, features) (batch_size, spatial_1, spatial_2, temporal, features)

Methods

get_coarse_batch(high_res, s_enhance[, ...])

Coarsen high res data and return Batch with high res and low res data

Attributes

high_res

Get the high-resolution data for the batch.

low_res

Get the low-resolution data for the batch.

shape

Get the (low_res_shape, high_res_shape) shapes.

property shape

Get the (low_res_shape, high_res_shape) shapes.

property low_res

Get the low-resolution data for the batch.

property high_res

Get the high-resolution data for the batch.

classmethod get_coarse_batch(high_res, s_enhance, t_enhance=1, temporal_coarsening_method='subsample', hr_features_ind=None, features=None, smoothing=None, smoothing_ignore=None)[source]

Coarsen high res data and return Batch with high res and low res data

Parameters:
  • high_res (np.ndarray) – 4D | 5D array (batch_size, spatial_1, spatial_2, features) (batch_size, spatial_1, spatial_2, temporal, features)

  • s_enhance (int) – Factor by which to coarsen spatial dimensions of the high resolution data

  • t_enhance (int) – Factor by which to coarsen temporal dimension of the high resolution data

  • temporal_coarsening_method (str) – Method to use for temporal coarsening. Can be subsample, average, min, max, or total

  • hr_features_ind (list | np.ndarray | None) – List/array of feature channel indices that are used for generative output, without any feature indices used only for training.

  • features (list | None) – Ordered list of training features input to the generative model

  • smoothing (float | None) – Standard deviation to use for gaussian filtering of the coarse data. This can be tuned by matching the kinetic energy of a low resolution simulation with the kinetic energy of a coarsened and smoothed high resolution simulation. If None no smoothing is performed.

  • smoothing_ignore (list | None) – List of features to ignore for the smoothing filter. None will smooth all features if smoothing kwarg is not None

Returns:

Batch – Batch instance with low and high res data