Aviso notification for DT data availability
This notebook shows how to check the data availablility for the Weather-Induced Extremes Digital Twin (Extremes DT) using the ECMWF Aviso package.
Copyright: 2025 EUMETSAT
License: MIT
Authors: Serena Avolio (EUMETSAT/Starion)
Destination Earth - Aviso notification for DT data availability¶
References:Credit:
The pyaviso package is provided by the European Centre for Medium-Range Weather Forecasts (ECMWF).
This notebook shows how to check the data availablility for the Weather-Induced Extremes Digital Twin (Extremes DT) using the ECMWF Aviso package.
Install the pyaviso package¶
pip install "pyaviso<2" --quietNote: you may need to restart the kernel to use updated packages.
import pyaviso
print(pyaviso.__version__)
print(dir(pyaviso))
1.0.2
['HOME_FOLDER', 'NotificationManager', 'Queue', 'SYSTEM_FOLDER', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'authentication', 'custom_exceptions', 'engine', 'event_listeners', 'exit_channel', 'logger', 'logging', 'notification_manager', 'triggers', 'user_config', 'version']
Import pyaviso¶
Import pyaviso and other useful libraries. Defining constants and functions.
import sys
from datetime import datetime, timedelta
from pprint import pprint as pp
from pyaviso import NotificationManager, user_configLISTENER_EVENT = "data" # Event for the listener, options are mars and dissemination
TRIGGER_TYPE = "function" # Type of trigger for the listenerDefining the data to be notified¶
The following request describes the data whose availability we want to be notified
REQUEST = {
"class": "d1",
"expver": "0001",
"stream": "wave",
"type": "fc",
"time": "00",
"step": "0",
"levtype": "sfc",
# "levelist": "",
# "param": "168"
} # Request configuration for the listener
Aviso configuration¶
CONFIG = {
"notification_engine": {
"host": "aviso.lumi.apps.dte.destination-earth.eu",
"port": 443,
"https": True,
},
"configuration_engine": {
"host": "aviso.lumi.apps.dte.destination-earth.eu",
"port": 443,
"https": True,
},
"schema_parser": "generic",
"remote_schema": True,
"auth_type": "none",
"quiet" : True
} # manually defined configuration
Searching for notifications¶
Ssearching for notifications where available.
END_DATE = datetime.now()
START_DATE = END_DATE - timedelta(days=14)
def triggered_function(notification):
"""
Function for the listener to trigger.
"""
#pp(notification)
# Access the date field
date_str = notification['request']['date']
# Convert the date string to a datetime object
date_obj = datetime.strptime(date_str, '%Y%m%d')
formatted_date = date_obj.strftime('%Y-%m-%d')
pp("ExtremeDT data available=>" + formatted_date)
def create_hist_listener():
"""
Creates and returns a listener configuration.
"""
trigger = {
"type": TRIGGER_TYPE,
"function": triggered_function,
} # Define the trigger for the listener
# Return the complete listener configuration
return {"event": LISTENER_EVENT, "request": REQUEST, "triggers": [trigger]}
try:
listener = create_hist_listener() # Create listener configuration
listeners_config = {"listeners": [listener]} # Define listeners configuration
config = user_config.UserConfig(**CONFIG)
print("loaded config:")
pp(CONFIG)
nmh = NotificationManager() # Initialize the NotificationManager
nmh.listen(
listeners=listeners_config, from_date=START_DATE,to_date=END_DATE, config=config
) # Start listening
except Exception as e:
print(f"Failed to initialize the Notification Manager: {e}")loaded config:
{'auth_type': 'none',
'configuration_engine': {'host': 'aviso.lumi.apps.dte.destination-earth.eu',
'https': True,
'port': 443},
'notification_engine': {'host': 'aviso.lumi.apps.dte.destination-earth.eu',
'https': True,
'port': 443},
'quiet': True,
'remote_schema': True,
'schema_parser': 'generic'}
'ExtremeDT data available=>2026-07-27'
'ExtremeDT data available=>2026-07-26'
'ExtremeDT data available=>2026-07-25'
'ExtremeDT data available=>2026-07-24'
'ExtremeDT data available=>2026-07-23'
'ExtremeDT data available=>2026-07-22'
'ExtremeDT data available=>2026-07-21'
'ExtremeDT data available=>2026-07-20'
'ExtremeDT data available=>2026-07-19'
'ExtremeDT data available=>2026-07-18'
'ExtremeDT data available=>2026-07-17'
'ExtremeDT data available=>2026-07-16'
'ExtremeDT data available=>2026-07-15'
'ExtremeDT data available=>2026-07-14'
'ExtremeDT data available=>2026-07-13'
'ExtremeDT data available=>2026-07-12'