Skip to main content

Group iNaturalist sightings into clumps by space and time

Project description

inaturalist-clumper

GitHub repo PyPI Changelog Tests License

Group iNaturalist sightings into clumps, represented as JSON.

Given one or more iNaturalist user logins, this CLI fetches every public observation those users have recorded and groups sightings that happened within ~5 km and ~3 hours of each other into "clumps" — useful for reconstructing a single hike, birding session, or tide-pool visit as one record.

See simonw/inaturalist-clumps/blob/main/clumps.json for example output from this tool.

The output JSON file records, for every clump:

  • start/end timestamps, duration, centroid, bounding box, span
  • a species roll-up
  • a location block: the mode of the observations' place_guess plus the most-specific iNaturalist place that every observation in the clump falls inside (with a breadcrumb of ancestor place IDs)
  • per-observation: timestamp, latitude/longitude, identified taxon, user-typed place_guess, iNat place_ids, and photo URLs (thumbnail / large / original)

A top-level places dictionary caches the iNat place metadata (name, display_name, admin_level, ancestor_ids) for every ID that appears in a clump's breadcrumb, so the file is self-contained. Incremental runs reuse this cache and only fetch newly-referenced places.

Install

pip install inaturalist-clumper

Or:

uv tool install inaturalist-clumper

Usage

inaturalist-clumper simonw --output clumps.json

You can pass more than one iNaturalist username to gather sightings from multiple users accounts.

Options:

  • USERNAME ...required
    One or more iNaturalist user logins to fetch.
  • --output — default: clumps.json
    Output JSON path. Used as the basis for incremental runs if it exists.
  • --distance-km — default: 5.0
    Spatial threshold for linking two observations into the same clump.
  • --hours — default: 3.0
    Temporal threshold for linking two observations into the same clump.
  • --full-refresh — default: off
    Ignore any existing observations in the output file and re-fetch fully.

Incremental runs

A second invocation against the same --output file reads the existing data and asks the iNaturalist API for any observations that have been created or edited since the previous run's generated_at timestamp (using the updated_since parameter). Edited records overwrite the cached copy on merge, so corrected taxa, new photos, or fixed coordinates flow back in. The full set is then re-clumped and the file rewritten — so a new sighting that bridges two previous clumps will merge them.

Use --full-refresh to ignore the existing file and start over.

Development

Clone the repo and then:

uv run pytest

To run the development version:

uv run inaturalist-clumper --help

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

inaturalist_clumper-0.1.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

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

inaturalist_clumper-0.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file inaturalist_clumper-0.1.tar.gz.

File metadata

  • Download URL: inaturalist_clumper-0.1.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inaturalist_clumper-0.1.tar.gz
Algorithm Hash digest
SHA256 ede198ceea509909496576d6c167ab6c86b2c0ed8dd748d7f0fe903ebd0945c5
MD5 62e3910b35fb86e372fedde6615bb0e3
BLAKE2b-256 bede9bc8f3143305d87f461385c98be4ae5d031ccff9515adcb5b10d1f69e960

See more details on using hashes here.

Provenance

The following attestation bundles were made for inaturalist_clumper-0.1.tar.gz:

Publisher: publish.yml on simonw/inaturalist-clumper

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

File details

Details for the file inaturalist_clumper-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inaturalist_clumper-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9aacd7a392a1574af2507965f91a36036c61eee047b163274633b0cb9cec2eff
MD5 37640464fe71067323620e9726bfb973
BLAKE2b-256 77b5e7c18d71a5edb9f457967eeeaa657575dc78e46484f1b2ebff0aa58ad973

See more details on using hashes here.

Provenance

The following attestation bundles were made for inaturalist_clumper-0.1-py3-none-any.whl:

Publisher: publish.yml on simonw/inaturalist-clumper

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