fronttracker.core.FrontTracker

Main class for identifying and tracking oceanic fronts over time.

Attributes

fronts : dict Dictionary of identified Front objects, indexed by label. data : pandas.DataFrame Tabular data of all detected front pixels with columns: time, longitude, latitude, gm, labels. data_labels : pandas.DataFrame DataFrame mapping each front label to its next label in the tracking path. epsx : float Grid resolution in longitude (degrees). epsy : float Grid resolution in latitude (degrees). eps : float Neighborhood distance used in DBSCAN clustering. nstd : float Number of standard deviations for ellipse estimation.

fronts instance-attribute

fronts = {}

__init__

__init__()

get_clusters

get_clusters(X)

Cluster frontal pixels using DBSCAN.

Parameters

X : ndarray of shape (n, 2) Array of (longitude, latitude) coordinates of frontal pixels.

Returns

labels : ndarray of shape (n,) Cluster labels for each pixel.

get_frontal_path

get_frontal_path(start_label)

Compute the sequence of connected fronts starting from a given label.

Parameters

start_label : int Label of the starting front.

Returns

path : list of int Sequence of connected front labels.

get_frontal_pixels

get_frontal_pixels(x, y, grid, grid_gm)

Extract pixels corresponding to frontal zone.

Parameters

x : array-like Longitudes. y : array-like Latitudes. grid : 2D ndarray Binary grid (1 = front, 0 = background). grid_gm : 2D ndarray Gradient magnitude values corresponding to the grid.

Returns

xy : ndarray of shape (n, 2) Array of (longitude, latitude) coordinates of frontal pixels. gm : ndarray Gradient magnitude values at the extracted pixels.

identify_fronts

identify_fronts(
    time,
    longitudes,
    latitudes,
    grid,
    treshold=0.05,
    eps=None,
    nstd=2,
)

Identify fronts from gradient magnitude grids using DBSCAN clustering.

Parameters

time : array-like Sequence of timestamps corresponding to the grid. longitudes : array-like Array of geodesic longitudes. latitudes : array-like Array of geodesic latitudes. grid : ndarray 3D array of gradient magnitude values (time, lat, lon). treshold : float, default=0.05 Threshold to binarize the gradient magnitude field. eps : float, optional Maximum distance between two samples for DBSCAN. If None, it is estimated automatically from grid resolution. nstd : float, default=2 Number of standard deviations for ellipse estimation.

track

track()

Track fronts over time based on pixel overlap.