Skip to content

Commit bf91332

Browse files
committed
Add documentation gallery
1 parent b640cc1 commit bf91332

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

doc/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@
3333
'sphinx.ext.doctest',
3434
'sphinx.ext.intersphinx',
3535
'sphinx.ext.viewcode',
36+
'sphinx_gallery.gen_gallery',
3637
]
3738

39+
sphinx_gallery_conf = {
40+
'examples_dirs': '../examples', # path to your example scripts
41+
'gallery_dirs': 'python_module',
42+
'capture_repr': ('_repr_html_', '__repr__'),
43+
'line_numbers': False,
44+
'filename_pattern': '/pet',
45+
}
46+
3847
# Add any paths that contain templates here, relative to this directory.
3948
templates_path = ['.templates']
4049

doc/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Welcome to py-eddy-tracker's documentation!
1313

1414
installation
1515

16+
.. toctree::
17+
:maxdepth: 2
18+
:caption: Contents:
19+
20+
python_module/index
1621

1722
.. toctree::
1823
:maxdepth: 2

examples/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Py eddy tracker toolbox
2+
=======================

examples/pet_histo_amplitude.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
Amplitude Histogram
3+
===================
4+
5+
"""
6+
from matplotlib import pyplot as plt
7+
from py_eddy_tracker.observations.tracking import TrackEddiesObservations
8+
import py_eddy_tracker_sample
9+
from numpy import arange
10+
11+
a = TrackEddiesObservations.load_file(py_eddy_tracker_sample.get_path("eddies_med_adt_allsat_dt2018/Anticyclonic.zarr"))
12+
c = TrackEddiesObservations.load_file(py_eddy_tracker_sample.get_path("eddies_med_adt_allsat_dt2018/Cyclonic.zarr"))
13+
# Plot
14+
fig = plt.figure()
15+
ax = fig.add_subplot(111)
16+
ax.hist(a['amplitude'], histtype='step', bins=arange(0.0005,1,0.002), label='Anticyclonic')
17+
ax.hist(c['amplitude'], histtype='step', bins=arange(0.0005,1,0.002), label='Cyclonic')
18+
ax.set_xlabel('Amplitude (m)')
19+
ax.set_xlim(0,.5)
20+
ax.legend()
21+
ax.grid()
22+
23+
fig = plt.figure()
24+
ax = fig.add_subplot(111)
25+
bins = arange(0,150,1)
26+
ax.hist(a['radius_s'] / 1000., histtype='step', bins=bins, label='Anticyclonic')
27+
ax.hist(c['radius_s'] / 1000., histtype='step', bins=bins, label='Cyclonic')
28+
ax.set_xlabel('Speed_radius (km)')
29+
ax.set_xlim(0,150)
30+
ax.legend()
31+
ax.grid()

0 commit comments

Comments
 (0)