Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/mdio/api/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def open_mdio(input_path: UPath | Path | str, chunks: T_Chunks = None) -> xr_Dat
"""
input_path = _normalize_path(input_path)
storage_options = _normalize_storage_options(input_path)
return xr_open_zarr(input_path.path, chunks=chunks, storage_options=storage_options)
return xr_open_zarr(input_path.as_posix(), chunks=chunks, storage_options=storage_options)


def to_mdio( # noqa: PLR0913
Expand Down Expand Up @@ -80,7 +80,7 @@ def to_mdio( # noqa: PLR0913
storage_options = _normalize_storage_options(output_path)
xr_to_zarr(
dataset,
store=output_path.path,
store=output_path.as_posix(), # xarray doesn't like URI when file:// is protocol
mode=mode,
compute=compute,
consolidated=False,
Expand Down
5 changes: 2 additions & 3 deletions src/mdio/converters/segy.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,11 @@ def segy_to_mdio( # noqa PLR0913
output_path = _normalize_path(output_path)

if not overwrite and output_path.exists():
err = f"Output location '{output_path.path}' exists. Set `overwrite=True` if intended."
err = f"Output location '{output_path.as_posix()}' exists. Set `overwrite=True` if intended."
raise FileExistsError(err)

# Use `as_uri()` here since SegyFile doesn't support UPath yet.
segy_settings = SegySettings(storage_options=input_path.storage_options)
segy_file = SegyFile(url=input_path.as_uri(), spec=segy_spec, settings=segy_settings)
segy_file = SegyFile(url=input_path.as_posix(), spec=segy_spec, settings=segy_settings)

segy_dimensions, segy_headers = _scan_for_headers(segy_file, mdio_template, grid_overrides)

Expand Down
2 changes: 1 addition & 1 deletion src/mdio/segy/blocked_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def to_zarr( # noqa: PLR0913, PLR0915
# HACK: We will update the array attribute using zarr's API directly.
# Use the data_variable_name to get the array in the Zarr group and write "statistics" metadata there
storage_options = _normalize_storage_options(output_path)
zarr_group = zarr_open_group(output_path.path, mode="a", storage_options=storage_options)
zarr_group = zarr_open_group(output_path.as_posix(), mode="a", storage_options=storage_options)
attr_json = final_stats.model_dump_json()
zarr_group[data_variable_name].attrs.update({"statsV1": attr_json})

Expand Down
Loading