credit.boundary_padding
=======================

.. py:module:: credit.boundary_padding


Classes
-------

.. autoapisummary::

   credit.boundary_padding.TensorPadding


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

.. py:class:: TensorPadding(mode='earth', pad_lat=(40, 40), pad_lon=(40, 40), **kwargs)

   .. py:attribute:: mode
      :value: 'earth'



   .. py:attribute:: pad_NS
      :value: (40, 40)



   .. py:attribute:: pad_WE
      :value: (40, 40)



   .. py:method:: pad(x)

      Apply padding to the tensor based on the specified mode.

      :param x: Input tensor of shape (batch, var, time, lat, lon).
      :type x: torch.Tensor

      :returns: The padded tensor.
      :rtype: torch.Tensor



   .. py:method:: unpad(x)

      Remove padding from the tensor based on the specified mode.

      :param x: Padded tensor of shape (batch, var, time, lat, lon).
      :type x: torch.Tensor

      :returns: The unpadded tensor.
      :rtype: torch.Tensor



   .. py:method:: _earth_padding(x)

      Apply earth padding to the tensor (poles and circular padding).

      :param x: Input tensor.
      :type x: torch.Tensor

      :returns: The padded tensor.
      :rtype: torch.Tensor



   .. py:method:: _earth_unpad(x)

      Remove earth padding to restore the original tensor size.

      :param x: Padded tensor.
      :type x: torch.Tensor

      :returns: The unpadded tensor.
      :rtype: torch.Tensor



   .. py:method:: _mirror_padding(x)

      Apply mirror padding to the tensor.

      :param x: Input tensor.
      :type x: torch.Tensor

      :returns: The padded tensor.
      :rtype: torch.Tensor



   .. py:method:: _mirror_unpad(x)

      Remove mirror padding to restore the original tensor size.

      :param x: Padded tensor.
      :type x: torch.Tensor

      :returns: The unpadded tensor.
      :rtype: torch.Tensor



