xradar.io.backends.imd.open_imd_datatree#

xradar.io.backends.imd.open_imd_datatree(filename_or_obj, **kwargs)[source]#

Open IMD radar file(s) as a xarray.DataTree.

IMD stores one sweep per NetCDF file. A volume is assembled from multiple files (typically 2-3 for long-range PPI or 9-10 for short-range, high-resolution PPI).

  • Single file path -> single-sweep DataTree.

  • List of file paths -> single volume DataTree. Multi-file stacking is delegated to xradar.util.create_volume(), which sorts sweeps by time and supports time_coverage_start, time_coverage_end, min_angle, max_angle filtering.

Note

When opening a single IMD sweep file as a DataTree, prefer xd.open_datatree(file, engine="imd") (or the xarray-native xr.open_datatree(file, engine="imd")). This function remains the documented API for the multi-file path because IMD volumes span multiple files, which the engine="imd" registry entry does not support.

To split a directory of mixed-volume files into per-volume groups, use group_imd_files() first:

for group in xd.io.group_imd_files("/data/imd"):
    dtree = xd.io.open_imd_datatree(group)
Parameters:

filename_or_obj (str, Path, or list/tuple of those) – Single IMD file path, or a list of paths making up one volume.

Keyword Arguments:
  • first_dim (str) – "auto" (default) or "time".

  • reindex_coord (dict, optional) – Nested dict with optional keys angle and range holding the kwargs for xradar.util.reindex_angle() and xradar.util.reindex_range().

  • reindex_angle (dict, optional) – Deprecated, use reindex_coord=dict(angle=...) instead.

  • site_as_coords (bool) – Attach station variables as coordinates on sweep Datasets. site_coords is accepted as an alias.

  • optional_groups (bool) – Include /radar_parameters, /georeferencing_correction and /radar_calibration subgroups. Defaults to False. With multiple files the values the files disagree about are left out of the groups, with a UserWarning.

  • volume_number (time_coverage_start, time_coverage_end, min_angle, max_angle,) – Forwarded to xradar.util.create_volume() when multi-file input is provided.

Returns:

dtree (xarray.DataTree) – CfRadial2-style DataTree with / root and sweep_N children.