Skip to content

Radar

This welcome notebook shows how to load and handle cloud radar data. The data comes from ACTRIS Cloudnet and is downloaded with the gathering package.

It uses the METEK MIRA-35 (35 GHz) cloud radar of Bucharest. Besides the radar product, it also requests the Cloudnet classification product of the same day, which combines radar, lidar, microwave radiometer and model data to classify the targets.

Notebook data_access/instruments/Radar.ipynb (welcome-notebooks repository)
Data source ACTRIS Cloudnet, open access
Gatherer Task.actris_cloudnet
Station Bucharest, Romania (bucharest)
Date 15 March 2023
Products radar and classification

Before you start

The first cell installs the gathering package from the wheel shipped next to the notebook and imports what the notebook needs (xarray to read the NetCDF files):

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

from pathlib import Path

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xarray as xr
from matplotlib.colors import BoundaryNorm, ListedColormap

from gathering import Pipeline, Task

1. Downloading the data

A single actris_cloudnet task can request several products at once; each one is a different file:

task = Task.actris_cloudnet(
    station="bucharest",
    product=["radar", "classification"],
    start_date="2023-03-15",
    end_date="2023-03-15",
)
results = Pipeline([task]).run()

files = results.to_dataframe()["files"].iloc[0]

It downloads two files, 20230315_bucharest_mira.nc (radar) and 20230315_bucharest_classification.nc. The radar file is opened with xarray:

radar_file = next(f for f in files if Path(f).name.endswith("_mira.nc"))
classification_file = next(f for f in files if "classification" in Path(f).name)

radar = xr.open_dataset(radar_file)

2. Radar variables

The main radar variables are given as a function of time and range; the variable height gives the height above mean sea level of each range gate.

Variable Meaning
Zh Radar reflectivity factor (dBZ)
v Doppler velocity (m/s); negative values mean falling targets
width Spectral width
ldr Linear depolarisation ratio

The notebook plots the four variables up to 12 km, one panel each, with their units and long names taken from the file attributes:

variables = [
    ("Zh", "jet", -40, 20),
    ("v", "RdBu_r", -4, 4),
    ("width", "viridis", 0, 1),
    ("ldr", "viridis", -30, 0),
]

3. A single profile

To look at one moment, the notebook averages the profiles of a 10-minute window around 10:00 UTC. Reflectivity is in dBZ, a logarithmic unit, so it is converted to linear units (mm⁶/m³) before averaging and back to dBZ afterwards:

profile_time = pd.Timestamp("2023-03-15 10:00")
window = radar.sel(time=slice(profile_time - pd.Timedelta(minutes=5), profile_time + pd.Timedelta(minutes=5)))

zh_profile = 10 * np.log10((10 ** (window["Zh"] / 10)).mean("time"))
v_profile = window["v"].mean("time")

The reflectivity and Doppler velocity profiles are plotted side by side, with a reference line at 0 m/s.

4. Time series at a fixed height

The reflectivity of the range gate closest to 6000 m a.s.l. is plotted along the day, both raw and averaged every 10 minutes (again in linear units):

target_height = 6000  # m a.s.l.
gate = int(np.argmin(np.abs(heights - target_height)))

zh_series = radar["Zh"].isel(range=gate).to_series()
zh_series_10min = 10 * np.log10((10 ** (zh_series / 10)).resample("10min").mean())

5. CFAD

A contoured frequency by altitude diagram (CFAD) summarises the whole day: for each height, how often each reflectivity value was observed. The notebook builds a 2D histogram of reflectivity (2 dBZ bins from −50 to 30 dBZ) and height (250 m bins up to 12 km), and normalises each height level to a frequency in %. Levels with fewer than 1000 samples are left blank:

zh_bins = np.arange(-50, 31, 2)
height_bins = np.arange(0, 12001, 250)

counts, _, _ = np.histogram2d(zh_values[valid], heights_2d[valid], bins=[zh_bins, height_bins])
frequency = 100 * counts / counts.sum(axis=0, keepdims=True)

6. Target classification

Finally, the classification product tells what the radar (and the lidar) are seeing: clear sky, droplets, ice, drizzle or rain, aerosols, insects, and so on. The class names are stored in the definition attribute of the target_classification variable, as lines like Value 0: Clear sky.. The notebook parses them to label the colour bar of the plot:

classification = xr.open_dataset(classification_file)
target = classification["target_classification"]

class_names = [
    line.split(":", 1)[1].strip().rstrip(".")
    for line in target.attrs["definition"].strip().splitlines()
    if line.strip().startswith("Value")
]

Each class gets its own colour (clear sky in white), and the classification is plotted as a function of time and height.

Going further

  • Change the station, the dates or the products (for example lidar, mwr, categorize, iwc or lwc) to explore other Cloudnet sites and products.
  • The other instrument notebooks follow the same pattern: Photometer, Lidar, Ceilometer and Spectrometer.