airbornegeo.split_into_segments#
- split_into_segments(data, threshold, column_name, min_points_per_segment=0, angular_difference=False, segment_column=None, smoothing_window=None)[source]#
Split dataframe into segments where there is a gap in the supplied values greater than the threshold. Data are sorted by the column given by column_name which can be quantities such as time in seconds, cumulative distances, or aircraft heading or track. By default, a series of sequential segments names as integers starting at 1 will be returned. Alternatively, existing segments can be divided into new segments. These existing segment ID’s should be provided as floats, via the column given by segment_column. New sub-segments will have a decimal added (i.e., 210 -> 210.0 and 210.1) or the decimal will be incremented (210.1 -> 210.1 and 210.2).
- Parameters:
data (
DataFrame) – _description_threshold (
float) – _description_, by default Nonecolumn_name (
str) – Name of column supplying to data.min_points_per_segment (
int) – Segments with fewer points are giving a segment id of NaN, by default 0angular_difference (
bool) – if True, will interpret the data as degrees between 0 and 360, so the calculated differences are the shorted, for example the difference between 0 and 350 degrees will be -10 instead of 340.smoothing_window (
int|None) – Window size in number of data points for smoothing each difference after it’s been calculated, by default None
- Returns:
A series with new segments identified with sequential integers starting with 1, or if segment_column is provided, existing segment ID numbers will be incremented by 0.1 if the segment is split (i.e. 210 -> 210.0 and 210.1).
- Return type: