Skip to content

Commit

Permalink
Interactive maps (#44)
Browse files Browse the repository at this point in the history
`stackstac.show` and `stackstac.add_to_map` display Dask-backed DataArrays on ipyleaflet maps.

Other changes:
* Exposed some handy spatial and miscellaneous operations in the public API (`reproject_array`, `xyztile_of_array`, etc.)
* Exposed `stackstac.mosaic`! Closes #1.
* Reorganized docs to have an examples subsection and base API reference page
* Added visualization notebook from my webinar
  • Loading branch information
gjoseph92 authored May 5, 2021
1 parent ef77e97 commit 4029a68
Show file tree
Hide file tree
Showing 22 changed files with 2,896 additions and 201 deletions.
3 changes: 2 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ python:
- method: pip
path: .
extra_requirements:
- docs
- docs
- viz
3 changes: 2 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build/*
api/internal/*.rst
api/internal/*.rst
api/main/*.rst
47 changes: 45 additions & 2 deletions docs/api/main.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
API reference
-------------

There's only one function:
.. currentmodule:: stackstac

.. autofunction:: stackstac.stack
Core
~~~~

This is what it's all about:

.. autosummary::
:toctree: main
:nosignatures:

stack

Visualization
~~~~~~~~~~~~~

Easily render your data on an :doc:`ipyleaflet <ipyleaflet:index>` map. Requires installing ``'stackstac[viz]'``, and running with a :doc:`dask distributed <distributed:index>` cluster.

As you pan around the map, the part of the array that's in view is computed on the fly by dask.

**Warning**: zooming in and out will *not* load underlying data at different resolutions. Assets will be loaded at whatever resolution you initially got from `~.stack`. If your array is large and high-resolution, zooming out could trigger very slow (and expensive) computations.


.. autosummary::
:toctree: main
:nosignatures:

show
add_to_map

Operations
~~~~~~~~~~

Utilities to work with geospatial DataArrays produced by stackstac.

**Warning**: these functions may be reorganized in the near future.

.. autosummary::
:toctree: main
:nosignatures:

mosaic
reproject_array
xyztile_of_array
array_bounds
array_epsg
7 changes: 5 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
# a list of builtin themes.
#
html_theme = "insipid"

html_theme_options = {
"globaltoc_maxdepth": -1,
}
Expand All @@ -92,12 +91,16 @@
# 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,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

intersphinx_mapping = {
"rasterio": ("https://rasterio.readthedocs.io/en/latest/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pystac": ("https://pystac.readthedocs.io/en/latest/", None),
"xarray": ("http://xarray.pydata.org/en/stable/", None),
"dask": ("https://docs.dask.org/en/latest/", None),
"distributed": ("https://distributed.dask.org/en/latest/", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"ipyleaflet": ("https://ipyleaflet.readthedocs.io/en/latest/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
}
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation

``stackstac`` is available on pip::

pip install stackstac
pip install 'stackstac[viz]'

Its main dependencies are rasterio, pyproj, dask, and xarray, all of which should pose no problems to install—no need to build GDAL from source here.

Expand Down
Binary file added examples/images/show-ndvi-anomaly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/show-ndvi-widget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/show-ndvi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/show-s2-median.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ More examples

cluster
gif
show
Loading

0 comments on commit 4029a68

Please sign in to comment.