EUMETSAT animation example (MTG-FCI)
This example demonstrates how to:
Authenticate with EUMETSAT credentials.
Search EUMETSAT products on a specific temporal window.
Definition of EUMDAC Data Tailor Chain.
Use
visusat.eumetsat.download_custom_products()to **automatize Data Tailor customisation for
multiple products.**
- Generate an animation with visusat.plotting.animate_geotiff_sequence().
Example script for generating Gif animation from MTG-FCI custom products.
1"""
2Example script to produce an animation from EUMETSAT products download through Data Tailor customisation.
3
4This example shows :
5- Authentication with EUMETSAT credentials.
6- Product search on a specific temporal window.
7- Definition of Data Tailor Chain.
8- Use of ``download_custom_products`` to automatize Data Tailor customisation for
9multiple products.
10- Generation of animation with ``animate_geotiff_sequence``.
11
12Requirements:
13pip install visusat numpy eumdac
14"""
15
16import logging
17import os
18import sys
19from datetime import datetime
20from pathlib import Path
21
22import eumdac
23import numpy as np
24
25from visusat.eumetsat import download_custom_products, get_token
26from visusat.plotting import animate_geotiff_sequence
27
28# ---------------------------------------------------------------------------
29# Logging configuration
30# ---------------------------------------------------------------------------
31LOG_FILE = Path(__file__).with_suffix(".log")
32script_name = os.path.basename(__file__)
33logging.basicConfig(
34 level=logging.INFO,
35 format="%(asctime)s [%(levelname)s] %(name)s.%(funcName)s:%(lineno)d - %(message)s",
36 handlers=[
37 logging.FileHandler(LOG_FILE, encoding="utf-8", mode="w"),
38 logging.StreamHandler(sys.stdout),
39 ],
40 force=True,
41)
42logger = logging.getLogger(Path(__file__).stem)
43logger.info(">>> Example script started.")
44
45# ===============================================================
46# Authenticate & search Data Store product
47# ===============================================================
48token = get_token()
49datastore = eumdac.DataStore(token)
50required_collection = "EO:EUM:DAT:0665" # MTG FCI L1c HR
51collection = datastore.get_collection(required_collection)
52
53start = datetime(2025, 10, 22, 12, 00)
54end = datetime(2025, 10, 22, 12, 30)
55
56products = collection.search(dtstart=start, dtend=end)
57if products is None:
58 raise RuntimeError("No matching products found in this time window.")
59
60# ===============================================================
61# Define Data Tailor chain
62# ===============================================================
63chain = eumdac.tailor_models.Chain(
64 product="FCIL1HRFI",
65 format="geotiff",
66 filter={"bands": ["vis_06_hr_effective_radiance"]},
67 projection="geographic",
68 roi="western_europe",
69)
70
71# ===============================================================
72# Download series of custom products in target directory
73# ===============================================================
74dir = "../outputs/animations/test"
75download_custom_products(products, chain, dir)
76
77# ===============================================================
78# Produce animation within the target directory
79# ===============================================================
80path = animate_geotiff_sequence(dir, cmap="Blues")
81
82logger.info(">>> End of example script.")