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

Use dimension separator in arrays instead of FSStore #52

Merged
merged 3 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/dist/
/docs/_build/
/src/*.egg-info/
*__pycache__/
srib marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion src/mdio/api/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def process_url(
check=check,
create=check,
mode=mode,
dimension_separator="/",
**storage_options,
)

Expand Down
1 change: 1 addition & 0 deletions src/mdio/converters/segy.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def segy_to_mdio(
name="live_mask",
shape=grid.shape[:-1],
chunks=-1,
dimension_separator="/",
)

write_attribute(
Expand Down
2 changes: 2 additions & 0 deletions src/mdio/segy/blocked_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def to_zarr(
shape=grid.shape,
compressor=trace_compressor,
chunks=chunks,
dimension_separator="/",
**kwargs,
)

Expand Down Expand Up @@ -116,6 +117,7 @@ def to_zarr(
chunks=chunks[:-1], # Same spatial chunks as data
compressor=header_compressor,
dtype=header_dtype,
dimension_separator="/",
)

# Initialize chunk iterator (returns next chunk slice indices each iteration)
Expand Down
10 changes: 8 additions & 2 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def mock_store(tmp_path_factory):
"""Make a mocked MDIO store for writing."""
tmp_dir = tmp_path_factory.mktemp("mdio")
return FSStore(tmp_dir.name, dimension_separator="/")
return FSStore(tmp_dir.name)


@pytest.fixture
Expand Down Expand Up @@ -106,6 +106,7 @@ def mock_mdio(
name="live_mask",
shape=grid.shape[:-1],
chunks=-1,
dimension_separator="/",
)

write_attribute(name="created", zarr_group=zarr_root, attribute=str(datetime.now()))
Expand All @@ -124,13 +125,18 @@ def mock_mdio(
for key, value in stats.items():
write_attribute(name=key, zarr_group=zarr_root, attribute=value)

data_arr = data_grp.create_dataset("chunked_012", data=mock_data)
data_arr = data_grp.create_dataset(
"chunked_012",
data=mock_data,
dimension_separator="/",
)

metadata_grp.create_dataset(
data=il_grid * xl_grid,
name="_".join(["chunked_012", "trace_headers"]),
shape=grid.shape[:-1], # Same spatial shape as data
chunks=data_arr.chunks[:-1], # Same spatial chunks as data
dimension_separator="/",
)

consolidate_metadata(mock_store)
Expand Down