Skip to content

Commit

Permalink
Switch examples to Binder (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjoseph92 authored Dec 3, 2021
1 parent cc0598b commit 9d24228
Show file tree
Hide file tree
Showing 13 changed files with 259,302 additions and 2,012 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# StackSTAC

[![Documentation Status](https://readthedocs.org/projects/stackstac/badge/?version=latest)](https://stackstac.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/stackstac/badge/?version=latest)](https://stackstac.readthedocs.io/en/latest/?badge=latest) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/gjoseph92/stackstac/main?labpath=%2Fdocs%2Fbasic.ipynb%3Ffile-browser-path%3D%2Fexamples)

Turn a list of [STAC](http://stacspec.org) items into a 4D [xarray](http://xarray.pydata.org/en/stable/) DataArray (dims: `time, band, y, x`), including reprojection to a common grid. The array is a lazy [Dask array](https://docs.dask.org/en/latest/array.html), so loading and processing the data in parallel—locally or [on a cluster](https://coiled.io/)—is just a `compute()` call away.

Expand Down
5 changes: 5 additions & 0 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

set -ex

poetry config virtualenvs.create false
poetry install -E binder -E viz
3 changes: 1 addition & 2 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.[binder]
# ^ installs the project using poetry
poetry
47 changes: 21 additions & 26 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@

# -- Project information -----------------------------------------------------

project = "stackstac"
copyright = "2021, Gabe Joseph"
author = "Gabe Joseph"
import importlib.metadata
import datetime

DISTRIBUTION_METADATA = importlib.metadata.metadata("stackstac")

author = DISTRIBUTION_METADATA["Author"]
project = DISTRIBUTION_METADATA["Name"]
version = DISTRIBUTION_METADATA["Version"]
copyright = f"{datetime.datetime.now().year}, {author}"

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -73,43 +78,33 @@
# Gotta fight fire with fire. nbsphinx injects their CSS directly into the page...
# https://github.com/spatialaudio/nbsphinx/blob/master/src/nbsphinx.py#L437-L683
# so we just inject after it to undo their settings that look bad in dark mode.
nbsphinx_prolog = """
nbsphinx_prolog = f"""
.. raw:: html
<style>
@media (prefers-color-scheme: dark) {
@media (prefers-color-scheme: dark) {{
/* input area */
div.nbinput.container div.input_area {
div.nbinput.container div.input_area {{
border: unset;
border-radius: unset;
}
}
}}
}}
</style>
{% set docname = env.doc2path(env.docname, base=False) %}
{{% set docname = env.doc2path(env.docname, base=False) %}}
.. note::
You can view & download the original notebook
`on Github <https://github.com/gjoseph92/stackstac/blob/main/docs/{{
You can run this notebook interactively: |Binder|, or view & download the original
`on GitHub <https://github.com/gjoseph92/stackstac/blob/v{version}/docs/{{{{
"../" + docname if docname.startswith("examples") else docname
}}>`_.
}}}}>`_.
Or, `click here <https://cloud.coiled.io/gjoseph92/jobs/stackstac>`_
to run these notebooks on Coiled with access to Dask clusters.
.. |Binder| image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/gjoseph92/stackstac/v{version}?urlpath=lab/tree/docs/{{{{
"../" + docname if docname.startswith("examples") else docname
}}}}
"""

# TODO enable binder once Coiled supports websocket clusters over 443.
# (Binder blocks outbound traffic on all ports besides 22, 80, and 443, so we can't connect to Coiled on 8786.)
# nbsphinx_prolog = """
# {% set docname = env.doc2path(env.docname, base=False) %}
# .. note::
# You can run this notebook interactively here: |Binder|, or view & download the original
# `on Github <https://github.com/gjoseph92/stackstac/blob/main/docs/{{ docname }}>`_.

# .. |Binder| image:: https://mybinder.org/badge_logo.svg
# :target: https://mybinder.org/v2/gh/gjoseph92/stackstac/main?urlpath=lab/tree/docs/{{ docname }}
# """


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
1,097 changes: 804 additions & 293 deletions examples/cluster.ipynb

Large diffs are not rendered by default.

246,682 changes: 245,615 additions & 1,067 deletions examples/gif.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 9d24228

Please sign in to comment.