pipeline.src.helpers.segments

Functions

allocate_segments_to_catches(→ pandas.DataFrame)

Takes a pandas DataFrame of catches, a pandas DataFrame defining fleet segments and

Module Contents

pipeline.src.helpers.segments.allocate_segments_to_catches(catches: pandas.DataFrame, segments: pandas.DataFrame, catch_id_column: str, batch_id_column: str) pandas.DataFrame[source]

Takes a pandas DataFrame of catches, a pandas DataFrame defining fleet segments and a pandas DataFrame defining control priorities, and returns a pandas DataFrame of catches with (at most) one allocated segment per catch and the corresponding impact (from segments).

The catches DataFrame must have columns:

  • one id column identifying each catch (the catch_id_column)

  • one id column identifying bathes of catches, which can be a trip id, a vessel id, a PNO report id… which identifies catches that somehow belong to the same “batch” of catches. This is used to compute the share of target species and the main SCIP species type of each group (the batch_id_column), which is a criterion for certain segments.

  • year int

  • fao_area str

  • gear str

  • mesh float (can be null if gear has no mesh)

  • species str

  • scip_species_type str

  • weight float

  • vessel_type str

The segments DataFrame must have columns:

  • segment str

  • segment_name str

  • year int

  • gears List[str]

  • min_mesh float

  • max_mesh float

  • fao_areas List[str]

  • target_species List[str]

  • min_share_of_target_species float

  • main_scip_species_type str

  • vessel_types List[str]

  • impact_risk_factor float

  • priority float