Skip to content

Commit c4d737d

Browse files
committed
docs: added references in each docstring to where the function is used in the tutorials. Added and fixed multiple docs references. Added changelogs in docstrings with versionchanged/versionadded directives to outline major changes. Added optional label to multiple args in docstrings
ft: re-added xlabel_rotation for comparison_plots fix: typos in docstrings build-sphinx: rewrite "make clean" directive, to effectively delete generated sphinx-gallery and sphinx-autodocs material.
1 parent 7e3ac59 commit c4d737d

14 files changed

+378
-166
lines changed

csep/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def query_gns(start_time, end_time, min_magnitude=2.950,
333333
verbose (bool): print catalog summary statistics
334334
335335
Returns:
336-
:class:`csep.core.catalogs.CSEPCatalog
336+
:class:`csep.core.catalogs.CSEPCatalog`
337337
"""
338338

339339
# Timezone should be in UTC

csep/utils/plots.py

+311-152
Large diffs are not rendered by default.

docs/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ livehtml:
1717

1818
clean:
1919
rm -rf $(BUILDDIR)/*
20-
rm -rf auto_examples/
20+
rm -rf tutorials/*
21+
rm -rf reference/generated
2122

2223
.PHONY: help Makefile
2324

docs/concepts/evaluations.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ statistics from these catalogs and compare them against one another.
9191

9292
We provide four statistics that probe fundamental aspects of the earthquake forecasts. Please see
9393
:ref:`Savran et al., 2020<savran-2020>` for a complete description of the individual tests. For the implementation
94-
details please follow the links below and see the :ref:`example<catalog-forecast-evaluation>` for catalog-based
94+
details please follow the links below and see the :ref:`Example <tutorial-catalog-forecast-evaluation>` for catalog-based
9595
forecast evaluation for an end-to-end walk through.
9696

9797
.. automodule:: csep.core.catalog_evaluations

docs/concepts/forecasts.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Working with catalog-based forecasts
129129

130130
.. autosummary:: csep.core.forecasts.CatalogForecast
131131

132-
Please see visit :ref:`this<catalog-forecast-evaluation>` example for an end-to-end tutorial on how to evaluate a catalog-based
132+
Please see visit :ref:`this Example <tutorial-catalog-forecast-evaluation>` for an end-to-end tutorial on how to evaluate a catalog-based
133133
earthquake forecast. An example of a catalog-based forecast stored in the default pyCSEP format can be found
134134
`here <https://github.com/SCECcode/pycsep/blob/dev/csep/artifacts/ExampleForecasts/CatalogForecasts/ucerf3-landers_1992-06-28T11-57-34-14.csv>`__.
135135

docs/concepts/regions.rst

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Regions
66

77
.. automodule:: csep.core.regions
88
:no-index:
9-
.. automodule:: csep.utils.basic_types
10-
:no-index:
119

1210
PyCSEP includes commonly used CSEP testing regions and classes that facilitate working with gridded data sets. This
1311
module is early in development and will be a focus of future development.

docs/getting_started/theory.rst

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ examples use the Helmstetter et al (2007) smoothed seismicity forecast
104104
Found 24 events in the ComCat catalog.
105105
106106
107+
.. _theory-consistency-tests:
108+
107109
Consistency tests
108110
~~~~~~~~~~~~~~~~~
109111

@@ -655,6 +657,8 @@ case, the model with aftershocks performs statistically worse than the
655657
benchmark model. We note that this comparison is used for demonstation
656658
purposes only.
657659

660+
.. _theory-catalog-forecasts:
661+
658662
Catalog-based forecast tests
659663
----------------------------
660664

examples/tutorials/catalog_filtering.py

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100

101101

102102
####################################################################################################################################
103+
#
104+
# .. _tutorial-catalog-filtering-plot:
105+
#
103106
# Plot catalog
104107
# -------------
105108
#

examples/tutorials/catalog_forecast_evaluation.py

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
comcat_catalog.plot(show=True)
103103

104104
####################################################################################################################################
105+
#
106+
# .. _catalog-forecast-evaluation-exploratory:
107+
#
105108
# Exploratory visualizations
106109
# --------------------------
107110
#
@@ -126,6 +129,9 @@
126129
number_test_result = catalog_evaluations.number_test(forecast, comcat_catalog)
127130

128131
####################################################################################################################################
132+
#
133+
# .. _catalog-forecast-evaluation-plot:
134+
#
129135
# Plot number test result
130136
# -----------------------
131137
#

examples/tutorials/gridded_forecast_evaluation.py

+12
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
csep.write_json(spatial_test_result, 'example_spatial_test.json')
9494

9595
####################################################################################################################################
96+
#
97+
# .. _grid-forecast-evaluation-plot:
98+
#
9699
# Plot spatial test results
97100
# -------------------------
98101
#
@@ -105,6 +108,9 @@
105108

106109

107110
####################################################################################################################################
111+
#
112+
# .. _grid-forecast-evaluation-plot-comparison:
113+
#
108114
# Performing a comparative test
109115
# -----------------------------
110116
#
@@ -126,6 +132,9 @@
126132

127133

128134
####################################################################################################################################
135+
#
136+
# .. _grid-forecast-evaluation-concentration-roc:
137+
#
129138
# Plot ROC Curves
130139
# ---------------
131140
#
@@ -149,6 +158,9 @@
149158

150159

151160
####################################################################################################################################
161+
#
162+
# .. _grid-forecast-evaluation-roc-and-molchan:
163+
#
152164
# Plot ROC and Molchan curves using the alarm-based approach
153165
# ----------------------------------------------------------
154166

examples/tutorials/plot_customizations.py

+27-7
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
"""
1919

2020
################################################################################################################
21-
# Example 1: Spatial dataset plot arguments
22-
# -----------------------------------------
21+
#
22+
# .. _tutorial-plot-customizations-ex1:
23+
#
24+
# Example 1: Customizing Gridded Dataset Plot
25+
# -------------------------------------------
2326

2427
####################################################################################################################################
2528
# **Load required libraries**
@@ -49,10 +52,10 @@
4952
# * Assign a title
5053
# * Set labels to the geographic axes
5154
# * Draw country borders
52-
# * Set a linewidth of 0.5 to country border
53-
# * Assign ``'rainbow'`` as the colormap. Possible values from ``matplotlib.cm`` library
55+
# * Set a linewidth of 1.5 to country border
56+
# * Assign ``'rainbow'`` as the colormap. Possible values from :mod:`matplotlib.cm` library
5457
# * Defines 0.8 for an exponential transparency function (default is 0 for constant alpha, whereas 1 for linear).
55-
# * An object cartopy.crs.Projection() is passed as Projection to the map
58+
# * An object :class:`cartopy.crs.Projection` (in this case :class:`cartopy.crs.Mercator`) is passed to the map
5659
#
5760
# The complete description of plot arguments can be found in :func:`csep.utils.plots.plot_gridded_dataset`
5861
#
@@ -70,6 +73,9 @@
7073
show=True)
7174

7275
####################################################################################################################################
76+
#
77+
# .. _tutorial-plot-customizations-ex2:
78+
#
7379
# Example 2: Plot a global forecast and a selected magnitude bin range
7480
# --------------------------------------------------------------------
7581
#
@@ -105,7 +111,7 @@
105111
####################################################################################################################################
106112
# **Plotting the dataset**
107113
#
108-
# To plot a global forecast, we must assign the option ``set_global=True``, which is required by :ref:`cartopy` to handle
114+
# To plot a global forecast, we must assign the option ``set_global=True``, which is required by :mod:`cartopy` to handle
109115
# internally the extent of the plot. We can further customize the plot using the required arguments from :func:`~csep.utils.plots.plot_gridded_dataset`
110116
#
111117

@@ -131,6 +137,9 @@
131137

132138

133139
####################################################################################################################################
140+
#
141+
# .. _tutorial-plot-customizations-ex3:
142+
#
134143
# Example 3: Plot a catalog with a custom basemap
135144
# -----------------------------------------------
136145

@@ -178,8 +187,15 @@
178187

179188
ax = catalog.plot(show=True, **plot_args)
180189

190+
####################################################################################################################################
191+
# Alternatively, it can be plotted using the :func:`csep.utils.plots.plot_catalog` function
192+
193+
plots.plot_catalog(catalog=catalog, show=True, **plot_args)
181194

182195
####################################################################################################################################
196+
#
197+
# .. _tutorial-plot-customizations-ex4:
198+
#
183199
# Example 4: Plot composition
184200
# -----------------------------------------------
185201
#
@@ -205,6 +221,7 @@
205221
# Plot the basemap alone by using :func:`csep.utils.plots.plot_basemap`. Do not set ``show=True`` and store the returned ``ax`` object to
206222
# start the composite plot
207223

224+
# Start the base plot
208225
ax = plots.plot_basemap(figsize=(8, 8),
209226
projection=cartopy.crs.AlbersEqualArea(central_longitude=-120.),
210227
extent=forecast.region.get_bbox(),
@@ -217,9 +234,12 @@
217234
ax = forecast.plot(colormap='PuBu_r', alpha_exp=0.5, ax=ax)
218235

219236
# Use show=True to finalize the composite.
220-
catalog.plot(markercolor='darkred', ax=ax, show=True)
237+
plots.plot_catalog(catalog=catalog, markercolor='darkred', ax=ax, show=True)
221238

222239
####################################################################################################################################
240+
#
241+
# .. _tutorial-plot-customizations-ex5:
242+
#
223243
# Example 5: Plot multiple evaluation results
224244
# -------------------------------------------
225245

examples/tutorials/plot_gridded_forecast.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
3-
.. tutorial-handling-grid-forecast:
3+
.. _tutorial-handling-grid-forecast:
44
55
Handling Grid-based Forecasts
66
=============================
@@ -42,6 +42,9 @@
4242
name='helmstetter_mainshock')
4343

4444
####################################################################################################################################
45+
#
46+
# .. _tutorial-handling-grid-forecast-plot:
47+
#
4548
# Plot forecast
4649
# -------------
4750
#

examples/tutorials/quadtree_gridded_forecast_evaluation.py

+3
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@
186186

187187

188188
####################################################################################################################################
189+
#
190+
# .. _quadtree_gridded-forecast-evaluation-plot:
191+
#
189192
# Plot spatial test results
190193
# -------------------------
191194
#

examples/tutorials/working_with_catalog_forecasts.py

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868

6969

7070
####################################################################################################################################
71+
#
72+
# .. _tutorial-working-catalog-forecasts-plot:
73+
#
7174
# Plot expected event counts
7275
# --------------------------
7376
#

0 commit comments

Comments
 (0)