Skip to content
module

marinvaders.main

MarINvaders: Full/alien species distributions for a single species or a whole ecoregion.

The is the entry point to the marINvaders code base providing the to top-level classes:

  • Species
  • MarinLife

For both, the algorithm collects species data from OBIS and connect to distribution of the species using WoRMS, NatCon and (optional) IUCN data sources. It uses geo-spatial regions based on MEOW ECOS merged with MRGID (used by WoRMS source) from different shape-files.

More about data processing can be found at README.md and documentation (https://marinvaders.gitlab.io/marinvaders/)

Classes
  • Species Class representing a single species.</>
  • MarineLife Class representing the marine life in selected MEOW eco-region.</>
Functions
  • marine_ecoregions(**kwargs) (geoPandas) Filter meow eco-regions using keywords arguments selectors.</>
  • plot(eco_code, show) (matplotlib plot figure) Plot world map with selected MEOW eco region</>
function

marinvaders.main.marine_ecoregions(**kwargs)

Filter meow eco-regions using keywords arguments selectors.

Note

The values of selectors are processed as regexp.

Parameters
  • kwargs Selectors to filter using regexp. The selectors as a kwargs keys are:
    - ECO_CODE int or list of int
    - ECOREGION
    - PROVINCE
    - REALM
    
Returns (geoPandas)

Information on all selected eco-regions

class

marinvaders.main.Species(aphia_id, gisd_file=None)

Class representing a single species.

Attributes
  • _obis (pandas.DataFrame) Result from OBIS API request for this species
  • all_occurrences (pandas.DataFrame (property)) All eco-regions which report presence of the species.
  • aphia_id (int) Aphia ID of species (using WoRMS classification).
  • reported_as_alien (pandas.DataFrame (property)) Marine eco-regions where the species is reported as alien based on WoRMS, NatCon and GISD (optional) sources
Methods
  • plot(show) (matplotlib plot figure) Plot species object.</>
method

plot(show=True)

Plot species object.

Parameters
  • show (boolean, optional) If true, calls plt.show() to show the figure (default).
class

marinvaders.main.MarineLife(eco_code, gisd_file=None, redlist_file=None)

Class representing the marine life in selected MEOW eco-region.

It finds which species present, which are aliens, and find all observations of the alien species in other eco regions based on OBIS source.

Attributes
  • _alien_observations (pandas.DataFrame) Observations of all species reported as alien
  • _obis (pandas.DataFrame) Obis reports of species for this region.
  • alien_species Return aliens species in currently selected eco-region.</>
  • aliens (pandas.DataFrame (property)) All alien species in teh eco-region
  • all_species (pandas.DataFrame (property)) All species present in the eco-region
  • all_species List of all unique species.</>
  • eco_code (int) MEOW eco code of the selected region
Methods
  • specify_redlist_data(redlist_file, result_attribute_name) Specify location of the red list data file (assessments.csv)</>
method

specify_redlist_data(redlist_file, result_attribute_name='affected_by_invasive')

Specify location of the red list data file (assessments.csv)

The redlist data should contain a list of species affected by invasive species (see documentation on how to obtain this list from the IUCN webpage).

The species data is then crossreferenced against the species found in the eco-region. A list of all species affected by invasive species in this eco-region is then available in the attribute specified in the parameter 'result_attribute_name' ('affected_by_invasive' by default).

Parameters
  • redlist_file (pathlib.Path or str) The path to the redlist assessments.csv file. If set to None, the previously read redlist data will be removed and the result attribute will no longer be available.
  • result_attribute_name (str, optional) Result attribute name
function

marinvaders.main.plot(eco_code, show=True)

Plot world map with selected MEOW eco region

Parameters
  • eco_code (int or Species obj) If int is set as eco_code the plot will try to get eco region from MEOW and plot it. If no eco region is found for the int eco_code the function will raise ValueError.
  • show (boolean, optional) If true, calls plt.show() to show the figure (default).
Raises
  • Value Error When eco-region for the eco_code was not found.