seagrid.download.optional#

Download packages that a “clean” install of seagrid leaves out.

A normal install includes everything. When one of these packages stops installing or breaks, leave it out with uv’s dependency exclusion (see Installation). seagrid still imports, and only the sources that need the package fail, with an ImportError that names it.

Examples

>>> from seagrid.download import optional
>>> sorted(optional.PACKAGES)
['copernicusmarine', 'earthaccess', 'pyhdf']
>>> isinstance(optional.status(), dict)
True

Module Attributes

PACKAGES

Package name -> the sources that need it.

Functions

missing(package)

Return the error raised when an optional download package is not installed.

status()

Return which optional download packages are installed.

seagrid.download.optional.PACKAGES: dict[str, str] = {'copernicusmarine': 'the Copernicus Marine sources (cmems_globgc, glorys_carb, ostia, smoc)', 'earthaccess': 'the NASA Earthdata sources (avhrr, modis_a, mur25, olci, seawifs, viirs)', 'pyhdf': 'the CAFE primary production source (HDF4 files)'}#

Package name -> the sources that need it.

seagrid.download.optional.missing(package)[source]#

Return the error raised when an optional download package is not installed.

Parameters:

package (str) – One of PACKAGES.

Returns:

ImportError – With a message naming the package, the sources that need it and how to install it.

Return type:

ImportError

Examples

>>> print(missing("pyhdf"))
pyhdf is not installed; it is needed by the CAFE primary production ...
seagrid.download.optional.status()[source]#

Return which optional download packages are installed.

Returns:

dict of str to bool – Package name -> True if it can be imported.

Return type:

dict[str, bool]