Skip to content

Commit

Permalink
Fix io.rst.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed May 29, 2019
1 parent 37c9223 commit 047063b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions doc/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ We can save a Dataset to disk using the

.. ipython:: python
ds = xr.Dataset({'foo': (('x', 'y'), np.random.rand(4, 5))},
coords={'x': [10, 20, 30, 40],
'y': pd.date_range('2000-01-01', periods=5),
'z': ('x', list('abcd'))})
ds.to_netcdf('saved_on_disk.nc')
By default, the file is saved as netCDF4 (assuming netCDF4-Python is
Expand All @@ -59,7 +64,7 @@ the ``format`` and ``engine`` arguments.

Using the `h5netcdf <https://github.com/shoyer/h5netcdf>`_ package
by passing ``engine='h5netcdf'`` to :py:meth:`~xarray.open_dataset` can
be quicker than the default ``engine='netcdf4'`` that uses the
sometimes be quicker than the default ``engine='netcdf4'`` that uses the
`netCDF4 <https://github.com/Unidata/netcdf4-python>`_ package.


Expand Down Expand Up @@ -171,8 +176,6 @@ will remove encoding information.
:suppress:
ds_disk.close()
import os
os.remove('saved_on_disk.nc')
.. _io.netcdf.writing_encoded:

Expand Down Expand Up @@ -459,11 +462,6 @@ module:
import pickle
ds = xr.Dataset({'foo': (('x', 'y'), np.random.rand(4, 5))},
coords={'x': [10, 20, 30, 40],
'y': pd.date_range('2000-01-01', periods=5),
'z': ('x', list('abcd'))})
# use the highest protocol (-1) because it is way faster than the default
# text based pickle format
pkl = pickle.dumps(ds, protocol=-1)
Expand Down Expand Up @@ -523,6 +521,12 @@ To export just the dataset schema, without the data itself, use the
This can be useful for generating indices of dataset contents to expose to
search indices or other automated data discovery tools.

.. ipython:: python
:suppress:
import os
os.remove('saved_on_disk.nc')
.. _io.rasterio:

Rasterio
Expand Down

0 comments on commit 047063b

Please sign in to comment.