Skip to content
module

marinvaders.readers

Utility module for reading different data sources.

Data sources are specified at README.md

Classes
Functions
  • data_path() (os.path) Path to data source files.</>
  • eco_mrgid_link() (pd.DataFrame) Reads ECO regions code from MEOW merged with other shapefiles. This file maps ECO regions code wit MRGID</>
  • read_gisd(gisd_file) (pd.DataFrame) Reads GISD dataset.</>
  • read_gisd_worms_link() (pd.DataFrame) Reads GISD and WoRMS qualitative distribution linked to MEOW.</>
  • read_natcon() (pd.DataFrame) Reads NatCon dataset.</>
  • read_redlist(redlist_file) (Pandas DataFrame) Reads redlist data which describes species affected by invasive species.</>
  • read_shapefile(shape_name) (GeoPandas) Read shapefiles.</>
function

marinvaders.readers.data_path()

Path to data source files.

Returns (os.path)

Data path

class

marinvaders.readers.ShapeFiles(value, names=None, module=None, qualname=None, type=None, start=1)

Bases
enum.Enum

Enum of shape files directory.

Classes
class

enum.EnumMeta(cls, bases, classdict, **kwds)

Metaclass for Enum

Attributes
  • __members__ Returns a mapping of member name->value.
    This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping.</>
Methods
  • __bool__() classes/types should always be True.</>
  • __call__(cls, value, names, module, qualname, type, start) Either returns an existing member, or creates a new enum class.</>
  • __dir__() Specialized dir implementation for types.</>
  • __getattr__(cls, name) Return the enum member matching name</>
  • __iter__(cls) Returns members in definition order.</>
  • __reversed__(cls) Returns members in reverse definition order.</>
  • __setattr__(cls, name, value) Block attempts to reassign Enum members.</>
method
__bool__()

classes/types should always be True.

staticmethod
__call__(cls, value, names=None, module=None, qualname=None, type=None, start=1)

Either returns an existing member, or creates a new enum class.

This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API (i.e. Color = Enum('Color', names='RED GREEN BLUE')).

When used for the functional API:

value will be the name of the new class.

names should be either a string of white-space/comma delimited names (values will start at start), or an iterator/mapping of name, value pairs.

module should be set to the module this class is being created in; if it is not set, an attempt to find that module will be made, but if it fails the class will not be picklable.

qualname should be set to the actual location this class can be found at in its module; by default it is set to the global scope. If this is not correct, unpickling will fail in some circumstances.

type, if set, will be mixed in as the first base class.

method
__dir__()

Specialized dir implementation for types.

staticmethod
__getattr__(cls, name)

Return the enum member matching name

We use getattr instead of descriptors or inserting into the enum class' dict in order to support name and value being both properties for enum members (which live in the class' dict) and enum members themselves.

staticmethod
__iter__(cls)

Returns members in definition order.

staticmethod
__reversed__(cls)

Returns members in reverse definition order.

staticmethod
__setattr__(cls, name, value)

Block attempts to reassign Enum members.

A simple assignment to the class namespace only changes one of the several possible ways to get an Enum member from the Enum class, resulting in an inconsistent Enumeration.

function

marinvaders.readers.read_shapefile(shape_name)

Read shapefiles.

Parameters
  • shape_name (ShapeFiles) name of the shapefile defined in ShapeFile class
Returns (GeoPandas)

Shapefile data

function

marinvaders.readers.read_natcon()

Reads NatCon dataset.

Returns (pd.DataFrame)

Natcon data

function

marinvaders.readers.read_gisd(gisd_file)

Reads GISD dataset.

Parameters
  • gisd_file (pathlib.Path) Location of the JSON file containing the gisd data
Returns (pd.DataFrame)

GISD data

function

marinvaders.readers.read_redlist(redlist_file)

Reads redlist data which describes species affected by invasive species.

Note

Depends on redlist data from IUCN which needs to be downloaded manually from https://www.iucnredlist.org/search . See also the documentation at https://marinvaders.gitlab.io/marinvaders/iucn_data/

Parameters
  • redlist_file (str or pathlib.Path) Manually downloaded search results from IUCN (assessment.csv)
Returns (Pandas DataFrame)

Affected species