Skip to content

Commit

Permalink
Add docs for tiledb.save and tiledb.open
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Apr 9, 2019
1 parent dd27a74 commit d7543c2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tiledb/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
import numpy as np

def open(uri, key=None, attr=None, mode='r', config=None):
"""
Open a TileDB array at the given URI
:param uri: any TileDB supported URI
:param key: encryption key, str or None
:param str mode: (default 'r') Open the array object in read 'r' or write 'w' mode
:param attr: attribute name to select from a multi-attribute array, str or None
:param config: TileDB config dictionary, dict or None
:return:
"""
if config:
cfg = tiledb.Config(config)
ctx = tiledb.Ctx(cfg)
Expand All @@ -23,6 +33,15 @@ def open(uri, key=None, attr=None, mode='r', config=None):


def save(uri, array, config=None, **kw):
"""
Save array-like object at the given URI.
:param uri: str or None
:param array: array-like object convertible to NumPy
:param config: TileDB config dictionary, dict or None
:param kw: optional keyword args will be forwarded to tiledb.Array constructor
:return:
"""
if not isinstance(array, np.ndarray):
raise ValueError("expected NumPy ndarray, not '{}'".format(type(array)))
if config:
Expand Down Expand Up @@ -61,6 +80,9 @@ def empty_like(uri, arr, config=None, key=None, tile=None):


def from_numpy(uri, array, ctx=default_ctx(), **kw):
"""
Convenience method, see `tiledb.DenseArray.from_numpy`
"""
if not isinstance(array, np.ndarray):
raise Exception("from_numpy is only currently supported for numpy.ndarray")

Expand Down

0 comments on commit d7543c2

Please sign in to comment.