Sparse array is not open for reading when writing
See original GitHub issueThis code complains for array not being open for reading (previous step).
The array definition is:
domain = tiledb.Domain(tiledb.Dim(name="cols", domain=(978307200, 4102358400),
tile=1000, dtype=np.int64))
schema = tiledb.ArraySchema(domain=domain, sparse=True,
attrs=[tiledb.Attr(name="ndvi", dtype=np.float32),
tiledb.Attr(name="kcb",dtype=np.float32),
tiledb.Attr(name="nn",dtype=np.float32),
tiledb.Attr(name="eto",dtype=np.float32),
tiledb.Attr(name="trigger",dtype=np.dtype('b'))])
`
What I want to do is, for a given timestamp (dimension cols), write a list of attributes (vegatation indexes).
And when computed those values, the code that tries to write today’s recordings is:
#TiledDB writing
with tiledb.SparseArray(grupo_parcela, mode='w') as parcelaAttrsW:
parcelaAttrsW[tsHoy]['trigger'] = trigger
parcelaAttrsW[tsHoy]['eto']=etoParcela
So, direct access by indexing for writing seems to need previous read, and thus makes opening ‘w’ fail. Should I construct a numpy array first and then write it to file, should it be something like:
parcelaAttrsW[tsHoy]=full array numpy
In my opinion, RW mode is something quite useful that has been requested before:
https://github.com/TileDB-Inc/TileDB-Py/issues/58
Kind regards!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Writing Sparse Arrays — TileDB 1.6.3 documentation
In this tutorial you will learn how to write to sparse arrays. It is highly recommended that you read the tutorials on sparse...
Read more >Sparse Storage in Fortran: Only Reading and Writing
I have an array with multiple dimensions (the goal is to allow for about 100) and each dimension has a size of about...
Read more >Read text files as sparse arrays and concatenate in a loop
I would like to read multiple text files and build a sparse array by concatenating row-wise one after the other. The text files...
Read more >Sparse matrices (scipy.sparse) — SciPy v1.9.3 Manual
When using the array interface, please note that: x * y no longer performs matrix multiplication, but element-wise multiplication (just like with NumPy ......
Read more >SparseArray - Android Developers
Creates a new SparseArray containing no mappings that will not require any ... a concise but informative representation that is easy for a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is a more detailed example when you have two attributes
a
andb
in a sparse array with a single dimensiont
:The above will create the following sparse cells in
A
(recall,t
is the dimension, anda
andb
are the attributes):My comment above meant to clarify that whenever you write some cells to the array, you need to provide values for all attributes. In other words, in the above example,
A[t] = {"a":a}
orA[t] = {"b":b}
orA[t] = a
orA[t] = b
would error out - you need to provide values for botha
andb
.I think there are two different issues here.
mode ='r'
and one withmode='w'
). This decision was taken in order to simplify the consistency semantics; when opening an array for reading, TileDB “views” only writes that happened at or before the timestamp the array is getting opened at. If we mix reads and writes in the same object, these semantics can become confusing. We continue to consider the read-write mode though and hope to add it in the future with some clear semantics.Could you please send us the exact error message you are getting for (1) above, as I think it is confusing and we could improve it.