Registry / data / xradar

xradar

JSON →
library0.12.0pypypiunverified

xradar (version 0.11.1) provides tools to load and process weather radar data into the xarray data model, enabling efficient, labeled multi-dimensional array computing. It focuses on reading various radar formats (e.g., ODIM H5, IRIS, GPM) and converting them into structured xarray Datasets or Groups, often leveraging internal dependencies like wradlib and pyodim. The library is actively maintained with several releases per year, evolving its API and adding support for new data formats and processing capabilities.

pip install xradar
INSTALL
IMPORT
SIG · XRADAR
X
xradar
datapythonv0.12.0
Install
19.5s avg
Import
3039ms
Disk
508MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.11.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 19.5s · import 3.039s · 494MB
508MB installed
● package 508MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

read_odim_h5
from xradar.io import read_odim_h5
from xradar.io import read_odim_h5

This quickstart demonstrates how to load a common ODIM H5 radar file using `xradar.io.read_odim_h5`. It then shows how to access the resulting xarray Group, navigate to individual sweeps (which are xarray Datasets), and inspect a data variable like reflectivity (DBZH). A helper comment is included to assist in downloading a suitable example file if you don't have one.

import xradar as xrdr import xarray as xr import os # --- Instructions to get an example ODIM H5 file --- # Option 1: Download it (requires 'wget' or equivalent) # If you don't have 'wget' (e.g., on Windows), manually download from: # https://github.com/xarray-contrib/xradar/raw/main/doc/source/notebooks/data/example.h5 # Save it as 'example.h5' in the same directory as this script. # os.system("wget -nc https://github.com/xarray-contrib/xradar/raw/main/doc/source/notebooks/data/example.h5 -O example.h5") file_path = "example.h5" if os.path.exists(file_path): try: # Read the ODIM H5 file into an xarray Group of Datasets # Each sweep is typically a separate Dataset within the Group ds_group = xrdr.io.read_odim_h5(file_path) print(f"Successfully loaded data from: {file_path}") print("Dataset Group structure:") print(ds_group) # Access a specific sweep (e.g., 'sweep_0') if 'sweep_0' in ds_group.keys(): sweep_0 = ds_group['sweep_0'] print("\nFirst sweep (sweep_0) details:") print(sweep_0) # Access a specific data variable (e.g., 'DBZH' - Reflectivity) if 'DBZH' in sweep_0.data_vars: print("\nFirst sweep's reflectivity (DBZH) data snippet:") print(sweep_0.DBZH.isel(range=slice(0, 5), azimuth=slice(0, 5))) else: print("\n'DBZH' variable not found in sweep_0.") else: print("\n'sweep_0' not found in the dataset group.") except Exception as e: print(f"Error processing file '{file_path}': {e}") print("Please ensure the file is a valid ODIM H5 radar file and dependencies are installed.") else: print(f"Error: Example file '{file_path}' not found.") print("Please download it as per the instructions above, or provide your own ODIM H5 file.")
Debug
Known issues
breakingThe internal implementation of IO functions might change, especially for complex formats, potentially affecting performance or requiring specific versions of underlying parsers (like `pyodim`). While the high-level `read_*` API aims for stability, argument changes are possible in 0.x.x versions.
fix
Always consult the latest documentation for `xradar.io` functions. Pin your xradar version for production environments to avoid unexpected API changes in minor releases, or carefully review release notes before upgrading.
affects: <0.11.0
gotchaxradar often returns an `xarray.Group` object where each radar sweep is a separate `xarray.Dataset`. Users accustomed to a single `xarray.Dataset` may find this hierarchical structure unexpected, requiring careful indexing (e.g., `ds_group['sweep_0']`) to access data.
fix
Familiarize yourself with the `xarray.Group` API. Use `ds_group.keys()` to see available sweeps and `ds_group['sweep_idx']` to select a specific sweep. The official xradar documentation provides examples of navigating this structure.
affects: All versions
gotchaRadar data comes with complex coordinate systems (e.g., polar coordinates, varying projections). xradar ingests these, but direct plotting on geographical maps often requires explicit projection handling and transformations, often using `wradlib` or `cartopy`, which are not always automatic.
fix
Understand the coordinate reference system (CRS) embedded in your radar data (if any). Use `wradlib.georef` or `pyproj` for transformations if mapping to common geographic projections. Refer to `xradar`'s plotting examples or integrate with `wradlib`'s mapping capabilities.
affects: All versions
gotchaSome radar formats might require specific C libraries (e.g., HDF5, netCDF-C) to be installed on your system in addition to the Python packages (`h5py`, `netcdf4`). Missing these can lead to errors during file reading.
fix
Ensure you have the necessary system-level dependencies for HDF5 and NetCDF. On Linux, this usually involves `sudo apt-get install libhdf5-dev libnetcdf-dev`. On other OS, consult the documentation for `h5py` and `netcdf4`.
affects: All versions
Upgrade
Version history
0.12.0latest on PyPI · released Apr 21, 2026
Audit
Dependencies
xarrayrequiredCore dependency for the xarray data model.
wradlibrequiredUsed for internal radar processing and coordinate transformations.
pyodimrequiredUsed for reading ODIM H5 files.
h5pyrequiredRequired for HDF5-based radar formats (e.g., ODIM H5).
netcdf4requiredRequired for NetCDF-based radar formats.
cartopyoptionalOften used for plotting radar data on maps. Installed with `xradar[all]`.
Agent activity
65 hits · last 30 days
node
54
Meta
1
OpenAI (training)
1
Resources