From c2b10b09201795ac4a79b5658b7f4b6daf55a161 Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Mon, 7 Jul 2025 18:19:47 +0200 Subject: [PATCH 1/6] Add doc about custom remote storage --- docs/user-guide/storage.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/user-guide/storage.rst b/docs/user-guide/storage.rst index 4215cbaf20..ed1718af03 100644 --- a/docs/user-guide/storage.rst +++ b/docs/user-guide/storage.rst @@ -87,6 +87,14 @@ API. ``storage_options`` can be used to configure the fsspec backend.: >>> zarr.open_group(store=store, mode='r') > +The type of filesystem (e.g. S3, https, etc..) is inferred from the scheme of the url (e.g. s3 for "**s3**://noaa-nwm-retro-v2-zarr-pds"). +In case a specific filesystem is needed, one can explicitly create it. For example to create a S3 filesystem: + >>> fs = fsspec.filesystem( + ... 's3', anon=True, asynchronous=True, + ... client_kwargs={'endpoint_url': "https://s3.example-site.org"} + ... ) + >>> store = zarr.storage.FsspecStore(fs) + Memory Store ~~~~~~~~~~~~ From 5c0ac494c860df8cde97ef13a7cdd94e13a6a07f Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Mon, 7 Jul 2025 18:26:01 +0200 Subject: [PATCH 2/6] Add doc about store type to `FsspecStore.from_url` --- src/zarr/storage/_fsspec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zarr/storage/_fsspec.py b/src/zarr/storage/_fsspec.py index a1b05a7630..e169eededc 100644 --- a/src/zarr/storage/_fsspec.py +++ b/src/zarr/storage/_fsspec.py @@ -216,7 +216,7 @@ def from_url( allowed_exceptions: tuple[type[Exception], ...] = ALLOWED_EXCEPTIONS, ) -> FsspecStore: """ - Create a FsspecStore from a URL. + Create a FsspecStore from a URL. The type of store is determined from the URL scheme. Parameters ---------- From d08c192b1a5eef67c1c2c3d75dd1d32bcd0f856b Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Tue, 8 Jul 2025 09:54:44 +0200 Subject: [PATCH 3/6] Add changes --- changes/3212.doc.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/3212.doc.rst diff --git a/changes/3212.doc.rst b/changes/3212.doc.rst new file mode 100644 index 0000000000..34e9ac4b13 --- /dev/null +++ b/changes/3212.doc.rst @@ -0,0 +1,4 @@ +- Add a description on how to create a RemoteStore of a specific filesystem to the `Remore Store` section in `docs\user-guide\storage.rst`. +- State in the docstring of `FsspecStore.from_url` that the filesystem type is inferred from the URL scheme. + +It should help a user handling the case when the type of FsspecStore doesn't match the URL scheme. \ No newline at end of file From 9e9bc06440accbb5391764c606ba45ef42544b7c Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Tue, 8 Jul 2025 09:55:42 +0200 Subject: [PATCH 4/6] Fix example code --- docs/user-guide/storage.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/storage.rst b/docs/user-guide/storage.rst index ed1718af03..191dec8172 100644 --- a/docs/user-guide/storage.rst +++ b/docs/user-guide/storage.rst @@ -89,9 +89,11 @@ API. ``storage_options`` can be used to configure the fsspec backend.: The type of filesystem (e.g. S3, https, etc..) is inferred from the scheme of the url (e.g. s3 for "**s3**://noaa-nwm-retro-v2-zarr-pds"). In case a specific filesystem is needed, one can explicitly create it. For example to create a S3 filesystem: + + >>> import fsspec >>> fs = fsspec.filesystem( ... 's3', anon=True, asynchronous=True, - ... client_kwargs={'endpoint_url': "https://s3.example-site.org"} + ... client_kwargs={'endpoint_url': "https://noaa-nwm-retro-v2-zarr-pds.s3.amazonaws.com"} ... ) >>> store = zarr.storage.FsspecStore(fs) From e31f3328fb181c102490cc455545d323d36397e1 Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Tue, 8 Jul 2025 10:17:16 +0200 Subject: [PATCH 5/6] Run pre-commit --- docs/user-guide/storage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/storage.rst b/docs/user-guide/storage.rst index 191dec8172..e5a333872e 100644 --- a/docs/user-guide/storage.rst +++ b/docs/user-guide/storage.rst @@ -89,7 +89,7 @@ API. ``storage_options`` can be used to configure the fsspec backend.: The type of filesystem (e.g. S3, https, etc..) is inferred from the scheme of the url (e.g. s3 for "**s3**://noaa-nwm-retro-v2-zarr-pds"). In case a specific filesystem is needed, one can explicitly create it. For example to create a S3 filesystem: - + >>> import fsspec >>> fs = fsspec.filesystem( ... 's3', anon=True, asynchronous=True, From ca49e27b67e144f2cbccc46b5eb45b4340eec3fe Mon Sep 17 00:00:00 2001 From: Carlo Bevilacqua Date: Tue, 8 Jul 2025 10:29:56 +0200 Subject: [PATCH 6/6] Fix typo --- changes/3212.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3212.doc.rst b/changes/3212.doc.rst index 34e9ac4b13..1754d18c92 100644 --- a/changes/3212.doc.rst +++ b/changes/3212.doc.rst @@ -1,4 +1,4 @@ -- Add a description on how to create a RemoteStore of a specific filesystem to the `Remore Store` section in `docs\user-guide\storage.rst`. +- Add a description on how to create a RemoteStore of a specific filesystem to the `Remote Store` section in `docs\user-guide\storage.rst`. - State in the docstring of `FsspecStore.from_url` that the filesystem type is inferred from the URL scheme. It should help a user handling the case when the type of FsspecStore doesn't match the URL scheme. \ No newline at end of file