Skip to content

Commit ca8e19b

Browse files
Copilotbnlawrence
andcommitted
Add filesystem parameter to cf.read as pass-through to cfdm.read
Co-authored-by: bnlawrence <1792815+bnlawrence@users.noreply.github.com>
1 parent 94b482f commit ca8e19b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

cf/docstring/docstring.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,4 +686,19 @@
686686
The subspace is the smallest hyperrectangular
687687
subspace that contains all of the selected
688688
locations.""",
689+
# read filesystem
690+
"{{read filesystem: optional}}": """filesystem: optional
691+
A pre-authenticated filesystem object (for example an
692+
``fsspec`` filesystem instance) to use for opening the
693+
dataset. When provided, *datasets* values are treated as
694+
paths understood by *filesystem*, and local string
695+
pre-processing (tilde/variable expansion, globbing and
696+
directory walking) is bypassed. The file is opened by
697+
calling ``filesystem.open(dataset, "rb")``, which returns
698+
a file-like object that is passed to the netCDF backend.
699+
700+
If `None` (the default) then the existing file-opening
701+
logic is used.
702+
703+
.. versionadded:: NEXTVERSION""",
689704
}

cf/read_write/read.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ class read(cfdm.read):
336336
337337
.. versionadded:: 3.19.0
338338
339+
{{read filesystem: optional}}
340+
341+
.. versionadded:: NEXTVERSION
342+
339343
umversion: deprecated at version 3.0.0
340344
Use the *um* parameter instead.
341345
@@ -455,6 +459,7 @@ def __new__(
455459
fmt=None,
456460
file_type=None,
457461
group_dimension_search="closest_ancestor",
462+
filesystem=None,
458463
):
459464
"""Read field or domain constructs from a dataset."""
460465
kwargs = locals()

0 commit comments

Comments
 (0)