Skip to content

Commit

Permalink
Add tutorial stub based on iPython Sphinx extension
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Sep 20, 2020
1 parent 19a80fe commit 9591c5b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/conf.py
Expand Up @@ -58,6 +58,10 @@ def _get_project_meta():
"sphinx_rtd_theme",
"sphinxcontrib.rsvgconverter",
"sphinx.ext.imgconverter",
#"matplotlib.sphinxext.only_directives",
"matplotlib.sphinxext.plot_directive",
"IPython.sphinxext.ipython_directive",
"IPython.sphinxext.ipython_console_highlighting",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -26,6 +26,7 @@ Usage
:maxdepth: 1

API overview <pages/api>
pages/tutorial
pages/cli
pages/library/index
pages/behind_the_scenes
Expand Down
41 changes: 41 additions & 0 deletions docs/pages/tutorial.rst
@@ -0,0 +1,41 @@
########
Tutorial
########

# wetterdienst - A simple example

.. ipython::

In [1]: x = 3

In [2]: y = x**2

In [3]: print(y)

# Import modules necessary for general functioning

In [4]: import warnings
...: warnings.filterwarnings("ignore")
...: import wetterdienst
...: #from wetterdienst import PeriodType, TimeResolution, Parameter
...: import matplotlib as mpl
...: import matplotlib.pyplot as plt
...: from matplotlib import cm

# Which parameters are available?

In [5]: print("All available combinations")
...: print(wetterdienst.discover_climate_observations())
...: print("Selection of daily historical data")
...: print(
...: discover_climate_observations(
...: time_resolution=TimeResolution.DAILY,
...: period_type=PeriodType.HISTORICAL
...: )
...: )

In [6]: metadata_hdp = wetterdienst.metadata_for_climate_observations(
...: Parameter.PRECIPITATION_MORE, TimeResolution.DAILY, PeriodType.HISTORICAL)
...: print("Number of stations with available data: ", metadata_hdp["HAS_FILE"].sum())
...: print("Some of the stations:")
...: metadata_hdp.head()
1 change: 1 addition & 0 deletions docs/requirements.txt
Expand Up @@ -5,3 +5,4 @@ importlib_metadata==1.6.1
tomlkit==0.7.0
sphinx-autodoc-typehints==1.11.0
sphinxcontrib-svg2pdfconverter==1.1.0
matplotlib==3.3.2

0 comments on commit 9591c5b

Please sign in to comment.