Skip to content

Rework example gallery #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ For any operating system, install the following:

[work in progress]

## Testing

To find out how to run the tests of the pytopotoolbox, refer to the dedicated [readme](./test/README.md) in the /tests directory.

## Contributing

If you would like to contribute to pytopotoolbox, check out the [Contribution Guidelines](./CONTRIBUTING.md).
Expand Down
Binary file added docs/_static/thumbnails/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 9 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys

Expand All @@ -21,7 +13,6 @@
'sphinx.ext.viewcode',
'sphinx.ext.todo',
'nbsphinx',
'myst_parser',
]

project = 'TopoToolbox'
Expand All @@ -30,14 +21,11 @@
release = '3.0.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
Expand All @@ -57,9 +45,17 @@
'members': True,
'undoc-members': True,
'private-members': False,
'special-members': '__init__',
'inherited-members': True,
'show-inheritance': True,
}

autosummary_generate = True # Enable autosummary to generate stub files

# -- Options for nbgallery ---------------------------------------------------

nbsphinx_thumbnails = {
'_temp/excesstopography': '_static/thumbnails/placeholder.png',
'_temp/magicfunctions': '_static/thumbnails/placeholder.png',
'_temp/plotting': '_static/thumbnails/placeholder.png',
'_temp/downloading': '_static/thumbnails/placeholder.png',
}
10 changes: 4 additions & 6 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Examples
========

.. nbgallery::
/_temp/excesstopography.ipynb
/_temp/plotting.ipynb
/_temp/test_genGrid
/_temp/test_GridObject
/_temp/test_load_dem
/_temp/example_magic_funcs
/_temp/excesstopography
/_temp/magicfunctions
/_temp/plotting
/_temp/downloading
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Sphinx==7.3.7
sphinx-book-theme==1.1.2
nbsphinx==0.9.4
notebook==7.0.5
myst_parser
notebook==7.0.5
75 changes: 75 additions & 0 deletions examples/downloading.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Loading an example GridObject\n",
"=============================\n",
"\n",
"The TopoToolbox provides a few example .tif files. These Files will get saved in a local cache. To delete these Files, run `topotoolbox.clear_cache()`."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['kedarnath', 'kunashiri', 'perfectworld', 'taalvolcano', 'taiwan', 'tibet']\n",
"\n",
"name: taiwan\n",
"path: /home/theo/.cache/topotoolbox/taiwan.tif\n",
"rows: 4181\n",
"cols: 2253\n",
"cellsize: 90.0\n",
"bounds: BoundingBox(left=197038.4533204764, bottom=2422805.9007333447, right=399808.4533204764, top=2799095.9007333447)\n",
"transform: | 90.00, 0.00, 197038.45|\n",
"| 0.00,-90.00, 2799095.90|\n",
"| 0.00, 0.00, 1.00|\n",
"crs: EPSG:32651\n",
"\n",
"['kunashiri.tif', 'perfectworld.tif', 'tibet.tif', 'taiwan.tif', 'kedarnath.tif']\n"
]
}
],
"source": [
"import topotoolbox as topo\n",
"\n",
"# Print all available example files\n",
"print(f\"{topo.get_dem_names()}\\n\")\n",
"\n",
"# Download an example file\n",
"dem = topo.load_dem(\"taiwan\")\n",
"dem.info()\n",
"\n",
"# Print all files currently saved in your cache\n",
"print(f\"\\n{topo.get_cache_contents()}\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
157 changes: 0 additions & 157 deletions examples/example_magic_funcs.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion examples/excesstopography.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If some sections of the GridObject should be differently than others, use another GridObject or np.ndarray to add custom value for the threshold slopes. Make sure that the shape of your threshold matches the one of your GridObject."
"If some sections of the GridObject should be evaluated differently than others, use another GridObject or np.ndarray to add custom value for the threshold slopes. Make sure that the shape of your threshold matches the one of your GridObject."
]
},
{
Expand Down
Loading