radarx.ml.reassemble#

radarx.ml.reassemble(patches, index, shape=None, blend='cosine', *, name=None, attrs=None, n_threads=None, engine='auto')[source]#

Put patches (or model outputs on them) back together into sweeps.

Every gate is the weighted mean of the patch pixels covering it, with a separable blending window over each patch. NaN pixels are skipped; a gate no finite pixel covers is NaN. Unchanged patches give back the input.

Parameters:
  • patches (numpy.ndarray) – (n_patches, *lead, n_azimuth, n_range), in the order of polar_patches(). lead may differ from the input (a model with other output channels than input channels).

  • index (PatchIndex) – The index returned by polar_patches().

  • shape (tuple of int, optional) – (n_rays, n_gates) of the output; defaults to the sweep shape in index (single sweep only).

  • blend ({"cosine", "linear", "mean"}, default "cosine") – Blending window: squared sine (Hann), triangular, or uniform weights.

  • name (str, optional) – Name of the result when it is not the input’s fields (default "prediction").

  • attrs (dict, optional) – Attributes for the result variables (for example radarx.ml.Model.attrs).

  • n_threads (int, optional) – Threads of the compiled kernel (default: all cores).

  • engine ({"auto", "compiled", "numpy"}, default "auto") – Use the compiled kernel when available, or force one implementation.

Returns:

numpy.ndarray, xarray.DataArray, xarray.Dataset or xarray.DataTree – The same kind of object as the input of polar_patches(), with its coordinates. A Dataset (DataTree) gets its fields back when the patches have one channel per field; otherwise the result is one variable name with a channel dimension.