# Credentials Most sources download without an account. Three data providers need a free account, and seagrid needs your login for them: | Provider | Sources | |---|---| | [Copernicus Marine](#copernicus-marine) | `ostia`, `smoc`, `cmems_globgc` (GlobColour), `glorys_carb` | | [NASA Earthdata](#nasa-earthdata) | `modis_a`, `viirs`, `seawifs`, `olci`, `avhrr`, `mur25` | | [Mercator Ocean](#mercator-ocean) | `glorys` (GLORYS12 on Mercator's THREDDS server) | All other sources, OC-CCI included, need [no account](#sources-without-an-account). To see which accounts seagrid can find, run: ```bash seagrid credentials ``` ```text Credentials (needed only for these sources; all others are open): Copernicus Marine found cmems_globgc, glorys_carb, ostia, smoc (~/.copernicusmarine/.copernicusmarine-credentials) NASA Earthdata found avhrr, modis_a, mur25, olci, seawifs, viirs (~/.netrc) Mercator Ocean missing glorys ``` `seagrid init` prints the same check, with a warning when an account is missing. It looks for the credentials without contacting any server, so a login that is found can still be wrong. The *Check* step in each section below tests the login with the server. ```{warning} Never put usernames, passwords or tokens in a `seagrid.toml` that is kept under version control or shared. Use the provider's own login file, environment variables or a `.secrets.toml` file, and make those files readable only by you (`chmod 600`). ``` ## Copernicus Marine Needed for `ostia`, `smoc`, `cmems_globgc` and `glorys_carb`. 1. **Create an account** at . The account is free. 2. **Give seagrid the login**, in one of three ways: - **`copernicusmarine login`** (recommended). The `copernicusmarine` command is installed with seagrid: ```bash copernicusmarine login # in a uv project: uv run copernicusmarine login ``` It asks for your username and password and stores them in `~/.copernicusmarine/.copernicusmarine-credentials`. Every program that uses the Copernicus Marine Toolbox finds them there. - **Environment variables**: ```bash export COPERNICUSMARINE_SERVICE_USERNAME="my-user" export COPERNICUSMARINE_SERVICE_PASSWORD="..." ``` - **`.secrets.toml`**, one section per source, for example in `~/.config/seagrid/.secrets.toml`: ```toml [ostia] username = "my-user" password = "..." [smoc] username = "my-user" password = "..." ``` A source's `username` and `password` settings take precedence over the other two, so you can use a different account for one source. 3. **Check** that the server accepts the login: ```bash seagrid check ostia ``` ## NASA Earthdata Needed for the NASA ocean-colour products from OB.DAAC (`modis_a`, `viirs`, `seawifs`, `olci`) and the GHRSST products from PO.DAAC (`avhrr`, `mur25`). seagrid logs in through [earthaccess](https://earthaccess.readthedocs.io). 1. **Create an account** at . The account is free. 2. **Give seagrid the login**, in one of three ways: - **`~/.netrc`** (recommended). Add this line, with your own username and password: ```text machine urs.earthdata.nasa.gov login my-user password ... ``` and make the file private: ```bash chmod 600 ~/.netrc ``` earthaccess can write the line for you. It asks for the username and password: ```bash python -c "import earthaccess; earthaccess.login(strategy='interactive', persist=True)" ``` - **Environment variables**: ```bash export EARTHDATA_USERNAME="my-user" export EARTHDATA_PASSWORD="..." ``` - **A token**. Generate one in your Earthdata profile (*Generate Token*) and set `EARTHDATA_TOKEN`. Tokens expire, so renew it when downloads start to fail. A `~/.netrc` somewhere else is used if `NETRC` points to it. 3. **Check** that the server accepts the login: ```bash seagrid check modis_a ``` If the login works but downloads are refused, sign in at , open *Applications → Authorized Apps*, and approve the archive's application (for example *OB.DAAC Data Access*). ## Mercator Ocean Needed only for `glorys`, which reads GLORYS12 from Mercator Ocean's THREDDS server (`tds.mercator-ocean.fr`) in the layout tracmass expects. The other Copernicus Marine products use the [Copernicus Marine](#copernicus-marine) login instead. 1. **Get an account** on the Mercator Ocean THREDDS server (). 2. **Give seagrid the login** in `~/.netrc`: ```text machine tds.mercator-ocean.fr login my-user password ... ``` ```bash chmod 600 ~/.netrc ``` 3. **Check** that the server accepts the login. `check_auth` asks the server for one dataset description and downloads nothing: ```python from seagrid import glorys glorys.check_auth() # True, or raises glorys.AuthError explaining why ``` ## Sources without an account These sources download from open servers, so they need no setup: | Source | Product | Server | |---|---|---| | `oc_cci` | ESA Ocean Colour CCI | [oceancolour.org](https://www.oceancolour.org) THREDDS | | `acspo` | NOAA ACSPO L3S SST | NOAA CoastWatch | | `bicep_cp`, `bicep_poc` | BICEP phytoplankton carbon, POC | CEDA | | `gebco` | GEBCO bathymetry | CEDA | | `cafe` | CAFE primary production | Oregon State University | | `mimoc` | MIMOC climatology | NOAA PMEL | | `ecco2` | ECCO2 cube92 | APDRC (OPeNDAP) | | `scrippsgog` | Scripps Gulf of Guinea model | UCSD | | `tiho_psd` | Phytoplankton size distribution | PANGAEA | | `longhurst` | Longhurst provinces (1995 version) | Marine Regions (VLIZ), SAERI | The 2007 Longhurst grid (`longhurst`, the default version) has no server any more and must be copied into the data directory. The local sources (`ifado`, `psm`, `oc_cci_local`, `kd_cci`, `mercator12`) read files from a mounted disk and need no account.