@@ -30,47 +30,56 @@ WFDB Annotations
3030 :members: wrann
3131
3232
33- Cloud and Remote Access
34- -----------------------
33+ Cloud Storage Access
34+ --------------------
3535
3636WFDB-Python supports reading records and annotations directly from cloud
37- storage and remote URLs via the ``fsspec `` library. Instead of downloading
38- entire databases, you can access individual files on demand .
37+ storage via the ``fsspec `` library. Pass a cloud URI as the
38+ `` record_name `` argument instead of a local path .
3939
40- **Supported protocols ** include ``s3:// `` (Amazon S3), ``gs:// `` (Google
41- Cloud Storage), ``az:// `` (Azure Blob Storage), ``https:// ``, and any
42- other protocol supported by ``fsspec ``.
40+ **Supported protocols: ** ``s3:// `` (Amazon S3), ``gs:// `` (Google Cloud
41+ Storage), ``az:// `` (Azure Blob Storage), and ``azureml:// `` (Azure ML).
4342
44- **Installation : **
43+ **Prerequisites : ** Install the `` fsspec `` backend for your cloud provider:
4544
4645.. code-block :: bash
4746
48- pip install wfdb[cloud]
49- # or: pip install fsspec s3fs (for S3 specifically)
47+ pip install s3fs # Amazon S3
48+ pip install gcsfs # Google Cloud Storage
49+ pip install adlfs # Azure Blob Storage
50+
51+ ``fsspec `` itself is already included as a core dependency of ``wfdb ``.
5052
5153**Usage examples: **
5254
5355.. code-block :: python
5456
5557 import wfdb
5658
57- # Read a record from an HTTPS URL
58- record = wfdb.rdrecord(" 100" , pn_dir = " https://physionet.org/files/mitdb/1.0.0/" )
59-
60- # Read from Amazon S3
59+ # Read a record from Amazon S3
6160 record = wfdb.rdrecord(" s3://my-bucket/wfdb-data/100" )
6261
63- # Read annotations from a remote path
64- ann = wfdb.rdann(" 100" , " atr" , pn_dir = " https://physionet.org/files/mitdb/1.0.0/" )
62+ # Read from Google Cloud Storage
63+ record = wfdb.rdrecord(" gs://my-bucket/wfdb-data/100" )
64+
65+ # Read annotations from S3
66+ ann = wfdb.rdann(" s3://my-bucket/wfdb-data/100" , " atr" )
67+
68+ # For PhysioNet databases, use pn_dir with the database name:
69+ record = wfdb.rdrecord(" 100" , pn_dir = " mitdb" )
70+ ann = wfdb.rdann(" 100" , " atr" , pn_dir = " mitdb" )
71+
72+ **Authentication: ** Configure credentials through the standard
73+ provider-specific mechanism (e.g., ``~/.aws/credentials `` for S3,
74+ ``GOOGLE_APPLICATION_CREDENTIALS `` for GCS). The ``fsspec `` library
75+ handles credential discovery automatically.
6576
66- **Authentication: ** For cloud providers requiring credentials (S3, GCS,
67- Azure), configure authentication through the standard provider-specific
68- mechanism (e.g., ``~/.aws/credentials `` for S3, ``GOOGLE_APPLICATION_CREDENTIALS ``
69- for GCS). The ``fsspec `` library handles credential discovery automatically.
77+ .. note ::
7078
71- For PhysioNet databases that require credentialed access, you can pass
72- credentials via ``fsspec `` storage options or configure them in your
73- environment before calling ``wfdb `` functions.
79+ Cloud URIs must be passed as ``record_name ``, not ``pn_dir ``.
80+ The ``pn_dir `` parameter is reserved for PhysioNet database names
81+ (e.g., ``"mitdb" `` or ``"mimic4wdb/0.1.0" ``), which are resolved
82+ against the configured PhysioNet index URL.
7483
7584
7685Downloading
0 commit comments