Skip to content

Commit 16f9e12

Browse files
committed
Document glob pattern support in open_datatree and open_groups
Update docstrings for the group kwarg in open_datatree and open_groups to describe glob metacharacter behavior.
1 parent 7a3e3bc commit 16f9e12

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

xarray/backends/api.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,12 @@ def open_datatree(
10211021
Additional keyword arguments passed on to the engine open function.
10221022
For example:
10231023
1024-
- 'group': path to the group in the given file to open as the root group as
1025-
a str.
1024+
- 'group': path to the group in the given file to open as the root
1025+
group as a str. If the string contains glob metacharacters
1026+
(``*``, ``?``, ``[``), it is interpreted as a pattern and only
1027+
groups whose paths match are loaded (along with their ancestors).
1028+
For example, ``group="*/sweep_0"`` loads every ``sweep_0`` one
1029+
level deep while skipping sibling groups.
10261030
- 'lock': resource lock to use when reading data from disk. Only
10271031
relevant when using dask or another form of parallelism. By default,
10281032
appropriate locks are chosen to safely read and write files with the
@@ -1265,8 +1269,12 @@ def open_groups(
12651269
Additional keyword arguments passed on to the engine open function.
12661270
For example:
12671271
1268-
- 'group': path to the group in the given file to open as the root group as
1269-
a str.
1272+
- 'group': path to the group in the given file to open as the root
1273+
group as a str. If the string contains glob metacharacters
1274+
(``*``, ``?``, ``[``), it is interpreted as a pattern and only
1275+
groups whose paths match are loaded (along with their ancestors).
1276+
For example, ``group="*/sweep_0"`` loads every ``sweep_0`` one
1277+
level deep while skipping sibling groups.
12701278
- 'lock': resource lock to use when reading data from disk. Only
12711279
relevant when using dask or another form of parallelism. By default,
12721280
appropriate locks are chosen to safely read and write files with the

0 commit comments

Comments
 (0)