Skip to content

[WIP] Add test for chunked zarray assignment #24

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .azure-pipelines/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
vmImage: $(image_name)
timeoutInMinutes: 360
steps:

- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH

Expand Down
213 changes: 173 additions & 40 deletions examples/zarr_v2.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/xtensor-zarr/xzarr_aws_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace xt
request.SetKey(m_path);

std::shared_ptr<Aws::IOStream> writer = Aws::MakeShared<Aws::FStream>("SampleAllocationTag", m_path.c_str(), std::ios_base::in | std::ios_base::binary);
writer->write(value, size);
writer->write(value, (std::streamsize)size);
writer->flush();

request.SetBody(writer);
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor-zarr/xzarr_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ namespace xt
std::size_t zarr_major;
if (i == std::string::npos)
{
zarr_major = std::stoi(zarr_version);
zarr_major = (std::size_t)std::stoi(zarr_version);
}
else
{
zarr_major = std::stoi(zarr_version.substr(0, i));
zarr_major = (std::size_t)std::stoi(zarr_version.substr(0, i));
}
if ((zarr_major < 2) || (zarr_major > 3))
{
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor-zarr/xzarr_file_system_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace xt
}
}
std::ofstream stream(m_path, std::ofstream::binary);
stream.write(value, size);
stream.write(value, (std::streamsize)size);
stream.flush();
}

Expand Down
2 changes: 1 addition & 1 deletion include/xtensor-zarr/xzarr_gcs_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace xt
void xzarr_gcs_stream::assign(const char* value, std::size_t size)
{
auto writer = m_client.WriteObject(m_bucket, m_path);
writer.write(value, size);
writer.write(value, (std::streamsize)size);
writer.flush();
}

Expand Down
15 changes: 13 additions & 2 deletions test/test_zarr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace xt
"data/root/arthur/dent/c1/1",
"data/root/arthur/dent/c2/0",
"data/root/arthur/dent/c2/1"};
for (int i = 0; i < 6; i++)
for (unsigned long int i = 0; i < 6; i++)
{
EXPECT_EQ(keys1[i], ref1[i]);
}
Expand All @@ -165,7 +165,7 @@ namespace xt
auto keys2 = s2.list();
std::string ref2[] = {"android.array.json",
"paranoid.group.json"};
for (int i = 0; i < 2; i++)
for (unsigned long int i = 0; i < 2; i++)
{
EXPECT_EQ(keys2[i], ref2[i]);
// we don't have rights to erase objects in this bucket as an anonymous client
Expand All @@ -192,4 +192,15 @@ namespace xt
auto h = create_zarr_hierarchy("test.zr3");
auto z = h.create_array("/foo", shape, chunk_shape, "<f8");
}

TEST(xzarr_hierarchy, zarr_assign)
{
std::vector<size_t> shape = {4, 4};
std::vector<size_t> chunk_shape = {2, 2};
auto h1 = create_zarr_hierarchy("src.zr3");
zarray z1 = h1.create_array("/", shape, chunk_shape, "<f8");
auto h2 = create_zarr_hierarchy("dst.zr3");
zarray z2 = h2.create_array("/", shape, chunk_shape, "<f8");
z2 = z1;
}
}