Skip to content

Commit

Permalink
try a different gallery building approach
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Nov 21, 2024
1 parent 447617b commit 94d0a34
Show file tree
Hide file tree
Showing 25 changed files with 89 additions and 146 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ instance/
docs/_build/
docs/apidoc/modules.rst
docs/apidoc/figanos*.rst
docs/notebook/images/*.png

# PyBuilder
target/
Expand Down
Binary file removed docs/_static/_images/basic_map.png
Binary file not shown.
Binary file removed docs/_static/_images/basic_timeseries.png
Binary file not shown.
Binary file removed docs/_static/_images/ensemble_timeseries.png
Binary file not shown.
Binary file removed docs/_static/_images/gdf2_map.png
Binary file not shown.
Binary file removed docs/_static/_images/gdf_map.png
Binary file not shown.
Binary file removed docs/_static/_images/hatch_map.png
Binary file not shown.
Binary file removed docs/_static/_images/heatmap.png
Binary file not shown.
Binary file removed docs/_static/_images/logo.png
Binary file not shown.
Binary file removed docs/_static/_images/multiple.png
Binary file not shown.
Binary file removed docs/_static/_images/partition.png
Binary file not shown.
Binary file removed docs/_static/_images/station+grid_map.png
Binary file not shown.
Binary file removed docs/_static/_images/station_map.png
Binary file not shown.
Binary file removed docs/_static/_images/stripes.png
Binary file not shown.
Binary file removed docs/_static/_images/taylor.png
Binary file not shown.
Binary file removed docs/_static/_images/triangle1.png
Binary file not shown.
Binary file removed docs/_static/_images/triangle2.png
Binary file not shown.
Binary file removed docs/_static/_images/violin.png
Binary file not shown.
109 changes: 52 additions & 57 deletions docs/gallery.rst
Original file line number Diff line number Diff line change
@@ -1,95 +1,90 @@
Gallery
========

Here is a gallery of examples of figanos.
Here is a gallery of examples of `figanos`.
Go to the examples to see how to generate these figures.


Timeseries
^^^^^^^^^^^
Full code in the `Timeseries notebook <notebooks/figanos_timeseries.ipynb>`_.

.. image:: _static/_images/basic_timeseries.png
:width: 30%
:target: notebooks/figanos_timeseries.html#Basic-timeseries

.. image:: _static/_images/ensemble_timeseries.png
:width: 30%
:target: notebooks/figanos_timeseries.html#Ensembles

.. image:: ./notebooks/images/basic_timeseries.png
:width: 30%
:target: ./notebooks/figanos_timeseries.html#Basic-timeseries

.. image:: notebooks/images/ensemble_timeseries.png
:width: 30%
:target: notebooks/figanos_timeseries.html#Ensembles

Maps
^^^^
Full code in the `Maps notebook <notebooks/figanos_maps.ipynb>`_.

.. image:: _static/_images/basic_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Gridded-Data-on-Maps
.. image:: notebooks/images/basic_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Gridded-Data-on-Maps

.. image:: _static/_images/station_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Station-Data-on-Maps
.. image:: notebooks/images/station_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Station-Data-on-Maps

.. image:: _static/_images/station+grid_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Station-Data-on-Maps
.. image:: notebooks/images/station+grid_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Station-Data-on-Maps

.. image:: _static/_images/hatch_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Hatching-on-Maps
.. image:: notebooks/images/hatch_map.png
:width: 30%
:target: notebooks/figanos_maps.html#Hatching-on-Maps

.. image:: _static/_images/gdf_map.png
:width: 30%
:target: notebooks/figanos_maps.html#GeoDataFrame-on-Maps

.. image:: _static/_images/gdf2_map.png
:width: 30%
:target: notebooks/figanos_maps.html#GeoDataFrame-on-Maps
.. image:: notebooks/images/gdf_map.png
:width: 30%
:target: notebooks/figanos_maps.html#GeoDataFrame-on-Maps

.. image:: notebooks/images/gdf2_map.png
:width: 30%
:target: notebooks/figanos_maps.html#GeoDataFrame-on-Maps

Miscellaneous
^^^^^^^^^^^^^
Full code in the `Miscellaneous notebook <notebooks/figanos_misc.ipynb>`_.

.. image:: _static/_images/stripes.png
:width: 30%
:target: notebooks/figanos_misc.html#Climate-Stripes

.. image:: _static/_images/violin.png
:width: 30%
:target: notebooks/figanos_misc.html#Violin-Plots
.. image:: notebooks/images/stripes.png
:width: 30%
:target: notebooks/figanos_misc.html#Climate-Stripes

.. image:: _static/_images/heatmap.png
:width: 30%
:target: notebooks/figanos_misc.html#Heatmaps
.. image:: notebooks/images/violin.png
:width: 30%
:target: notebooks/figanos_misc.html#Violin-Plots

.. image:: _static/_images/triangle1.png
:width: 30%
:target: notebooks/figanos_misc.html#Triangle-heatmaps
.. image:: notebooks/images/heatmap.png
:width: 30%
:target: notebooks/figanos_misc.html#Heatmaps

.. image:: _static/_images/triangle2.png
:width: 30%
:target: notebooks/figanos_misc.html#Triangle-Heatmaps
.. image:: notebooks/images/triangle1.png
:width: 30%
:target: notebooks/figanos_misc.html#Triangle-heatmaps

.. image:: _static/_images/taylor.png
:width: 30%
:target: notebooks/figanos_misc.html#Taylor-Diagrams
.. image:: notebooks/images/triangle2.png
:width: 30%
:target: notebooks/figanos_misc.html#Triangle-Heatmaps

.. image:: _static/_images/partition.png
:width: 30%
:target: notebooks/figanos_misc.html#Partition-plots
.. image:: notebooks/images/taylor.png
:width: 30%
:target: notebooks/figanos_misc.html#Taylor-Diagrams

.. image:: _static/_images/logo.png
:width: 30%
:target: notebooks/figanos_misc.html#Logos
.. image:: notebooks/images/partition.png
:width: 30%
:target: notebooks/figanos_misc.html#Partition-plots

.. image:: notebooks/images/logo.png
:width: 30%
:target: notebooks/figanos_misc.html#Logos

Multiple plots
^^^^^^^^^^^^^^

Full code in the `Multiple plots notebook <notebooks/figanos_multiplots.ipynb>`_.

.. image:: _static/_images/multiple.png
:width: 30%
:target: notebooks/figanos_multiplots.html#Maps
.. image:: notebooks/images/multiple.png
:width: 30%
:target: notebooks/figanos_multiplots.html#Maps
60 changes: 11 additions & 49 deletions docs/notebooks/figanos_maps.ipynb

Large diffs are not rendered by default.

24 changes: 10 additions & 14 deletions docs/notebooks/figanos_misc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {
"nbsphinx": "hidden"
},
"metadata": {},
"outputs": [],
"source": [
"#setup notebook\n",
Expand Down Expand Up @@ -86,7 +84,7 @@
"# Plot\n",
"fg.stripes({'rcp45': rcp45_deltas, 'rcp85': rcp85_deltas}, divide=2006)\n",
"\n",
"plt.savefig(\"../_static/_images/stripes.png\", bbox_inches='tight')"
"plt.savefig(\"images/stripes.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -137,7 +135,7 @@
"source": [
"fg.violin(ds_time, use_attrs={'title':'description'})\n",
"\n",
"plt.savefig(\"../_static/_images/violin.png\", bbox_inches='tight')"
"plt.savefig(\"images/violin.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -218,7 +216,7 @@
"ax.set_xlabel(\"\")\n",
"ax.set_ylabel(\"\")\n",
"\n",
"plt.savefig(\"../_static/_images/heatmap.png\", bbox_inches='tight')"
"plt.savefig(\"images/heatmap.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -257,7 +255,7 @@
" plot_kw={'vmin':-1, 'vmax':1} # we are only showing the 1st cbar, so make sure the cbar of each triangle is the same\n",
" )\n",
"\n",
"plt.savefig(\"../_static/_images/triangle1.png\", bbox_inches='tight')"
"plt.savefig(\"images/triangle1.png\", bbox_inches='tight')"
]
},
{
Expand All @@ -284,7 +282,7 @@
" plot_kw=[{'cmap':'winter'},{'cmap':'summer'}]) # Use a list to change each triangle type (upper or lower)\n",
"\n",
"\n",
"plt.savefig(\"../_static/_images/triangle2.png\", bbox_inches='tight')"
"plt.savefig(\"images/triangle2.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -325,7 +323,7 @@
"fg.taylordiagram(simd, std_range=(0, 1.3), contours=5, contours_kw={'colors': 'green'}, plot_kw={'reference': {'marker':'*'}})\n",
"\n",
"\n",
"plt.savefig(\"../_static/_images/taylor.png\", bbox_inches='tight')"
"plt.savefig(\"images/taylor.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -488,8 +486,7 @@
" uncertainty.attrs[\"units\"] = \"%\"\n",
" return uncertainty\n",
"\n",
"frac= fractional_uncertainty(uncertainties)\n",
"\n"
"frac= fractional_uncertainty(uncertainties)"
]
},
{
Expand All @@ -511,8 +508,7 @@
" line_kw={'lw':2}\n",
")\n",
"\n",
"\n",
"plt.savefig(\"../_static/_images/partition.png\", bbox_inches='tight')"
"plt.savefig(\"images/partition.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -588,7 +584,7 @@
" alpha=0.8,\n",
")\n",
"\n",
"#plt.savefig(\"../_static/_images/logo.png\", bbox_inches='tight')"
"plt.savefig(\"images/logo.png\", bbox_inches='tight')"
]
}
],
Expand Down
26 changes: 8 additions & 18 deletions docs/notebooks/figanos_multiplots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
" fig_kw={'figsize':(10,4)},\n",
" legend=\"edge\",\n",
" show_lat_lon=True,\n",
" )\n",
"\n"
" )"
]
},
{
Expand All @@ -86,8 +85,8 @@
" show_lat_lon=False,\n",
" fig_kw = {'figsize':(9,4)},\n",
" plot_kw={'tasmax_ssp434': {\"col\": \"lat\"}, 'tasmax_ssp245': {\"col\": \"lat\"}, \"tasmax_ssp585\": {\"col\": \"lat\"}},\n",
" enumerate_subplots=True \n",
" )\n"
" enumerate_subplots=True\n",
" )"
]
},
{
Expand Down Expand Up @@ -119,7 +118,7 @@
" enumerate_subplots=True\n",
" )\n",
"\n",
"#plt.savefig(\"../_static/_images/multiple.png\", bbox_inches='tight')"
"plt.savefig(\"images/multiple.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -199,10 +198,10 @@
" features = ['coastline','ocean'],\n",
" frame = True,\n",
" legend_kw = {'title': 'Ensemble change'},\n",
" enumerate_subplots=True, \n",
" enumerate_subplots=True,\n",
" )\n",
"\n",
"im.fig.suptitle(\"Multiple hatchmaps\", y=1.08)\n"
"im.fig.suptitle(\"Multiple hatchmaps\", y=1.08)"
]
},
{
Expand Down Expand Up @@ -302,7 +301,7 @@
" 'add_colorbar': False},\n",
" show_time=False,\n",
" )\n",
"im.fig.suptitle('Scattermaps over gridmaps', x=0.45, y=0.95)\n"
"im.fig.suptitle('Scattermaps over gridmaps', x=0.45, y=0.95)"
]
},
{
Expand Down Expand Up @@ -381,17 +380,8 @@
" if len(txt.get_text()) > 0:\n",
" txt.set_x(-1.2)\n",
" txt.set_text('percentile ' + txt.get_text())\n",
" txt.set_rotation('vertical')\n",
" # txt.set_visible(False)\n",
"\n"
" txt.set_rotation('vertical')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
12 changes: 5 additions & 7 deletions docs/notebooks/figanos_timeseries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {
"nbsphinx": "hidden"
},
"metadata": {},
"outputs": [],
"source": [
"#setup notebook\n",
Expand Down Expand Up @@ -97,7 +95,7 @@
"metadata": {},
"source": [
"## Basic timeseries\n",
"The [**timeseries()**](#timeseries) function accepts DataArrays or Datasets. "
"The [**timeseries()**](#timeseries) function accepts DataArrays or Datasets."
]
},
{
Expand All @@ -109,7 +107,7 @@
"source": [
"fg.timeseries(ds_time.tx_max_p50);\n",
"\n",
"#plt.savefig(\"../_static/_images/basic_timeseries.png\", bbox_inches='tight')"
"plt.savefig(\"images/basic_timeseries.png\", bbox_inches='tight')"
]
},
{
Expand Down Expand Up @@ -173,7 +171,7 @@
" my_data,show_lat_lon=\"upper left\",# fun legend option, moved latitude and longitude tag\n",
" legend='edge',\n",
" use_attrs={'ylabel': 'standard_name'} # will look for an attribute 'standard name' in the first entry of my_data\n",
" ) \n",
" )\n",
"ax.set_title('Custom Title', loc='left') #when the title is left aligned, the \"loc=left\" argument must be used.\n",
" # to remove a title, use ax.set_title('', loc='left')\n",
"ax.set_xlabel('Custom xlabel')\n",
Expand Down Expand Up @@ -321,7 +319,7 @@
"\n",
"fg.timeseries(data=data, legend='edge', show_lat_lon=False)\n",
"\n",
"#plt.savefig(\"../_static/_images/ensemble_timeseries.png\", bbox_inches='tight')"
"plt.savefig(\"images/ensemble_timeseries.png\", bbox_inches='tight')"
]
}
],
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ exclude = [
"docs/apidoc/modules.rst",
"docs/apidoc/figanos*.rst",
"docs/locales",
"docs/notebooks/images/*.png",
"src/figanos/data/test_data/*.nc"
]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_figanos.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_package_metadata():
"""Test the package metadata."""
project = find_spec("figanos").submodule_search_locations[0]

metadata = pathlib.Path(project).resolve().joinpath("conftest.py")
metadata = pathlib.Path(project).resolve().joinpath("__init__.py")

with metadata.open() as f:
contents = f.read()
Expand Down

0 comments on commit 94d0a34

Please sign in to comment.