Skip to content

Commit

Permalink
Merge pull request #55 from MAAP-Project/dev/wug-map-refresh
Browse files Browse the repository at this point in the history
init working version commit
  • Loading branch information
emmalu authored May 25, 2023
2 parents 2bc5e15 + 28e1bc0 commit cf4b8cf
Show file tree
Hide file tree
Showing 14 changed files with 1,193 additions and 471 deletions.
10 changes: 9 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ History
0.1.0 (2023-01-19)
------------------

* First release on PyPI.
* First release (beta).


0.2.0 (2023-05-19)
------------------

* First public release (beta).


1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include HISTORY.rst
include LICENSE
include README.rst
include stac_ipyleaflet/data/*
include stac_ipyleaflet/widgets/*
include stac_ipyleaflet/stac_discovery/catalogs/*

recursive-include tests *
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# STAC ipyleaflet

WORK IN PROGRESS. Right now this does nothing with STAC. Currently this provides a module on top of ipyleaflet demonstrating how to load tile layers (from `biomass-layers.csv` and create histograms from a bounding box and visible layers.
WORK IN PROGRESS. Right now this connects to the MAAP STAC - providing a module on top of ipyleaflet demonstrating how to load & control opacity for tile layers (from `biomass-layers.csv`), view pre-determined Basemaps, and derive coordinates from a user-defined bounding box.

Much of this is inspired and copied from [leafmap](https://leafmap.org/)
Much of this project is inspired from [leafmap](https://leafmap.org/)

![Jupyter Lab ScreenShot](jlab-screenshot.png)

Expand All @@ -24,3 +24,6 @@ jupyter lab

Note this library currently includes `rio.open` so must be run with an AWS identity that has access to the bucket the biomass products are in.

**Styling Notes**
- By default, ipywidget icons can be set to any from the font-awesome library v4: https://fontawesome.com/v4/icons/
- By default, ipywidget buttons can be styled to any html colors: https://htmlcolorcodes.com/color-names/
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ipyleaflet customized for discovering, visualizing and interacting with STAC and


* Free software: MIT license
* Documentation: https://stac-ipyleaflet.readthedocs.io.
* Documentation: https://docs.maap-project.org/en/latest/technical_tutorials/visualization/stac_ipyleaflet.html.


Features
Expand Down
115 changes: 75 additions & 40 deletions demo.ipynb
Original file line number Diff line number Diff line change
@@ -1,74 +1,109 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "4f7d5321-d82b-4ed4-8136-832f932b30b5",
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "libpoppler.so.126: cannot open shared object file: No such file or directory",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mstac_ipyleaflet\u001b[39;00m\n",
"File \u001b[0;32m/workspaces/stac_ipyleaflet/stac_ipyleaflet/__init__.py:7\u001b[0m\n\u001b[1;32m 4\u001b[0m __email__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maimee@developmentseed.org\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 5\u001b[0m __version__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0.1.0\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n",
"File \u001b[0;32m/workspaces/stac_ipyleaflet/stac_ipyleaflet/core.py:15\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;66;03m#from pydantic import BaseModel\u001b[39;00m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mshapely\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgeometry\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Polygon\n\u001b[0;32m---> 15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mxarray\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mxr\u001b[39;00m\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\n",
"File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rioxarray/__init__.py:5\u001b[0m\n\u001b[1;32m 2\u001b[0m __author__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\u001b[38;5;124mrioxarray Contributors\u001b[39m\u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mimportlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmetadata\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraster_array\u001b[39;00m \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraster_dataset\u001b[39;00m \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_io\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m open_rasterio \u001b[38;5;66;03m# noqa\u001b[39;00m\n",
"File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rioxarray/raster_array.py:19\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtyping\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Any, Literal, Optional, Union\n\u001b[1;32m 18\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[0;32m---> 19\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmask\u001b[39;00m\n\u001b[1;32m 21\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mwarp\u001b[39;00m\n",
"File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rasterio/__init__.py:28\u001b[0m\n\u001b[1;32m 24\u001b[0m os\u001b[38;5;241m.\u001b[39madd_dll_directory(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mabspath(p))\n\u001b[1;32m 27\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_show_versions\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m show_versions\n\u001b[0;32m---> 28\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_version\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m gdal_version, get_geos_version, get_proj_version\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcrs\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CRS\n\u001b[1;32m 30\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdrivers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m driver_from_extension, is_blacklisted\n",
"\u001b[0;31mImportError\u001b[0m: libpoppler.so.126: cannot open shared object file: No such file or directory"
]
}
],
"source": [
"import stac_ipyleaflet"
]
},
{
"cell_type": "markdown",
"id": "9648b56f-dbf3-4aac-af19-643067596220",
"metadata": {},
"metadata": {
"tags": []
},
"source": [
"# Use ipyleaflet to visually explore MAAP data\n",
"# Use stac_ipyleaflet to visually explore MAAP data\n",
"\n",
"Inspired by leafmap."
"Inspired by Leafmap."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8e4a59f2-1aa6-4b82-86e5-90d0c3c7ffe2",
"metadata": {},
"execution_count": 1,
"id": "4f7d5321-d82b-4ed4-8136-832f932b30b5",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3a03ad2140da4cd198721f5ba3e089c6",
"model_id": "a889bd5030ec400ebf2bd0ee01bded38",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"StacIpyleaflet(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zo…"
"HBox(children=(ToggleButton(value=False, description='Layers', icon='map-o', layout=Layout(border_bottom='1px …"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "03a7d6cea86b4f2ab0de29781bb1942c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a0f8457e810d46f284779d9d6b201f24",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "20b7d3527fcf4a4384ffd3df79e25d44",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"StacIpyleaflet(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zo…"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import ipywidgets\n",
"m = stac_ipyleaflet.StacIpyleaflet(zoom=4, layout=ipywidgets.Layout(height=\"800px\"))\n",
"m.draw_biomass_map()\n",
"import stac_ipyleaflet\n",
"# from ipywidgets import Layout\n",
"m = stac_ipyleaflet.StacIpyleaflet()\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6b9c37b-58d9-4d17-8891-8eed125eb996",
"id": "d7a3e19b-6e6c-4a4d-95ef-b253d28af4ad",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d2c9bb0-8435-449e-bf44-03e628556239",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -90,7 +125,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.10.10"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ipyleaflet==0.17.2
ipywidgets==8.0.4
ipyleaflet>=0.17.2
ipywidgets>=8.0.4
ipyevents
matplotlib
pydantic
Expand Down
14 changes: 7 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[metadata]
name = stac_ipyleaflet
version=0.1.0
version=0.2.0
author = Aimee Barciauskas
description=ipyleaflet customized for discovering, visualizing and interacting with STAC and workspace data.
description=ipyleaflet customized for discovering, visualizing and interacting with STAC data.
long_description = file: README.md
url = https://github.com/abarciauskas-bgse/stac_ipyleaflet
keywords = stac_ipyleaflet
author_email=aimee@developmentseed.org
license=MIT license
classifiers =
Development Status :: 2 - Pre-Alpha
Intended Audience :: Developers
Development Status :: 2 - Beta
Intended Audience :: NASA Scientists
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

[bumpversion]
current_version = 0.1.0
current_version = 0.2.0
commit = True
tag = True

Expand All @@ -44,8 +44,8 @@ include_package_data=True
zip_safe=False
tests_require=[pytest>=3]
install_requires =
ipyleaflet==0.17.2
ipywidgets==8.0.4
ipyleaflet>=0.17.2
ipywidgets>=8.0.4
ipyevents
matplotlib
pydantic
Expand Down
8 changes: 1 addition & 7 deletions stac_ipyleaflet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
"""Top-level package for stac ipyleaflet."""

__author__ = """Aimee Barciauskas"""
__email__ = 'aimee@developmentseed.org'
__version__ = '0.1.0'

from .core import *
from stac_ipyleaflet.core import *
Loading

0 comments on commit cf4b8cf

Please sign in to comment.