Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BoolArrayDimIndexer #113

Open
Artur-man opened this issue Oct 27, 2024 · 0 comments
Open

Implement BoolArrayDimIndexer #113

Artur-man opened this issue Oct 27, 2024 · 0 comments

Comments

@Artur-man
Copy link
Contributor

Artur-man commented Oct 27, 2024

https://github.com/zarr-developers/zarr-python/blob/4a3bbf1cbb89e90ea9ca4d6d75dae23ed4b957c9/src/zarr/core/indexing.py#L581

pizzarr/R/indexing.R

Lines 405 to 416 in 67359dd

if(length(dim_sel) == 1) {
dim_indexer <- IntDimIndexer$new(dim_sel, dim_len, dim_chunk_len)
} else if(is_slice(dim_sel)) {
dim_indexer <- SliceDimIndexer$new(dim_sel, dim_len, dim_chunk_len)
} else if(length(dim_sel) > 1) {
dim_indexer <- IntArrayDimIndexer$new(dim_sel, dim_len, dim_chunk_len)
# TODO: implement BoolArrayDimIndexer and fix if condition here (is_bool_vec)
# } else if(is_bool_vec(dim_sel)) {
# dim_indexer <- BoolArrayDimIndexer$new(dim_sel, dim_len, dim_chunk_len)
} else {
stop('Unsupported selection item for basic indexing, expected integer, slice, vector of integer or boolean')
}

and also update manage_filters for orthogonal selection to capture boolean vectors:

pizzarr/R/filters.R

Lines 8 to 17 in 67359dd

manage_filters <- function(filters) {
lapply(filters, function(x) {
# Proceed based on type of filter
if(typeof(x) == "symbol") {
# When empty dimension, return everything
if(x == "") {
return(NULL)
} else {
stop("Unsupported filter '", as.character(x), "' supplied")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant