Skip to content

Commit

Permalink
Merge pull request #52 from sanath-2024/main
Browse files Browse the repository at this point in the history
Use dimension separator in arrays instead of `FSStore`
  • Loading branch information
tasansal authored Sep 6, 2022
2 parents 6f0372c + bde1944 commit f580e2d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
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__/
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

0 comments on commit f580e2d

Please sign in to comment.