environmentaltools.spatiotemporal.covariance.compute_directional_covariance

environmentaltools.spatiotemporal.covariance.compute_directional_covariance(dfh, dfs, slag, tlag, dinfo)[source]

Compute spatiotemporal covariance for multiple directional bins.

Calculates anisotropic (direction-dependent) covariance structures by analyzing data pairs grouped by their spatial direction.

Parameters:
  • dfh (pd.DataFrame) – Hard data with columns [‘x’, ‘y’, ‘t’, ‘h’].

  • dfs (pd.DataFrame) – Soft data with columns [‘x’, ‘y’, ‘t’, ‘h’].

  • slag (np.ndarray) – Vector of spatial lag distances.

  • tlag (np.ndarray) – Vector of temporal lag distances.

  • dinfo (list) – Directional information [dlag, dlagtol] where: - dlag: array of directional angles (degrees) - dlagtol: angular tolerance for binning

Returns:

  • empcovst (np.ndarray) – 3D array of empirical covariance, shape (n_spatial, n_directions, n_temporal).

  • pairsnost (np.ndarray) – 3D array of pair counts, shape (n_spatial, n_temporal, n_directions).

  • covdist (np.ndarray) – Spatial distance grid.

  • covdistd (np.ndarray) – Directional angle grid.

  • covdistt (np.ndarray) – Temporal distance vector.

Notes

Useful for detecting and modeling spatial anisotropy in spatiotemporal fields. Directions are typically binned (e.g., 0°, 45°, 90°, 135°) to capture orientation-dependent correlation structures.