@requires_shapely
def test_reshape_unique_geometries(geometry_ds):
    (_, in_ds) = geometry_ds
    out = cfxr.geometry.reshape_unique_geometries(in_ds)
    assert (out.geometry.dims == ('features',))
    assert (out.data.dims == ('features', 'index'))
    np.testing.assert_array_equal(out.geometry, in_ds.geometry.values[np.array([1, 2, 0])])
    in_ds['index'] = in_ds.time
    in_ds = in_ds.drop_vars('time').rename(index='time')
    out = cfxr.geometry.reshape_unique_geometries(in_ds)
    assert (out.geometry.dims == ('features',))
    assert (out.data.dims == ('features', 'time'))
    np.testing.assert_array_equal(out.time, [0, 1])
    geoms = in_ds.geometry.expand_dims(n=[1, 2])
    in_ds = in_ds.assign(geometry=geoms)
    with pytest.raises(ValueError, match='The geometry variable must be 1D'):
        cfxr.geometry.reshape_unique_geometries(in_ds)
@requires_shapely
def test_reshape_unique_geometries(geometry_ds):
    (_, in_ds) = geometry_ds
    out = cfxr.geometry.reshape_unique_geometries(in_ds)
    assert (out.geometry.dims == ('features',))
    assert (out.data.dims == ('features', 'index'))
    np.testing.assert_array_equal(out.geometry, in_ds.geometry.values[np.array([1, 2, 0])])
    in_ds['index'] = in_ds.time
    in_ds = in_ds.drop_vars('time').rename(index='time')
    out = cfxr.geometry.reshape_unique_geometries(in_ds)
    assert (out.geometry.dims == ('features',))
    assert (out.data.dims == ('features', 'time'))
    np.testing.assert_array_equal(out.time, [0, 1])
    geoms = in_ds.geometry.expand_dims(n=[1, 2])
    in_ds = in_ds.assign(geometry=geoms)
    with pytest.raises(ValueError, match='The geometry variable must be 1D'):
        cfxr.geometry.reshape_unique_geometries(in_ds)