Skip to content

Commit

Permalink
fix for hsload with --link and s3paths (#131)
Browse files Browse the repository at this point in the history
* fix for append with chunks

* fix for append mode with s3 links
  • Loading branch information
jreadey authored Nov 28, 2022
1 parent 224beca commit 8da95ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions h5pyd/_apps/utillib.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,15 @@ def create_dataset(dobj, ctx):
# just use the dims field of dobj.chunks as chunk shape
chunks = get_chunk_dims(dobj)
if chunks is not None:
if dset_preappend is not None:
# check to see if an extra dimension is needed for the chunk shape
if isinstance(chunks, dict):
# chunktable is already adjusted
pass
else:
new_chunks = [1,]
new_chunks.extend(chunks)
chunks = tuple(new_chunks)
kwargs["chunks"] = chunks
if (
dobj.shape is None
Expand Down
4 changes: 2 additions & 2 deletions h5pyd/_hl/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def make_new_dset(
chunk > dim for dim, chunk in zip(tmp_shape, chunks) if dim is not None
):
errmsg = (
"Chunk shape must not be greater than data shape in any dimension. "
"{} is not compatible with {}".format(chunks, shape)
f"Chunk shape must not be greater than data shape in any dimension. "
"{chunks} is not compatible with {shape}"
)
raise ValueError(errmsg)

Expand Down
4 changes: 2 additions & 2 deletions h5pyd/_hl/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def rq_tuple(tpl, name):
try:
tpl = tuple(tpl)
except TypeError:
raise TypeError('"%s" argument must be None or a sequence object' % name)
raise TypeError(f'"{name}" argument must be None or a sequence object')
if len(tpl) != len(shape):
raise ValueError('"%s" must have same rank as dataset shape' % name)
raise ValueError(f'"{name}" must have same rank as dataset shape')

rq_tuple(chunks, "chunks")
rq_tuple(maxshape, "maxshape")
Expand Down

0 comments on commit 8da95ff

Please sign in to comment.