def simple_dataarrays()

in hypothesis_gufunc/extra/xr.py [0:0]


def simple_dataarrays(dims, dtype=DEFAULT_DTYPE, elements=None, min_side=0, max_side=DEFAULT_SIDE):
    """Generate a :class:`xarray:xarray.DataArray` with dimensions that are fixed a-priori and simple coordinates.

    Parameters
    ----------
    dims : list(str)
        Dimensions we need to generate coordinates for.
    dtype : type
        Data type for values in the :class:`xarray:xarray.DataArray`. This can be anything understood by
        :func:`hypothesis:hypothesis.extra.numpy.arrays`.
    elements : SearchStrategy or None
        Strategy to fill the elements of the :class:`xarray:xarray.DataArray`. If `None`, a default is selected based on
        `dtype`.
    min_side : int
        Minimum side length of the :class:`xarray:xarray.DataArray`.
    max_side : int or None
        Maximum side length of the :class:`xarray:xarray.DataArray`.

    Returns
    -------
    da : :class:`xarray:xarray.DataArray`
        :class:`xarray:xarray.DataArray` generated with the dimensions, simple coordinates, and elements from the
        specified strategy.
    """
    _check_valid_size_interval(min_side, max_side, "side")

    default_st = simple_coords(min_side=min_side, max_side=max_side)
    coords_st = OrderedDict([(dd, default_st) for dd in dims])
    S = fixed_dataarrays(dims, dtype=dtype, elements=elements, coords_st=coords_st)
    return S