Skip to content

Commit

Permalink
first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Nov 19, 2020
1 parent 5016f84 commit 573c349
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 0 deletions.
59 changes: 59 additions & 0 deletions about_ui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sepal_ui import sepalwidgets as sw\n",
"\n",
"#create the Html body of your about section \n",
"ig_about = sw.TileAbout('README.md')\n",
"\n",
"#create a disclaimer\n",
"ig_disclaimer = sw.TileDisclaimer()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#will only be displayed if voila is launch from this tile\n",
"ig_about"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ig_disclaimer"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
43 changes: 43 additions & 0 deletions aoi_selector_ui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sepal_ui import aoi as sw\n",
"\n",
"#create the asset variables object \n",
"ig_aoi_io = sw.Aoi_io()\n",
"\n",
"#create the tile \n",
"ig_aoi = sw.TileAoi(ig_aoi_io, methods = ['Draw a shape', 'Upload file', 'Use points file'])\n",
"\n",
"#this tile will only be displayed if voila is launch from this notebook \n",
"ig_aoi"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
85 changes: 85 additions & 0 deletions no_ui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction\n",
"This notebook is intented for the users that experience difficulties executing the voila dashboard contained in UI.ipynb. It provides the same fonctionalities that you can run and use by clicking on : \n",
"```\n",
"Kernel -> Restart & Run All\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"import sys\n",
"!{sys.executable} -m pip install --upgrade sepal-ui"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#add all the tiles\n",
"%run 'aoi_selector_ui.ipynb'\n",
"%run 'about_ui.ipynb'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ig_aoi"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ig_about"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ig_disclaimer"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
140 changes: 140 additions & 0 deletions ui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"import sys\n",
"!{sys.executable} -m pip install --upgrade sepal-ui"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%capture\n",
"#prevent a rasterIo bug \n",
"%set_env PROJ_LIB=/usr/share/proj"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sepal_ui import sepalwidgets as sw"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#create an appBar \n",
"ig_appBar = sw.AppBar('Import to Google Earth Engine')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#create a footer \n",
"ig_footer = sw.Footer()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#add tiles \n",
"%run 'aoi_selector_ui.ipynb'\n",
"%run 'about_ui.ipynb'\n",
"\n",
"ig_content = [\n",
" ig_aoi,\n",
" ig_about,\n",
" ig_disclaimer\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#create a drawer \n",
"item_aoi = sw.DrawerItem('AOI selection', 'mdi-map-marker-check', card=\"aoi_widget\").display_tile(ig_content)\n",
"item_about = sw.DrawerItem('About', 'mdi-help-circle', card=\"about_widget\").display_tile(ig_content)\n",
"\n",
"code_link = \"https://github.com/12rambau/import_to_gee\"\n",
"wiki_link = \"https://github.com/12rambau/import_to_gee/blob/master/README.md\"\n",
"issue_link = \"https://github.com/12rambau/import_to_gee/issues/new\"\n",
"\n",
"items = [\n",
" item_aoi,\n",
" item_about\n",
"]\n",
"\n",
"ig_drawer = sw.NavDrawer(items, code = code_link, wiki = wiki_link, issue = issue_link).display_drawer(ig_appBar.toggle_button)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#build the app \n",
"ig_app = sw.App(\n",
" tiles=ig_content, \n",
" appBar=ig_appBar, \n",
" footer=ig_footer, \n",
" navDrawer=ig_drawer\n",
").show_tile('aoi_widget')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#display the app\n",
"ig_app"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 573c349

Please sign in to comment.