Analysing species data within New Zealand's marine reserves
If you ever need to quantify species presence within a certain area or set of areas have a look at this Jupyter Notebook. It displays some key figures quantifying chiton (Class Polyplacophora) species abundance inside and outside New Zealand's marine reserves, but it can be easily customised to any given taxon and/or place.
While valued marine species such as spiny rock lobster, snapper, blue cod, just to name a few, are subject to many studies and analysis, some other species are not. For species lacking surveys and studies, therefore missing presence and abundance data, there is a data gap that citizen science platforms like iNaturalist may help fill. Quantifying keystone species abundance inside and outside marine reserves is a common survey that the Department of Conservation periodically may do - see this report for rock lobster in the Cape Rodney-Okakari Point marine reserve.
Following from a work inquiry regarding presence of a certain genus inside and outside marine reserves I decided to publish a simple Python notebook that addresses the question of species presence in, and outside a given area (or set of areas). The notebook fetches the raw data from the iNaturalist API and, for each record, checks whether its position falls within the boundaries of the given area/s or not. It currently pulls the boundary data from the official DOC's marine reserves dataset but it can be easily set to any other layer. All parameters are defined in a YAML file, which means they can be edited without having to touch the code.
The script is currently set to use Class Polyplacophora (chitons) but it can be set to any genus/family/order, as long as it´s a valid iNaturalist ID. The data request is restricted to New Zealand but it can be changed to any valid iNaturalist place ID. Only reseach grade and geo-referenced records are being used. Location data (latitude-longitude) is needed to find out if an observation is located inside or outside of an area of interest.

Screenshot of Class Polyplacophora https://inaturalist.nz/taxa/47429-Polyplacophora as of 29/11/2022
The notebook gives a simple breakdown of the data in terms of how many observations and how many taxon fall within the given boundaries.

Taxon richness inside and outside New Zealand's Marine Reserves
Citizen science data has many known pitfalls, being spatially biased is one of them. In the coastal marine environament most of the observations might be located within reserves, because these are places often targeted by citizen scientists due to its biodiversity levels. However, in the absence of better data sources, platforms like iNaturalist provide a viable alternative.
You can run the notebook locally or you can view the outputs of my last execution in NBViewer. As usual the code can be found in a GitHub repository. If you want to learn more about Jupyter and/or how to run the notebook locally, visit https://jupyter.org/

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 New Zealand License.