Skip to content

Commit f4886c7

Browse files
author
Stefan Kuethe
committed
Add juypterlite
1 parent 5a211f6 commit f4886c7

File tree

9 files changed

+2383
-0
lines changed

9 files changed

+2383
-0
lines changed

jupyterlite/.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
*.bundle.*
2+
lib/
3+
node_modules/
4+
.yarn-packages/
5+
*.egg-info/
6+
.ipynb_checkpoints
7+
*.tsbuildinfo
8+
9+
# Created by https://www.gitignore.io/api/python
10+
# Edit at https://www.gitignore.io/?templates=python
11+
12+
### Python ###
13+
# Byte-compiled / optimized / DLL files
14+
__pycache__/
15+
*.py[cod]
16+
*$py.class
17+
18+
# C extensions
19+
*.so
20+
21+
# Distribution / packaging
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
pip-wheel-metadata/
36+
share/python-wheels/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# PyInstaller
42+
# Usually these files are written by a python script from a template
43+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
44+
*.manifest
45+
*.spec
46+
47+
# Installer logs
48+
pip-log.txt
49+
pip-delete-this-directory.txt
50+
51+
# Unit test / coverage reports
52+
htmlcov/
53+
.tox/
54+
.nox/
55+
.coverage
56+
.coverage.*
57+
.cache
58+
nosetests.xml
59+
coverage.xml
60+
*.cover
61+
.hypothesis/
62+
.pytest_cache/
63+
64+
# Translations
65+
*.mo
66+
*.pot
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# pyenv
78+
.python-version
79+
80+
# celery beat schedule file
81+
celerybeat-schedule
82+
83+
# SageMath parsed files
84+
*.sage.py
85+
86+
# Spyder project settings
87+
.spyderproject
88+
.spyproject
89+
90+
# Rope project settings
91+
.ropeproject
92+
93+
# Mr Developer
94+
.mr.developer.cfg
95+
.project
96+
.pydevproject
97+
98+
# mkdocs documentation
99+
/site
100+
101+
# mypy
102+
.mypy_cache/
103+
.dmypy.json
104+
dmypy.json
105+
106+
# Pyre type checker
107+
.pyre/
108+
109+
# OS X stuff
110+
*.DS_Store
111+
112+
# End of https://www.gitignore.io/api/python
113+
114+
# jupyterlite
115+
*.doit.db
116+
_output
117+
118+
# Virtual environments
119+
.venv
120+

jupyterlite/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# JupyterLite
2+
3+
```bash
4+
uv sync
5+
source .venv/bin/activate
6+
7+
jupyter lite build --contents contents --output-dir dist
8+
cd dist
9+
python -m http.server -d dist
10+
```

