xradar.io.export.cfradial2.to_cfradial2#

xradar.io.export.cfradial2.to_cfradial2(dtree, filename, engine=None, timestep=None, deepcopy=False, *, global_attrs: dict[str, object] | None = None)[source]#

Save DataTree to CfRadial2 compliant file.

The input DataTree is never modified. All sweep rewrites and root attribute edits are applied to a copy, which is shallow by default.

Parameters:
  • dtree (xarray.DataTree) – DataTree with CfRadial2 groups.

  • filename (str) – output filename

Keyword Arguments:
  • timestep (int) – timestep of wanted volume, currently not used

  • engine (str) – Either netcdf4 or h5netcdf.

  • deepcopy (bool) – If True, work on a deep copy of dtree (the data is duplicated in memory). If False (default), work on a shallow copy, which shares the underlying data arrays with dtree but not its structure and attributes.

  • global_attrs (dict) – Dictionary of root-group global attributes to set manually, e.g. those which cannot be deduced from the DataTree or should be overwritten. These are applied last and take precedence over any attributes derived from the DataTree.