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.

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.0

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.0
File Size Uploaded
pyodim-0.7.0.tar.gz 26.5 kB Details

Built distribution (wheel)

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

Total release size: 45.0 kB

Release files / pyodim-0.7.0.tar.gz

Download URL pyodim-0.7.0.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5c7e598742cc9923d7ba9902cd60ea9c4e112fdfd2ef2222a4d5e11b973c407a
BLAKE2b-256 checksum
How to use checksums
6eae3a29a1029ce5a88b2eb2203bfc71d5988853fe187cfd51f5fb17502c1c1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

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

Release history Release notifications | RSS feed

0.7.2

2 release files

This release

0.7.0 This release

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