Skip to content
/ xarray Public
forked from pydata/xarray

Commit

Permalink
Allow other tutorial filename extensions (pydata#3121)
Browse files Browse the repository at this point in the history
* switching out examples to use nbsphinx

* added jupyter_client to doc env

* allow non netcdf tutorial files
  • Loading branch information
rabernat authored and keewis committed Nov 21, 2019
1 parent 789a3d2 commit 751ec0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xarray/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def open_dataset(
Parameters
----------
name : str
Name of the netcdf file containing the dataset
ie. 'air_temperature'
Name of the file containing the dataset. If no suffix is given, assumed
to be netCDF ('.nc' is appended)
e.g. 'air_temperature'
cache_dir : string, optional
The directory in which to search for and write cached data.
cache : boolean, optional
Expand All @@ -60,10 +61,13 @@ def open_dataset(
xarray.open_dataset
"""
root, ext = _os.path.splitext(name)
if not ext:
ext = ".nc"
fullname = root + ext
longdir = _os.path.expanduser(cache_dir)
fullname = name + ".nc"
localfile = _os.sep.join((longdir, fullname))
md5name = name + ".md5"
md5name = fullname + ".md5"
md5file = _os.sep.join((longdir, md5name))

if not _os.path.exists(localfile):
Expand Down

0 comments on commit 751ec0f

Please sign in to comment.