Skip to content

Commit

Permalink
Enable fancy selection with multiple coordinates (#388)
Browse files Browse the repository at this point in the history
* wip for fancy indexing with multiple coord list

* pointsel update

* support fancy selection with multiple coords

* fix flake8 error
  • Loading branch information
jreadey authored Aug 13, 2024
1 parent f03e1aa commit 314df69
Show file tree
Hide file tree
Showing 10 changed files with 476 additions and 323 deletions.
1 change: 1 addition & 0 deletions hsds/chunk_sn.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import base64
import math
import numpy as np

from json import JSONDecodeError
from asyncio import IncompleteReadError
from aiohttp.web_exceptions import HTTPException, HTTPBadRequest
Expand Down
2 changes: 1 addition & 1 deletion hsds/dset_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def getChunkItem(chunkid):
kwargs = {"chunk_index": chunk_index, "factors": table_factors}
_get_arr_pts(arr_points, arr_index, pt, **kwargs)

msg = f"got chunktable - {len(arr_points)} entries, calling getSelectionData"
msg = f"got chunktable - {len(arr_points)} entries, calling getChunkLocations"
log.debug(msg)
# this call won't lead to a circular loop of calls since we've checked
# that the chunktable layout is not H5D_CHUNKED_REF_INDIRECT
Expand Down
17 changes: 13 additions & 4 deletions hsds/dset_sn.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ async def POST_Dataset(request):
dims = None
shape_json = {}
rank = 0
chunk_size = None

if "shape" not in body:
shape_json["class"] = "H5S_SCALAR"
Expand Down Expand Up @@ -858,19 +859,21 @@ async def POST_Dataset(request):
else:
creationProperties = {}

# TBD: check for invalid layout class...
if layout_props:
if layout_props["class"] in ("H5D_COMPACT", "H5D_CONTIGUOUS"):
# treat compact and contiguous as chunked
if layout_props["class"] == "H5D_CONTIGUOUS":
# treat contiguous as chunked
layout_class = "H5D_CHUNKED"
else:
layout_class = layout_props["class"]

elif shape_json["class"] != "H5S_NULL":
layout_class = "H5D_CHUNKED"
else:
layout_class = None

if layout_class:
if layout_class == "H5D_COMPACT":
layout = {"class": "H5D_COMPACT"}
elif layout_class:
# initialize to H5D_CHUNKED
layout = {"class": "H5D_CHUNKED"}
else:
Expand Down Expand Up @@ -1035,6 +1038,12 @@ async def POST_Dataset(request):
log.warn(msg)
raise HTTPBadRequest(reason=msg)

if f_in and chunk_size is None:
# filters can only be used with chunked datasets
msg = "Filters can only be used with chunked datasets"
log.warning(msg)
raise HTTPBadRequest(reason=msg)

f_out = []
for filter in f_in:
if isinstance(filter, int) or isinstance(filter, str):
Expand Down
Loading

0 comments on commit 314df69

Please sign in to comment.