pipeline.src.helpers.fao_areas

Functions

remove_redundant_fao_area_codes(→ List[str])

Filters the input sequence of FAO areas to keep only the smallest non

Module Contents

pipeline.src.helpers.fao_areas.remove_redundant_fao_area_codes(s: Sequence[str]) List[str][source]

Filters the input sequence of FAO areas to keep only the smallest non overlapping areas.

This is useful to prune lists of FAO areas that result from intersecting a geometry (ports, vessel position…) with all FAO areas. In such cases we only want to keep the smallest (most precise) FAO areas in the result.

Parameters:

s (Sequence[str]) – list of FAO areas.

Returns:

subset of the input sequence.

Return type:

List[str]

Examples

>>> remove_redundant_fao_area_codes(['27.8.a', '27', '37.1'])
['27.8.a', '37.1']