Skip to content

Ceilometer

This welcome notebook shows how to find, load and plot ceilometer data. The data comes from EUMETNET E-PROFILE, the European network of automatic lidars and ceilometers (ALC). The notebook also draws an interactive map of the ceilometers of the network together with the AERONET sun photometers in Europe.

Notebook data_access/instruments/Ceilometer.ipynb (welcome-notebooks repository)
Data source E-PROFILE, open access, through the public API of its web viewer
Station Magurele (Bucharest), Romania: Lufft CHM15k, E-PROFILE instrument_id 1144
Dates 1 and 2 January 2023
Variable Attenuated backscatter, as log10 of Mm⁻¹ sr⁻¹

The E-PROFILE API

The notebook uses the public API behind the E-PROFILE web viewer, served at https://flask.e-profile.eu. It needs no registration: every request is a POST with a JSON body, and the answer comes in msgpack format.

Endpoint Body Returns
request_cm_vocab {} Available instrument types
request_cm_profile_markers {zoom_level, instrument_type} Instruments and stations
request_cm_metadata {instrument_id} Station and instrument metadata
request_cm_data {measurement_date, instrument_id} One day of attenuated backscatter profiles

Calibrated E-PROFILE files

The calibrated E-PROFILE NetCDF files (with cloud base height, etc.) are archived at CEDA, but downloading them requires a CEDA account.

Before you start

The first cell installs the gathering package from the wheel shipped next to the notebook and imports what the notebook needs. Besides the usual scientific packages, it uses requests and msgpack for the API and plotly for the map:

!pip install gathering-0.4.2-py3-none-any.whl

import matplotlib.pyplot as plt
import msgpack
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.io as pio
import requests
import xarray as xr

from gathering.base import get_default_cache_dir

pio.renderers.default = "iframe_connected"
pio.renderers["iframe_connected"].html_directory = "iframe_figures_ceilometer"

In the GRASP cloud, JupyterLab only shows plotly figures with the iframe renderer, so each figure is saved as an HTML file in the iframe_figures_ceilometer folder, next to the notebook.

1. Helper functions

A few helper functions query the API:

  • eprofile_request(endpoint, body) sends the POST request and decodes the msgpack answer.
  • eprofile_instruments(instrument_type) returns the instruments of one model (CHM15k, CL51, CL31, ...) as a pandas DataFrame, with their coordinates.
  • eprofile_day(instrument_id, date) downloads one day of attenuated backscatter and returns it as an xarray Dataset (log_att_bsc on time × altitude).
  • load_eprofile(instrument_id, start_date, end_date) joins the days of a date range and adds the metadata of the instrument.

Daily data is cached as NetCDF in the gathering cache (an eprofile folder, one file per instrument and day), so it is only downloaded once:

EPROFILE_API_URL = "https://flask.e-profile.eu"
CACHE_DIR = get_default_cache_dir() / "eprofile"


def eprofile_request(endpoint, body=None):
    """POST a request to the E-PROFILE API and decode its msgpack answer."""
    response = requests.post(
        f"{EPROFILE_API_URL}/{endpoint}",
        json=body or {},
        headers={"Accept": "application/x-msgpack"},
        timeout=120,
    )
    response.raise_for_status()
    return msgpack.unpackb(response.content, strict_map_key=False)

Days without data (the API answers with a returnCode other than 200) are reported and skipped.

2. Finding the instrument

The instrument types of the network are listed with request_cm_vocab: CHM15k, CL51, CL31, Campbell Scientific, MPL, Mini-MPL and CL61. Filtering the CHM15k instruments by station name shows that Magurele has two of them, instrument_id 1270 and 1144:

instruments = eprofile_instruments("CHM15k")
instruments[instruments["station_name"].str.contains("MAGURELE")]

3. Map of ceilometers and AERONET photometers

The notebook then plots where the ceilometers are: every active E-PROFILE instrument of every model, together with the AERONET sun photometers in Europe.

  • Map region: longitudes from −25 to 45 and latitudes from 30 to 72 (in_europe).
  • Ceilometers: the instruments of every model in that region, leaving out the decommissioned ones. When the notebook was run, the region had 179 CL31, 153 CHM15k, 52 CL51, 12 CL61, 6 Mini-MPL and 1 MPL.
  • AERONET sites: the list of all AERONET sites (with coordinates) is a text file, aeronet_locations_v3.txt. It includes historical sites, so a site is marked as active if it has any AOD product (level 1.0, 1.5 or 2.0) in the last 3 years. AERONET publishes, for every year and level, the months with data of each site (Site_Lists_V3/aeronet_locations_v3_<year>_lev<10|15|20>.txt), so only a few small files are needed.
  • Nearest ceilometer: for every active AERONET site, the distance to the nearest ceilometer is computed with the haversine formula.

The map is drawn with plotly (an SVG map, which needs no WebGL and also works inside the sandboxed iframe of the cloud). Only the active AERONET sites are drawn, and each ceilometer model has its own colour. The map is interactive:

  • The buttons on top choose the view: All stations, or Only AERONET with a ceilometer < 10 km (each AERONET site with its nearest ceilometer, drawn as a coloured dot inside a black ring). The distance is set with MAX_DISTANCE_KM.
  • Click on a legend entry to show or hide that group (double click to show only that one).
  • Hover over a marker to see the station; for AERONET sites, also their nearest ceilometer and the distance.
  • Zoom or pan with the mouse.

4. Loading ceilometer data

Two days of the Magurele CHM15k 1144 are loaded (it is the Magurele instrument with data for these dates, WIGOS 0-20008-0-INO_A):

ceilometer_file = load_eprofile(
    instrument_id=1144,
    start_date="2023-01-01",
    end_date="2023-01-02",
)

The result is an xarray Dataset with 576 profiles (one every 5 minutes) and 511 altitude levels.

5. Time-height plot

The attenuated backscatter is plotted as a function of time and altitude, up to 6 km. The API gives it as log10 of the attenuated backscatter in Mm⁻¹ sr⁻¹, clipped to [−2, 2]:

time = pd.to_datetime(ceilometer_file["time"].values)
altitude = ceilometer_file["altitude"].values
log_att_bsc = ceilometer_file["log_att_bsc"].values

plt.pcolormesh(time, altitude, log_att_bsc.T, cmap=plt.cm.jet, vmin=-2, vmax=1)

6. Mean profiles

Finally, the notebook plots the mean profile of two periods of 1 January (00:00–06:00 and 12:00–18:00 UTC). The values are converted back to linear units (Mm⁻¹ sr⁻¹) before averaging:

for start, end in [("2023-01-01 00:00", "2023-01-01 06:00"), ("2023-01-01 12:00", "2023-01-01 18:00")]:
    selection = ceilometer_file["log_att_bsc"].sel(time=slice(start, end))
    mean_profile = (10 ** selection).mean("time")

Going further

  • Use the map to find a ceilometer close to a site of interest, and pass its instrument_id to load_eprofile.
  • The other instrument notebooks follow the same pattern: Photometer, Lidar, Radar and Spectrometer.