Skip to main content

Biodiversity and moth observation analysis for West Flanders

Project description

NatuurSpotter

NatuurSpotter is a Python package for collecting and analysing public moth observation data from waarnemingen.be, focused on West Flanders, Belgium.

It can create biodiversity summary CSV files, interactive observation maps, species PDF reports, and seasonal observation charts. An optional LLM integration can add a short ecological interpretation to seasonal analyses.

PyPI version Python versions CI License: MIT

Features

  • Collect moth observations from waarnemingen.be for West Flanders.
  • Generate monthly biodiversity summaries with species richness, Shannon diversity, and Simpson diversity.
  • Save raw observation exports for downstream analysis.
  • Build Folium HTML maps with geocoded observation points.
  • Create PDF species reports with descriptions, images, rarity status, and recent observations.
  • Plot seasonal observation patterns for a species.
  • Optionally generate an LLM-based ecological explanation when a Together API key is configured.

Installation

Install the package from PyPI:

python -m pip install natuurspotter

Install the optional LLM dependency only if you want seasonal_analysis() to produce an AI-generated explanation:

python -m pip install "natuurspotter[llm]"

NatuurSpotter requires Python 3.9 or newer.

Verify the installation:

python -c "import natuurspotter; print(natuurspotter.__version__)"

Configuration

NatuurSpotter reads API keys from environment variables. For local development, place them in a .env file in your working directory:

GEOAPIFY_API_KEY=your_geoapify_key_here
TOGETHER_API_KEY=your_together_key_here
Variable Required Used by Purpose
GEOAPIFY_API_KEY Only for maps observations_map() Geocodes observation locations through Geoapify.
TOGETHER_API_KEY Optional seasonal_analysis() Enables the optional LLM ecological explanation.

The package never requires API keys for installation. Keys are only needed when you call features that depend on external services.

Quick Start

from natuurspotter import (
    biodiversity_analysis,
    observations_map,
    seasonal_analysis,
    species_info,
)

# Save monthly biodiversity summary and raw observation CSV files.
summary_df, raw_df = biodiversity_analysis(month=1, year=2025)

# Save an interactive HTML map for one observation day.
map_path = observations_map(day="2025-01-22")

# Save a species PDF report.
species_info("Agrotis segetum")

# Show a seasonal observation chart for a species.
seasonal_analysis("Agrotis segetum", 2025)

By default, generated files are written to an output/ directory under the current working directory.

Generated Files

Function Output
biodiversity_analysis() output/biodiversity_summary_<year>-<month>.csv
biodiversity_analysis() output/biodiversity_raw_<year>-<month>.csv
observations_map() output/observations_map_<date>.html
species_info() output/<species_name>.pdf

Recommended API

biodiversity_analysis(month, year, request_delay=0.2)

Collects daily moth observations for a month, computes biodiversity metrics, saves CSV files, and returns (summary_df, raw_df).

summary_df, raw_df = biodiversity_analysis(month=6, year=2025)

observations_map(day, open_browser=False, geocode_delay=0.1)

Creates an interactive HTML map for observations on a single date. Returns the saved HTML path, or None when no observations are available.

map_path = observations_map(day="2025-06-15", open_browser=False)

This function requires GEOAPIFY_API_KEY.

species_info(latinName)

Creates a PDF report for a species using its scientific name.

species_info("Agrotis segetum")

seasonal_analysis(species, year)

Plots seasonal observation counts for a species. If TOGETHER_API_KEY is set and the llm extra is installed, it also prints a short ecological explanation.

seasonal_analysis("Agrotis segetum", 2025)

Operational Notes

  • Observation data is scraped from waarnemingen.be. If the site changes its HTML structure, scraping functions may need updates.
  • Geographic filtering is focused on West Flanders.
  • Network-facing functions use a package User-Agent and request throttling where repeated requests are expected.
  • observations_map() does not open a browser unless open_browser=True is passed.
  • The package is intended for research, education, and lightweight ecological reporting workflows.

Development

Clone the repository and install the package in editable mode with development tools:

git clone https://github.com/mintyfizz/NatuurSpotter.git
cd NatuurSpotter
python -m pip install -e ".[dev]"

Run the test suite and lint checks:

pytest
ruff check .

Project Links

License

NatuurSpotter is distributed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

natuurspotter-1.0.2.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

natuurspotter-1.0.2-py3-none-any.whl (2.9 MB view details)

Uploaded Python 3

File details

Details for the file natuurspotter-1.0.2.tar.gz.

File metadata

  • Download URL: natuurspotter-1.0.2.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for natuurspotter-1.0.2.tar.gz
Algorithm Hash digest
SHA256 aaa01d01503d269c04664fc9493420d08ce97b223407dade822f1d32ffdd86c2
MD5 2dba24c48224d7ebd1be1431bed03beb
BLAKE2b-256 30fd6543e9a7160a3cadf85931ba2005983c7c38b9bf6ecfb886c1f202923460

See more details on using hashes here.

Provenance

The following attestation bundles were made for natuurspotter-1.0.2.tar.gz:

Publisher: publish.yml on mintyfizz/NatuurSpotter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file natuurspotter-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: natuurspotter-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for natuurspotter-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 94d0dcbd911c4585dfd5fa6f0b505e6e92d839a75315dd3c33083b7bf86a3e2c
MD5 b3ca966acdd457124d9a70266b5f322c
BLAKE2b-256 166dd397281b9100415d977f48b7c92c85c39c47fe7a2e2544ab08db3a3d1e15

See more details on using hashes here.

Provenance

The following attestation bundles were made for natuurspotter-1.0.2-py3-none-any.whl:

Publisher: publish.yml on mintyfizz/NatuurSpotter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page