Commit f8a6f6b7 authored by David Youssefi's avatar David Youssefi

ENH: Simplify first page for FOSS4G

parent 12450d49
......@@ -34,7 +34,7 @@ def normalize(array, quantile=2):
return normalized.astype(np.uint8)
def imshow_RGBPIR(raster, colors):
def imshow_RGBPIR(raster, colors=["Red", "Blue", "Green", "NIR"]):
"""
show R,G,B, PIR image
:param array: raster (rasterio image)
......
......@@ -6,7 +6,7 @@
"source": [
"<img style=\"float: left; margin:0px 15px 15px 0px; width:120px\" src=\"https://www.orfeo-toolbox.org/wp-content/uploads/2016/03/logo-orfeo-toolbox.png\">\n",
"\n",
"# OTB Guided Tour - JURSE 2019 Vannes France - May 21th\n",
"# OTB Guided Tour - FOSS4G 2019 Bucharest\n",
"## Yannick TANGUY and David YOUSSEFI (CNES, French Space Agency)\n",
"\n",
"<br>\n",
......@@ -30,7 +30,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Information about dataset: directory (./data), band order, mgrs, level, dates"
"### Data / Output directory"
]
},
{
......@@ -39,11 +39,9 @@
"metadata": {},
"outputs": [],
"source": [
"from glob import glob\n",
"import rasterio\n",
"import os\n",
"import display_api\n",
"import utils\n",
"from glob import glob\n",
"import ipywidgets\n",
"\n",
"# Data directory\n",
"DATA_DIR = \"data\"\n",
......@@ -51,15 +49,12 @@
"# Output directory\n",
"OUTPUT_DIR = \"output\"\n",
"\n",
"# Color bands\n",
"COLOR_BANDS = ['Red', 'Green', 'Blue', 'NIR']\n",
"\n",
"# Product information\n",
"MGRS = \"30TWT\"\n",
"LEVEL = \"L2A\"\n",
"\n",
"# Date list\n",
"print (list(map(lambda x:os.path.basename(x)[11:11+8],glob(os.path.join(DATA_DIR, \"SENTINEL2*.tif\")))))"
"date_buttons = ipywidgets.ToggleButtons(\n",
" options=[\"20180706\", \"20180621\", \"20180701\", \"20180711\"],\n",
" description=\"Dates:\")\n",
"\n",
"date_buttons"
]
},
{
......@@ -75,8 +70,9 @@
"metadata": {},
"outputs": [],
"source": [
"DATE = \"20180805\"\n",
"raster = rasterio.open(glob(os.path.join(DATA_DIR, \"SENTINEL2?_{0}-*_{1}_T{2}_*.tif\".format(DATE, LEVEL, MGRS)))[0])"
"import rasterio\n",
"DATE = date_buttons.value\n",
"raster = rasterio.open(glob(os.path.join(DATA_DIR, \"*{}*.tif\".format(DATE)))[0])"
]
},
{
......@@ -92,8 +88,9 @@
"metadata": {},
"outputs": [],
"source": [
"import display_api\n",
"# Plot bands from SENTINEL-2 product\n",
"display_api.imshow_RGBPIR(raster, colors=COLOR_BANDS)"
"display_api.imshow_RGBPIR(raster)"
]
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment