diff --git a/README.md b/README.md index 44b83d3d..9f25a15b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Implementation of the Zarr core protocol (version 2 and 3) based on xtensor ## Installation -`xtensor-zarr` comes with a `libxtensor-zarr-gdal` shared library for accessing stores through GDAL's Virtual File System or the local file system. For all other stores, `xtensor-zarr` is a header-only library. +`xtensor-zarr` comes with a `libxtensor-zarr-gdal` shared library for accessing stores through GDAL's Virtual File System or the local file system. For all other stores, `xtensor-zarr` is a header-only library. If you do not link your project against `xtensor-zarr-gdal` target, you should add code from [xtensor-zarr-gdal.cpp](https://github.com/xtensor-stack/xtensor-zarr/blob/90f0acfbf74a4e3664b0861920409b6143600d67/src/xtensor-zarr-gdal.cpp#L3-L8) somewhere in your project to avoid linking errors. We provide a package for the mamba (or conda) package manager: diff --git a/docs/source/basic_usage.rst b/docs/source/basic_usage.rst index e902ad8c..3b902545 100644 --- a/docs/source/basic_usage.rst +++ b/docs/source/basic_usage.rst @@ -54,22 +54,25 @@ Create an array auto h = xt::get_zarr_hierarchy(store); // create an array in the hierarchy nlohmann::json attrs = {{"question", "life"}, {"answer", 42}}; - using S = std::vector; - S shape = {4, 4}; - S chunk_shape = {2, 2}; - xt::zarray a = h.create_array( + std::vector shape = {4, 4}; + std::vector chunk_shape = {2, 2}; + // specify options + xt::xzarr_create_array_options o; + o.chunk_memory_layout = 'C'; + o.chunk_separator = '/'; + o.attrs = attrs; + o.chunk_pool_size = 10; + o.fill_value = 0.0; + + xt::zarray z = h.create_array( "/arthur/dent", // path to the array in the store shape, // array shape chunk_shape, // chunk shape "(); a(2, 1) = 3.; } diff --git a/include/xtensor-zarr/xzarr_node.hpp b/include/xtensor-zarr/xzarr_node.hpp index f4dab577..313bea76 100644 --- a/include/xtensor-zarr/xzarr_node.hpp +++ b/include/xtensor-zarr/xzarr_node.hpp @@ -68,7 +68,7 @@ namespace xt { m_path = '/' + m_path; } - while (m_path.back() == '/') + while (!m_path.empty() && m_path.back() == '/') { m_path = m_path.substr(0, m_path.size() - 1); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 34f2d5d7..928faf7a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -79,11 +79,17 @@ include_directories(${GTEST_INCLUDE_DIRS} SYSTEM) set(XTENSOR_ZARR_TESTS main.cpp test_zarr.cpp - test_gcs.cpp - test_aws.cpp test_gdal.cpp ) +if(${storage_client_FOUND}) + list(APPEND XTENSOR_ZARR_TESTS test_gcs.cpp) +endif() + +if(${AWSSDK_FOUND}) + list(APPEND XTENSOR_ZARR_TESTS test_aws.cpp) +endif() + add_executable(test_xtensor_zarr ${XTENSOR_ZARR_TESTS} ${XTENSOR_ZARR_HEADERS}) if(DOWNLOAD_GTEST OR GTEST_SRC_DIR) add_dependencies(test_xtensor_zarr gtest_main) diff --git a/xtensor-zarrConfig.cmake.in b/xtensor-zarrConfig.cmake.in index a26bcd50..674843f0 100644 --- a/xtensor-zarrConfig.cmake.in +++ b/xtensor-zarrConfig.cmake.in @@ -21,10 +21,6 @@ find_dependency(xtensor-io @xtensor_io_REQUIRED_VERSION@) find_dependency(zarray @zarray_REQUIRED_VERSION@) find_dependency(nlohmann_json @nlohmann_json_REQUIRED_VERSION@) -set(PN xtensor_zarr) -set_and_check(${PN}_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@") -set(${PN}_LIBRARY "") -check_required_components(${PN}) if(NOT TARGET @PROJECT_NAME@) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")