How to get all the non-empty coordinates from sparse array?

Suppose I create a sparse array:

import tiledb
import numpy as np


path = 'test.tiledb'
dim1 = tiledb.Dim(name='dim1', domain=(None, None), tile=None, dtype=np.bytes_)
dim2 = tiledb.Dim(name='dim2', domain=(None, None), tile=None, dtype=np.bytes_)
attr = tiledb.Attr(name='attr', dtype=np.float32)
dom = tiledb.Domain(dim1, dim2)
schema = tiledb.ArraySchema(domain=dom, sparse=True, attrs=[attr])
tiledb.Array.create(path, schema)

with tiledb.open(path, 'w') as array:
    array['a1', 'b1'] = 1
    array['a1', 'b2'] = 2
    array['a2', 'b1'] = 3
    array['a3', 'b1'] = 4

How can I retrieve all the “keys” from array , like array.dim('dim1').values() or array.coordinates('dim1') , which should return ['a1', 'a2', 'a3'] ?

1 Like

Hi @WarBean,

This message got stuck in the review queue - sorry about that! I will cross-link the GitHub issue where we are discussing and continue there:

Best,
Isaiah

2 Likes