pipeline.src.shared_tasks.positions
Functions
|
Adds an is_at_port boolean field to a DataFrame containing positions. |
|
|
|
Module Contents
- pipeline.src.shared_tasks.positions.tag_positions_at_port(positions: pandas.DataFrame) → pandas.DataFrame[source]
Adds an is_at_port boolean field to a DataFrame containing positions.
Mandatory fields latitude and longitude are converted to h3 indices and compared to a referential of h3 indices of ports and anchor areas. If the h3 index of the latitude-longitude position matches that of a port or anchor area, then is_at_port will be True.
Additionnally, if a is_on_land boolean column is present in the input DataFrame, positions with is_on_land = True will have is_at_port = True regardless of the latitude-longitude position. The is_on_land column is dropped after being taken into account for the computation of is_at_port.
- Parameters:
positions – DataFrame with at least ‘latitude’ and ‘longitude’ columns and an optionnal is_on_land column.
- Returns:
same as input with an added ‘is_at_port’ boolean field.
- Return type:
pd.DataFrame