@@ -580,7 +580,7 @@ async def _create(
580580 """
581581 store_path = await make_store_path (store )
582582
583- dtype_parsed = parse_dtype (dtype , zarr_format )
583+ dtype_parsed = parse_dtype (dtype , zarr_format = zarr_format )
584584 shape = parse_shapelike (shape )
585585
586586 if chunks is not None and chunk_shape is not None :
@@ -693,13 +693,23 @@ def _create_metadata_v3(
693693 category = UserWarning ,
694694 stacklevel = 2 ,
695695 )
696+
697+ # resolve the numpy dtype into zarr v3 datatype
698+ zarr_data_type = get_data_type_from_numpy (dtype )
699+
700+ if fill_value is None :
701+ # v3 spec will not allow a null fill value
702+ fill_value_parsed = dtype .type (zarr_data_type .default )
703+ else :
704+ fill_value_parsed = fill_value
705+
696706 chunk_grid_parsed = RegularChunkGrid (chunk_shape = chunk_shape )
697707 return ArrayV3Metadata (
698708 shape = shape ,
699- data_type = dtype ,
709+ data_type = zarr_data_type ,
700710 chunk_grid = chunk_grid_parsed ,
701711 chunk_key_encoding = chunk_key_encoding_parsed ,
702- fill_value = fill_value ,
712+ fill_value = fill_value_parsed ,
703713 codecs = codecs ,
704714 dimension_names = tuple (dimension_names ) if dimension_names else None ,
705715 attributes = attributes or {},
@@ -3909,7 +3919,7 @@ async def init_array(
39093919
39103920 from zarr .codecs .sharding import ShardingCodec , ShardingCodecIndexLocation
39113921
3912- dtype_parsed = parse_dtype (dtype )
3922+ dtype_parsed = parse_dtype (dtype , zarr_format = zarr_format )
39133923 shape_parsed = parse_shapelike (shape )
39143924 chunk_key_encoding_parsed = _parse_chunk_key_encoding (
39153925 chunk_key_encoding , zarr_format = zarr_format
0 commit comments