def simple_datasets()

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


def simple_datasets(vars_to_dims, dtype=None, elements=None, min_side=0, max_side=DEFAULT_SIDE):
    """Generate :class:`xarray:xarray.Dataset` with variables and dimensions that are fixed a-priori and simple
    coordinates.

    Parameters
    ----------
    vars_to_dims : dict(typing.Hashable, list(str))
        Mapping of variable names to list of dimensions, which can be fed to constructor for a
        :class:`xarray:xarray.Dataset`.
    dtype : dict(typing.Hashable, type) or None
        Dictionary mapping variables names to the data type for that variable's elements.
    elements : SearchStrategy or None
        Strategy to fill the elements of the :class:`xarray:xarray.Dataset`. If `None`, a default is selected based on
        `dtype`.
    min_side : int
        Minimum side length of the :class:`xarray:xarray.Dataset`.
    max_side : int or None
        Maximum side length of the :class:`xarray:xarray.Dataset`.

    Returns
    -------
    ds: :class:`xarray:xarray.Dataset`
        A :class:`xarray:xarray.Dataset` with the specified variables and dimensions, and simple coordinates.
    """
    _check_valid_size_interval(min_side, max_side, "side")

    all_dims = _get_all_dims(vars_to_dims)
    default_st = simple_coords(min_side=min_side, max_side=max_side)
    coords_st = OrderedDict([(dd, default_st) for dd in all_dims])
    S = fixed_datasets(vars_to_dims, dtype=dtype, elements=elements, coords_st=coords_st)
    return S