@@ -207,7 +207,7 @@ async def consolidate_metadata(
207207 consolidated metadata, this function raises a `TypeError`.
208208 See ``Store.supports_consolidated_metadata``.
209209 """
210- store_path = await make_store_path (store , path = path )
210+ store_path , _ = await make_store_path (store , path = path )
211211
212212 if not store_path .store .supports_consolidated_metadata :
213213 store_name = type (store_path .store ).__name__
@@ -346,7 +346,13 @@ async def open(
346346 mode = "r"
347347 else :
348348 mode = "a"
349- store_path = await make_store_path (store , mode = mode , path = path , storage_options = storage_options )
349+ store_path , url_format = await make_store_path (
350+ store , mode = mode , path = path , storage_options = storage_options
351+ )
352+
353+ # Use URL format if user didn't specify
354+ if zarr_format is None :
355+ zarr_format = url_format
350356
351357 # TODO: the mode check below seems wrong!
352358 if "shape" not in kwargs and mode in {"a" , "r" , "r+" , "w" }:
@@ -450,15 +456,20 @@ async def save_array(
450456 **kwargs
451457 Passed through to :func:`create`, e.g., compressor.
452458 """
453- zarr_format = (
454- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
455- or _default_zarr_format ()
456- )
459+ zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
460+
457461 if not isinstance (arr , NDArrayLike ):
458462 raise TypeError ("arr argument must be numpy or other NDArrayLike array" )
459463
460464 mode = kwargs .pop ("mode" , "a" )
461- store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
465+ store_path , url_format = await make_store_path (
466+ store , path = path , mode = mode , storage_options = storage_options
467+ )
468+
469+ # Use URL format if user didn't specify, otherwise fall back to default
470+ if zarr_format is None :
471+ zarr_format = url_format or _default_zarr_format ()
472+
462473 if np .isscalar (arr ):
463474 arr = np .array (arr )
464475 shape = arr .shape
@@ -506,7 +517,9 @@ async def save_group(
506517 NumPy arrays with data to save.
507518 """
508519
509- store_path = await make_store_path (store , path = path , mode = "w" , storage_options = storage_options )
520+ store_path , _ = await make_store_path (
521+ store , path = path , mode = "w" , storage_options = storage_options
522+ )
510523
511524 zarr_format = (
512525 _handle_zarr_version_or_format (
@@ -725,12 +738,15 @@ async def create_group(
725738 The new group.
726739 """
727740
728- if zarr_format is None :
729- zarr_format = _default_zarr_format ()
730-
731741 mode : Literal ["a" ] = "a"
732742
733- store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
743+ store_path , url_format = await make_store_path (
744+ store , path = path , mode = mode , storage_options = storage_options
745+ )
746+
747+ # Use URL format if user didn't specify, otherwise fall back to default
748+ if zarr_format is None :
749+ zarr_format = url_format or _default_zarr_format ()
734750
735751 return await AsyncGroup .from_store (
736752 store = store_path ,
@@ -828,7 +844,14 @@ async def open_group(
828844 if chunk_store is not None :
829845 warnings .warn ("chunk_store is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
830846
831- store_path = await make_store_path (store , mode = mode , storage_options = storage_options , path = path )
847+ store_path , url_format = await make_store_path (
848+ store , mode = mode , storage_options = storage_options , path = path
849+ )
850+
851+ # Use URL format if user didn't specify
852+ if zarr_format is None :
853+ zarr_format = url_format
854+
832855 if attributes is None :
833856 attributes = {}
834857
@@ -999,10 +1022,7 @@ async def create(
9991022 z : array
10001023 The array.
10011024 """
1002- zarr_format = (
1003- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1004- or _default_zarr_format ()
1005- )
1025+ zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
10061026
10071027 if synchronizer is not None :
10081028 warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
@@ -1025,7 +1045,13 @@ async def create(
10251045 mode = kwargs .pop ("mode" , None )
10261046 if mode is None :
10271047 mode = "a"
1028- store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
1048+ store_path , url_format = await make_store_path (
1049+ store , path = path , mode = mode , storage_options = storage_options
1050+ )
1051+
1052+ # Use URL format if user didn't specify, otherwise fall back to default
1053+ if zarr_format is None :
1054+ zarr_format = url_format or _default_zarr_format ()
10291055
10301056 config_parsed = parse_array_config (config )
10311057
@@ -1236,10 +1262,16 @@ async def open_array(
12361262 """
12371263
12381264 mode = kwargs .pop ("mode" , None )
1239- store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
1265+ store_path , url_format = await make_store_path (
1266+ store , path = path , mode = mode , storage_options = storage_options
1267+ )
12401268
12411269 zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
12421270
1271+ # Use URL format if user didn't specify
1272+ if zarr_format is None :
1273+ zarr_format = url_format
1274+
12431275 if "write_empty_chunks" in kwargs :
12441276 _warn_write_empty_chunks_kwarg ()
12451277
0 commit comments