lt_toolbox.TrajFrame.compute_probability#

TrajFrame.compute_probability(bin_res: float, prob_type: str = 'pos', group: str | None = None, append: bool = False) Self[source]#

Compute Lagrangian probability in discrete geographical (longitude, latitude) space.

Lagrangian probability is the likelihood that a Lagrangian trajectory will enter a given geographical bin at least once (prob_type=’traj’) or the likelihood that a Lagrangian trajectory position will be found in a given geographical bin (prob_type=’pos’).

Parameters:
  • bin_res (float) – Geographical bin resolution to compute Lagrangian probability. The bin resolution should be specified in degrees.

  • prob_type (str, default: 'pos') – Type of Lagrangian probability to compute. Options are ‘pos’ and ‘traj’. The default is ‘pos’ which returns the probability that a Lagrangian trajectory position is found in any given geographical bin. The ‘traj’ option returns the probability that a Lagrangian trajectory will enter any given geographical bin.

  • group (str, default: None) – Name of column variable to group according to unique values using group_by() before computing Lagrangian probability.

  • append (bool, default: False) – If set to True, the probability statistic will be appended to the existing summary_data, otherwise summary_data will be replaced with a new DataSet.

Returns:

TrajFrame is returned with the 2-dimensional Lagrangian probability statistic included in the summary_data where the mid-points of the latitude-longitude bins are given as the dimensions.

Return type:

TrajFrame

Examples

Calculating the Lagrangian probability of trajectories in discrete (1 x 1) degree longitude-latitude bins. The probability is computed using the ‘traj’ option which returns the probability that a Lagrangian trajectory will enter any given geographical bin.

>>> trajectories.compute_probability(bin_res=1, prob_type='traj')