credit.ensemble.utils
=====================

.. py:module:: credit.ensemble.utils


Functions
---------

.. autoapisummary::

   credit.ensemble.utils.add_spatially_correlated_noise
   credit.ensemble.utils.hemispheric_rescale


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

.. py:function:: add_spatially_correlated_noise(x, correlation_scale=10)

   Add spatially correlated Gaussian noise using a convolutional filter.

   Applies correlated noise independently at each time step.

   :param x: Input tensor of shape (B, C, T, H, W).
   :type x: torch.Tensor
   :param correlation_scale: Standard deviation of the Gaussian kernel in pixels.
   :type correlation_scale: float

   :returns:

             Tensor of the same shape as input with added spatially
                 correlated noise.
   :rtype: torch.Tensor


.. py:function:: hemispheric_rescale(perturbation, latitudes, north_scale=1.0, south_scale=1.0)

   Linearly interpolate scaling in the tropics between 20S and 20N.

   :param latitudes: Tensor of shape (H,) with latitude values
                     ranging from +90 to -90.
   :type latitudes: torch.Tensor


