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 supportstime_coverage_start,time_coverage_end,min_angle,max_anglefiltering.
Note
When opening a single IMD sweep file as a DataTree, prefer
xd.open_datatree(file, engine="imd")(or the xarray-nativexr.open_datatree(file, engine="imd")). This function remains the documented API for the multi-file path because IMD volumes span multiple files, which theengine="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, orlist/tupleofthose) – 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 keysangleandrangeholding the kwargs forxradar.util.reindex_angle()andxradar.util.reindex_range().reindex_angle (
dict, optional) – Deprecated, usereindex_coord=dict(angle=...)instead.site_as_coords (
bool) – Attach station variables as coordinates on sweep Datasets.site_coordsis accepted as an alias.optional_groups (
bool) – Include/radar_parameters,/georeferencing_correctionand/radar_calibrationsubgroups. Defaults toFalse. With multiple files the values the files disagree about are left out of the groups, with aUserWarning.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 andsweep_Nchildren.