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.
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.
pyodim is available on PyPI:
pip install pyodimIt requires the following packages: h5py pyproj pandas numpy xarray dask.
The main entry point for pyodim is read_odim, which reads one or more sweeps
from an ODIM H5 file and returns xarray datasets.
from pyodim import read_odim
# Read all sweeps lazily (default backend='dask')
sweeps = read_odim("radar_file.h5")
# Compute the first sweep when needed
first = sweeps[0].compute()
print(first)from pyodim import read_odim
# Read one sweep immediately as an xarray.Dataset
sweeps = read_odim("radar_file.h5", nslice=0, backend="numpy")
print(sweeps[0])from pyodim import read_odim
# Get datasets + open h5py handle
sweeps, hfile = read_odim(
"radar_file.h5",
backend="numpy",
mode="r+",
return_handle=True,
)
try:
ds0 = sweeps[0]
# ... update content through hfile as needed ...
finally:
hfile.close()read_odim key parameters:
odim_file(str): Path to the ODIM H5 file.nslice(int, optional): Sweep index to read; if omitted, reads all sweeps.backend(str, optional):"dask"(lazy) or"numpy"(eager).compute(bool, optional): Ifbackend="dask", compute before returning.mode(str, optional): HDF5 mode ("r","r+", etc.).return_handle(bool, optional): Return(sweeps, hfile)ifTrue.include_fields(List[str], optional): Fields to include.exclude_fields(List[str], optional): Fields to exclude.check_nyq(bool, optional): Check Nyquist parameter consistency.use_dask_arrays(bool, optional): Dask-backed field arrays (requiresreturn_handle=Trueandbackend="numpy").
read_write_odim is deprecated in favor of:
read_odim(..., return_handle=True, mode="r"|"r+")See CHANGELOG.md for the deprecation timeline.
Feel free to contribute to pyodim by submitting issues or pull requests.