Skip to content

Commit 82fd832

Browse files
zdgriffithshoyer
authored andcommitted
add to netCDF groups description (#3113)
1 parent 960a27e commit 82fd832

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

doc/io.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,18 @@ convert the ``DataArray`` to a ``Dataset`` before saving, and then convert back
147147
when loading, ensuring that the ``DataArray`` that is loaded is always exactly
148148
the same as the one that was saved.
149149

150-
A dataset can also be loaded or written to a specific group within a netCDF
151-
file. To load from a group, pass a ``group`` keyword argument to the
150+
NetCDF groups are not supported as part of the
151+
:py:class:`~xarray.Dataset` data model. Instead, groups can be loaded
152+
individually as Dataset objects.
153+
To do so, pass a ``group`` keyword argument to the
152154
``open_dataset`` function. The group can be specified as a path-like
153155
string, e.g., to access subgroup 'bar' within group 'foo' pass
154-
'/foo/bar' as the ``group`` argument. When writing multiple groups in one file,
155-
pass ``mode='a'`` to ``to_netcdf`` to ensure that each call does not delete the
156-
file.
156+
'/foo/bar' as the ``group`` argument.
157+
In a similar way, the ``group`` keyword argument can be given to the
158+
:py:meth:`~xarray.Dataset.to_netcdf` method to write to a group
159+
in a netCDF file.
160+
When writing multiple groups in one file, pass ``mode='a'`` to ``to_netcdf``
161+
to ensure that each call does not delete the file.
157162

158163
Data is always loaded lazily from netCDF files. You can manipulate, slice and subset
159164
Dataset and DataArray objects, and no array values are loaded into memory until

0 commit comments

Comments
 (0)