Skip to main content

pyodim

pyodim is a Python library for reading ODIM H5 radar files, transforming them into xarray datasets with geographic coordinates. This library is designed for users needing direct access to ODIM H5 files, providing tools to read and process radar data.

Table of Contents

Overview

The pyodim library provides essential functions for handling ODIM H5 radar data. It reads radar sweeps and converts them into xarray datasets, handling various metadata and radar coordinates transformations. The main function, read_odim, enables easy access to radar data in a format compatible with Python's data analysis ecosystem.

Installation

pyodim is available on PyPI:

pip install pyodim

It requires only numpy, h5py and xarray. Optional extras: pyodim[dask] for read_odim(lazy=True), pyodim[pyproj] for georeference(method="pyproj").

Usage

read_odim reads the sweeps of an ODIM H5 file into a list of xarray.Dataset ordered by increasing elevation; read_sweep reads one sweep.

Read a volume

from pyodim import read_odim

sweeps = read_odim("radar_file.h5")          # list of xarray.Dataset, eager
lowest = read_odim("radar_file.h5", sweeps=0)[0]
some = read_odim("radar_file.h5", sweeps=[0, 3], include_fields=["DBZH", "VRADH"])

Read one sweep

import h5py
from pyodim import read_sweep

ds = read_sweep("radar_file.h5", 0)          # by position in elevation order
with h5py.File("radar_file.h5") as hfile:    # or from an open handle, by ODIM key
    ds = read_sweep(hfile, "dataset3")

Lazy reading with dask (optional)

import dask
from pyodim import read_odim

delayed_sweeps = read_odim("radar_file.h5", lazy=True)   # list of dask.delayed
sweeps = dask.compute(*delayed_sweeps)                    # read in parallel

Requires pip install pyodim[dask].

Keep the file handle open (edit workflows)

from pyodim import read_odim

sweeps, hfile = read_odim("radar_file.h5", mode="r+", return_handle=True)
try:
    ds0 = sweeps[0]
    # ... update content through hfile as needed ...
finally:
    hfile.close()

Geographic coordinates

Per-gate longitude/latitude are not computed at read time (they were the most expensive part of a read and most workflows never use them). Add them when you need them:

from pyodim import read_odim, georeference

ds = read_odim("radar_file.h5", sweeps=0)[0]
ds = georeference(ds)            # pure-numpy WGS84 geodesic, exact to < 1 m
# or in one call:
ds = read_odim("radar_file.h5", sweeps=0, georef=True)[0]

Each sweep carries x, y, z (metres east/north of the radar and height above mean sea level, 4/3-Earth refraction model), range, azimuth, elevation, per-ray time and prt. Fields are float32 with NaN for nodata and undetect gates (mask_undetect=False keeps the decoded undetect value); each field's gain, offset, nodata, undetect and ODIM id are kept in its attributes.

Parameters

read_odim(odim_file, *, sweeps=None, lazy=False, mode="r", return_handle=False, **options)

  • sweeps (int or list of int, optional): sweep index/indices in elevation order; all if omitted.
  • lazy (bool): return dask.delayed objects instead of datasets.
  • mode (str): HDF5 mode, "r" or "r+".
  • return_handle (bool): return (sweeps, hfile) and leave the file open.
  • lazy_load (bool): deprecated alias for lazy (pyodim < 0.7), emits a DeprecationWarning.

read_sweep(source, sweep, *, mode="r", **options)

  • source (path or open h5py.File), sweep (int index or "datasetN" key).

Options accepted by both:

  • include_fields / exclude_fields (list of str): fields to read / skip.
  • check_nyq (bool): warn when the Nyquist velocity is inconsistent with the PRF.
  • max_field_elements (int or None): guard against oversized fields (default 50,000,000).
  • mask_undetect (bool): NaN for undetect gates (default True).
  • georef (bool): add longitude/latitude (default False, see georeference).

Feel free to contribute to pyodim by submitting issues or pull requests.

Metadata

Release files for pyodim 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyodim 0.7.2
File Size Uploaded
pyodim-0.7.2.tar.gz 28.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyodim 0.7.2
File Interpreter ABI Platform
pyodim-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 48.0 kB

Release files / pyodim-0.7.2.tar.gz

Download URL pyodim-0.7.2.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bfc1e2927b4baee8cee59bbcfc4dc7dba837d4f6293af8f7db9410a864228388
BLAKE2b-256 checksum
How to use checksums
d6cc46e3bb68bcf98b4cfd7646cd7c87b0e1fb3af7968da0e9af6141a61cc5be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / pyodim-0.7.2-py3-none-any.whl

Download URL pyodim-0.7.2-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3f5b8327f7b37d5c9402b30ce62df99c71d58843e3cc2525a25b6ee32bc6971
BLAKE2b-256 checksum
How to use checksums
2704b397bf6ac437a5a1f822c1b86b0498fc44a07222b4417126669b5529bb69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.0

2 release files

0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page