code: def total_deformation(u, v, dx, dy):
      r
      dudy, dudx = gradient(u, deltas=(dy, dx), axes=(-2, -1))
      dvdy, dvdx = gradient(v, deltas=(dy, dx), axes=(-2, -1))
      return np.sqrt((dvdx + dudy)**2 + (dudx - dvdy)**2)
docs: r"""Calculate the horizontal total deformation of the horizontal wind.
  
      Parameters
      ----------
      u : (M, N) ndarray
          x component of the wind
      v : (M, N) ndarray
          y component of the wind
      dx : float or ndarray
          The grid spacing(s) in the x-direction. If an array, there should be one item less than
          the size of `u` along the applicable axis.
      dy : float or ndarray
          The grid spacing(s) in the y-direction. If an array, there should be one item less than
          the size of `u` along the applicable axis.
  
      Returns
      -------
      (M, N) ndarray
          Total Deformation
  
      See Also
      --------
      shearing_deformation, stretching_deformation
  
      Notes
      -----
      If inputs have more than two dimensions, they are assumed to have either leading dimensions
      of (x, y) or trailing dimensions of (y, x), depending on the value of ``dim_order``.