Installation#

seagrid needs Python 3.11 or newer.

uv add seagrid            # in a uv project
pip install seagrid       # or with pip

A normal install includes everything every source needs.

Clean install without the download packages#

Three packages are used only by some sources, and pull in many packages of their own (cloud storage, async HTTP, pydantic):

Package

Needed by

copernicusmarine

Copernicus Marine sources: cmems_globgc, glorys_carb, ostia, smoc

earthaccess

NASA Earthdata sources: avhrr, modis_a, mur25, olci, seawifs, viirs

pyhdf

cafe (HDF4 files)

If one of them stops installing or breaks your environment, or you only use the other sources (for example the ocean models read by tracmass), leave them out. seagrid still imports and every other source works; a source that needs a missing package raises an ImportError naming it.

In a uv project, add to its pyproject.toml:

[tool.uv]
exclude-dependencies = ["copernicusmarine", "earthaccess", "pyhdf"]

and run uv sync. List only the package that causes trouble to keep the others. With uv pip:

printf "copernicusmarine\nearthaccess\npyhdf\n" > clean.txt
uv pip install seagrid --excludes clean.txt

seagrid.download.optional.status() shows which of them are installed. Delete the lines again to go back to the full install.

pip has no way to leave out a dependency; with pip, install seagrid with pip install --no-deps seagrid and then the dependencies you want from pyproject.toml.

Development#

For development, clone the repository and use uv:

git clone https://github.com/brorfred/seagrid.git
cd seagrid
uv sync                   # creates .venv with the dev tools
uv run pytest             # quick tests

Credentials#

Three providers need a free account: Copernicus Marine (OSTIA, SMOC, CMEMS BGC, GlobColour), NASA Earthdata (MODIS, VIIRS, SeaWiFS, OLCI, AVHRR OI, MUR) and Mercator Ocean (GLORYS12). All other sources, OC-CCI included, need none. Credentials shows how to set up each account, and seagrid credentials shows which ones seagrid can find.