jupyterlite/contents/geotiff.ipynb

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"metadata": {
3+
"kernelspec": {
4+
"name": "python",
5+
"display_name": "Python (Pyodide)",
6+
"language": "python"
7+
},
8+
"language_info": {
9+
"codemirror_mode": {
10+
"name": "python",
11+
"version": 3
12+
},
13+
"file_extension": ".py",
14+
"mimetype": "text/x-python",
15+
"name": "python",
16+
"nbconvert_exporter": "python",
17+
"pygments_lexer": "ipython3",
18+
"version": "3.8"
19+
}
20+
},
21+
"nbformat_minor": 5,
22+
"nbformat": 4,
23+
"cells": [
24+
{
25+
"id": "9107e9f6-fb76-4f0c-89f7-576226375420",
26+
"cell_type": "code",
27+
"source": "%pip install openlayers",
28+
"metadata": {
29+
"trusted": true
30+
},
31+
"outputs": [],
32+
"execution_count": 1
33+
},
34+
{
35+
"id": "853579b6-8499-4927-a7a1-bfae79f78107",
36+
"cell_type": "code",
37+
"source": "import openlayers as ol",
38+
"metadata": {
39+
"trusted": true
40+
},
41+
"outputs": [],
42+
"execution_count": 2
43+
},
44+
{
45+
"id": "d4dfb1d9-3d1a-44c3-9bdc-5e7458811fd4",
46+
"cell_type": "code",
47+
"source": "data = \"https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif\"",
48+
"metadata": {
49+
"trusted": true
50+
},
51+
"outputs": [],
52+
"execution_count": 3
53+
},
54+
{
55+
"id": "ed79ba6a-65e5-4a3b-afbb-ada812fad00f",
56+
"cell_type": "code",
57+
"source": "geotiff = ol.WebGLTileLayer(\n id=\"cog\",\n opacity=0.5,\n source=ol.GeoTIFFSource(sources=[dict(url=data)])\n)",
58+
"metadata": {
59+
"trusted": true
60+
},
61+
"outputs": [],
62+
"execution_count": 4
63+
},
64+
{
65+
"id": "466d9454-2ff5-42cf-b16f-e16438904977",
66+
"cell_type": "code",
67+
"source": "m = ol.MapWidget()\nm.add_layer(geotiff)",
68+
"metadata": {
69+
"trusted": true
70+
},
71+
"outputs": [],
72+
"execution_count": 9
73+
},
74+
{
75+
"id": "91d8bb71-ba0b-4206-b36a-e0098c462ec7",
76+
"cell_type": "code",
77+
"source": "m",
78+
"metadata": {
79+
"trusted": true
80+
},
81+
"outputs": [
82+
{
83+
"execution_count": 10,
84+
"output_type": "execute_result",
85+
"data": {
86+
"text/plain": "MapWidget(calls=[{'method': 'addLayer', 'args': ({'id': 'cog', 'source': {'sources': [{'url': 'https://sentine…",
87+
"application/vnd.jupyter.widget-view+json": {
88+
"version_major": 2,
89+
"version_minor": 1,
90+
"model_id": "b888fe271d0e4e4bbcbbddb5bc949f79"
91+
}
92+
},
93+
"metadata": {}
94+
}
95+
],
96+
"execution_count": 10
97+
},
98+
{
99+
"id": "0d072d98-399d-44c6-a180-985c799e3ed1",
100+
"cell_type": "code",
101+
"source": "m.set_view_from_source(\"cog\")",
102+
"metadata": {
103+
"trusted": true
104+
},
105+
"outputs": [],
106+
"execution_count": 11
107+
},
108+
{
109+
"id": "399cf8c8-0e53-4513-96b3-4bf916cc6fa8",
110+
"cell_type": "code",
111+
"source": "",
112+
"metadata": {
113+
"trusted": true
114+
},
115+
"outputs": [],
116+
"execution_count": null
117+
}
118+
]
119+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"metadata": {
3+
"kernelspec": {
4+
"name": "python",
5+
"display_name": "Python (Pyodide)",
6+
"language": "python"
7+
},
8+
"language_info": {
9+
"codemirror_mode": {
10+
"name": "python",
11+
"version": 3
12+
},
13+
"file_extension": ".py",
14+
"mimetype": "text/x-python",
15+
"name": "python",
16+
"nbconvert_exporter": "python",
17+
"pygments_lexer": "ipython3",
18+
"version": "3.8"
19+
}
20+
},
21+
"nbformat_minor": 5,
22+
"nbformat": 4,
23+
"cells": [
24+
{
25+
"id": "66605b1e-7af5-4148-8239-c3812cfad687",
26+
"cell_type": "code",
27+
"source": "%pip install openlayers",
28+
"metadata": {
29+
"trusted": true
30+
},
31+
"outputs": [],
32+
"execution_count": 3
33+
},
34+
{
35+
"id": "03aad39a-c9f9-443f-9e2d-cd5a25ce0407",
36+
"cell_type": "code",
37+
"source": "import openlayers as ol",
38+
"metadata": {
39+
"trusted": true
40+
},
41+
"outputs": [],
42+
"execution_count": 4
43+
},
44+
{
45+
"id": "b2b99974-7e84-4712-8f76-043ed6319049",
46+
"cell_type": "code",
47+
"source": "m = ol.MapWidget()",
48+
"metadata": {
49+
"trusted": true
50+
},
51+
"outputs": [],
52+
"execution_count": 5
53+
},
54+
{
55+
"id": "6afbefe8-254b-405e-905c-5a035325fe13",
56+
"cell_type": "code",
57+
"source": "m",
58+
"metadata": {
59+
"trusted": true
60+
},
61+
"outputs": [
62+
{
63+
"execution_count": 6,
64+
"output_type": "execute_result",
65+
"data": {
66+
"text/plain": "MapWidget(height='400px', options={'view': {'center': (0.0, 0.0), 'zoom': 0, 'projection': 'EPSG:3857', '@@typ…",
67+
"application/vnd.jupyter.widget-view+json": {
68+
"version_major": 2,
69+
"version_minor": 1,
70+
"model_id": "594077a998d04fd4a78680779fb1cd23"
71+
}
72+
},
73+
"metadata": {}
74+
}
75+
],
76+
"execution_count": 6
77+
},
78+
{
79+
"id": "f2aa5a68-adf1-4fcb-9d5d-06050c8e1641",
80+
"cell_type": "code",
81+
"source": "",
82+
"metadata": {
83+
"trusted": true
84+
},
85+
"outputs": [],
86+
"execution_count": null
87+
}
88+
]
89+
}

0 commit comments

Comments
 (0)