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

write_zarr_array duplicate path? #1

Open
giovp opened this issue Apr 28, 2023 · 1 comment
Open

write_zarr_array duplicate path? #1

giovp opened this issue Apr 28, 2023 · 1 comment

Comments

@giovp
Copy link

giovp commented Apr 28, 2023

Hi,

When running this code

library(Rarr)
image <- array(as.double(rnorm(3*50*50)),dim = c(3,50,50))
Rarr::write_zarr_array(image,
                       zarr_array_path = "new.zarr",
                       chunk_dim = dim(image))

it seems to write to a file named "new.zarrnew.zarr" . Potential bug?

@Artur-man
Copy link

Artur-man commented Jun 15, 2024

In .normalize_array_path, normalizePath doesn't normalize the path of a file/dir that doesnt exist, hence root and path are duplicates of each other.

> path <- "new.zarr"
> dir.exists("new.zarr") | file.exists(path)
[1] FALSE
> path <- normalizePath(path, winslash = "/", mustWork = FALSE)
> path 
[1] "new.zarr"
> gsub(x = path, "(^[[:alnum:]:.]*/)(.*)", replacement = "\\1")
[1] "new.zarr"
> gsub(x = path, "(^[[:alnum:]:.]*/)(.*)", replacement = "\\2")
[1] "new.zarr"

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

2 participants