Prepare data access for DEFAIR

Choose how DEFAIR will obtain its input products: local files, direct EUMETSAT downloads, HDA or S3 compatible object storage. The access requirements follow the data service you use, whether you run DEFAIR in a terminal, local JupyterLab or the DEDL JupyterHub. JupyterHub access and quota roles provide a notebook server; they do not replace data-service permissions or credentials.

Prerequisites

No. 1 A DEFAIR environment for processing

Complete Install DEFAIR locally or Run DEFAIR on the DEDL JupyterHub. Use that environment for the processing examples. You can download a product directly from EUMETSAT before installing DEFAIR.

No. 2 Access to the selected data source

Prepare only the requirements for the route you intend to use:

  • The tutorial data: nothing to prepare. Every tutorial reads its products from the public demo bucket of the DestinE Data Lake, which anyone can read without an account or credentials.

  • Local files: have readable input products on disk. Reading an existing local file needs no remote-service credentials.

  • Direct EUMETSAT downloads: prepare an EUMETSAT account and the applicable data licence by following Download an MSG SEVIRI native product from EUMETSAT for DEFAIR.

  • HDA: have a DestinE account and credentials authorized for the selected collection. DEFAIR supports a service-account client ID and secret, a username and password, or a token. For collections requiring restricted access, request the applicable service access and quota through How to request HDA roles on My DataLake Services. For service-account credentials, follow How to manage service accounts and API keys on My DataLake Services. These requirements also apply when the client runs locally.

  • S3: obtain the endpoint, bucket and object names. For private objects, obtain credentials with permission to read them. For DEDL standalone S3 storage, follow How to obtain S3 keys for standalone S3 object storage through My DataLake Services. Use credentials for the actual storage service and site; standalone S3, EODATA and Islet/OpenStack credentials are not interchangeable. Writing output to S3 additionally requires write permission.

No. 3 A writable working folder and enough storage

Keep downloaded products, notebooks and their configuration in a writable working folder. Allow space for complete HDA downloads, any extracted products and the outputs. On the DEDL JupyterHub, keep this folder beneath ~/user_data so it survives a server restart.

Credentials for object storage

The tutorials need no credentials. Every tutorial, including the AI use case, reads its products anonymously from the public demo bucket of the DestinE Data Lake, run by EUMETSAT, by passing the following option to Dataset.from_source:

source_kwargs={
    "endpoint_url": "https://s3.central.data.destination-earth.eu",
    "anon": True,
}

The read stays anonymous when the environment holds AWS_* variables for another store.

To read your own S3 compatible object store instead, set PUBLIC_S3 = {} where the notebook defines it (SOURCE_KWARGS = {} in the AI tutorial), so every read and check uses the credentials you give DEFAIR. A file named .env keeps them out of the notebook. Put it in the notebook folder, or in any folder above it, and load it in the notebook’s first cell:

from dotenv import load_dotenv

load_dotenv(override=True)

load_dotenv searches upward from the notebook’s folder, so one .env in defair-tutorials/ serves every notebook below it. Copy this block into .env and fill in only the values your chosen source needs. A terminal command does not read .env: for terminal use, set the same variables in the shell, or pass the credentials to the source plugin yourself.

# Copy this file to .env next to the notebooks (or in any folder above them) and fill in the values.
# Lines starting with # are comments. Never commit the .env file.

# Object storage, only for reading your own store.
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
# Endpoint of your object store. There is no default, so leave it out only when the store is AWS itself.
AWS_ENDPOINT_URL=https://s3.example.org
# Optional, only for temporary credentials that come with a session token.
# AWS_SESSION_TOKEN=
# Optional, defaults to us-east-1.
# AWS_REGION=us-east-1

# Destination Earth HDA, for the sample in Read your first product and the HDA example in tutorial 08 (Data sources).
# One of the three ways is enough. DESTINE_USERNAME and DESTINE_PASSWORD also work.
# DEFAIR_HDA_TOKEN=
# DEFAIR_HDA_CLIENT_ID=
# DEFAIR_HDA_CLIENT_SECRET=
# DEFAIR_HDA_USERNAME=
# DEFAIR_HDA_PASSWORD=

# AI tutorial only. COLLOCATION_SOURCE is s3 (the default) or local.
# COLLOCATION_BASE is the folder that local input paths are relative to (default: the notebook folder).
# COLLOCATION_SOURCE=s3
# COLLOCATION_BASE=.

DEFAIR reads the S3 settings from these variables, in this order:

Setting

Variables, first one set is used

Default

Access key

DEFAIR_AWS_ACCESS_KEY_ID, then AWS_ACCESS_KEY_ID

none

Secret key

DEFAIR_AWS_SECRET_ACCESS_KEY, then AWS_SECRET_ACCESS_KEY

none

Session token

AWS_SESSION_TOKEN

none

Region

AWS_REGION, then AWS_DEFAULT_REGION

us-east-1

Endpoint

DEFAIR_S3_ENDPOINT_URL, then AWS_ENDPOINT_URL

none

The DEFAIR_ variants exist for one case: the plain AWS_* pair is already taken by another store, and you cannot change it. There is no default endpoint, so any store other than AWS S3 itself needs AWS_ENDPOINT_URL.

The override=True in that call means the values in .env win over variables already set in the environment. That is deliberate. Hosted notebook platforms, the DEDL Stack among them, preset AWS_* in the kernel for their own object store, and without the override those values would silently win over yours. The reverse also holds: a variable you exported in the shell is replaced when .env defines the same key.

Where the tutorial data comes from

Every tutorial reads its products from the public demo bucket of the DestinE Data Lake, s3://datalake-demo-data/defair-notebook-data/ on https://s3.central.data.destination-earth.eu, which anyone can read without credentials, so the tutorials run as they are. To run a tutorial on other products, you get them in one of two ways: bring your own data, or use HDA.

What matters is the product type, not the file. Any MSG SEVIRI native granule works wherever a tutorial reads one. The fixture manifest names the exact product each tutorial was validated against, with its size and checksum; it is linked at the end of this article.

Bring your own data

Put the products in your own S3 compatible object store, point the credentials above at that store, and in each notebook edit the object names and set PUBLIC_S3 = {} (SOURCE_KWARGS = {} in the AI tutorial). The Prerequisites section of each tutorial names the variables that hold its object names.

Files on a local disk work too, with four changes in each notebook: replace the s3:// paths with absolute local paths, set PUBLIC_S3 = {}, change source="s3" to source="local", and change load_source("s3", **PUBLIC_S3) to load_source("local") in the cells that check the files are present. Use absolute paths, not paths relative to the notebook folder: the notebooks check that each file exists by comparing full paths, so a relative path fails that check even when the file is there. Tutorial 07 also needs "fs_type": "local" in its workflow.

Two tutorials need different settings:

Tutorial 08: Data sources: object storage, local files and the HDA

This tutorial demonstrates several data sources. Keep its remote inputs in object storage and set local_granule to your own local file.

AI tutorial: Three sources on one grid, then an AI cloud mask

Set COLLOCATION_SOURCE=local to use the tutorial’s local mode, then follow its Prerequisites section.

Use HDA

The Destination Earth Harmonised Data Access (HDA) service distributes the EUMETSAT products, and DEFAIR reads from it through its hda source. You need a Destination Earth account. There are two ways to use it:

  • Download a product, then read the local copy. The first-product example does this for its sample with open_download_link(). Download once, and every later read is local. In the tutorials, change the paths and sources as for files on a local disk above.

  • Read the product through HDA directly, with source="hda" in Dataset.from_source(). See Read from S3 in What to do next for an example and instructions on finding a product in the HDA catalogue.

HDA has the following limitations for these tutorials:

  • Whole-product downloads: The HDA source downloads each complete product to a temporary folder before DEFAIR reads it, even when you need only one channel or a small region. For repeated processing, download the products once or keep them in your own S3 compatible store, where DEFAIR can read only the required parts of a file.

  • Product availability: HDA does not provide FCI Level 1c at normal or high resolution (tutorials 01 and 05 and the AI tutorial), or the full disk SEVIRI Climate Data Record (tutorial 01). Download these products from the EUMETSAT Data Store and use them as your own inputs; the reader catalogue’s DestinE column identifies the collections available through HDA.

What to do next

With your chosen data source ready, continue with Read your first product.

For other input products and access methods: