xtensor-zarr icon indicating copy to clipboard operation
xtensor-zarr copied to clipboard

Documentation is out of date

Open dzenanz opened this issue 3 years ago • 2 comments

https://xtensor-zarr.readthedocs.io/en/latest/basic_usage.html and https://github.com/xtensor-stack/xtensor-zarr/blob/master/README.md#usage are in sync with each other, but in significant dissonance with the code. Create an array example fails to compile with:

9>itkOMEZarrNGFFImageIOTest.cxx
9>C:\Dev\ITKIOOMEZarrNGFF\test\itkOMEZarrNGFFImageIOTest.cxx(50,21): error C2672: 'xt::xzarr_hierarchy<xt::xzarr_file_system_store>::create_array': no matching overloaded function found
9>C:\Dev\ITKIOOMEZarrNGFF\test\itkOMEZarrNGFFImageIOTest.cxx(61,5): error C2780: 'xt::zarray xt::xzarr_hierarchy<xt::xzarr_file_system_store>::create_array(const std::string &,shape_type,shape_type,const std::string &,O)': expects 5 arguments - 10 provided
9>C:\Libs\xtensor-zarr\include\xtensor-zarr/xzarr_hierarchy.hpp(48): message : see declaration of 'xt::xzarr_hierarchy<xt::xzarr_file_system_store>::create_array'
9>C:\Dev\ITKIOOMEZarrNGFF\test\itkOMEZarrNGFFImageIOTest.cxx(63,5): error C2064: term does not evaluate to a function taking 2 arguments
9>Done building project "IOOMEZarrNGFFTestDriver.vcxproj" -- FAILED.

And an attempt to modify it to work:

  {
    // create a hierarchy on the local file system
    xt::xzarr_file_system_store store("test.zr3");
    auto h = xt::create_zarr_hierarchy(store);

    // create an array in the hierarchy
    nlohmann::json attrs = { {"question", "life"}, {"answer", 42} };
    using S = std::vector<std::size_t>;
    S shape = { 4, 4 };
    S chunk_shape = { 2, 2 };

    xt::zarray a = h.create_array(
      "/arthur/dent",  // path to the array in the store
      shape,  // array shape
      chunk_shape,  // chunk shape
      "<f8"  // data type, here little-endian 64-bit floating point
    );

    // write array data
    a(2, 1) = 3.;
  }

results in C:\Dev\ITKIOOMEZarrNGFF\test\itkOMEZarrNGFFImageIOTest.cxx(60,5): error C2064: term does not evaluate to a function taking 2 arguments at line a(2, 1) = 3.;.

dzenanz avatar Dec 17 '21 22:12 dzenanz

Oh, I have encountered this problem too!! And I'm shocked that so many years passed but up-to-date APIs or Usage codes are didn't modified to match the package...

litxiaoyao avatar Aug 15 '23 07:08 litxiaoyao

Moreover, how to modify this error? results in C:\Dev\ITKIOOMEZarrNGFF\test\itkOMEZarrNGFFImageIOTest.cxx(60,5): error C2064: term does not evaluate to a function taking 2 arguments at line a(2, 1) = 3.;.

litxiaoyao avatar Aug 15 '23 08:08 litxiaoyao