Skip to content

Commit

Permalink
DOCS: Added tutorial 035
Browse files Browse the repository at this point in the history
  • Loading branch information
davemlz committed Apr 5, 2022
1 parent 29f181c commit c5c905b
Show file tree
Hide file tree
Showing 2 changed files with 283 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Tutorials
tutorials/028-Tasseled-Cap.ipynb
tutorials/030-Awesome-Spectral-Indices-v003.ipynb
tutorials/032-Combining-eemont-wxee.ipynb
tutorials/035-Landsat-9.ipynb

.. toctree::
:caption: Time Series
Expand Down
282 changes: 282 additions & 0 deletions docs/tutorials/035-Landsat-9.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "789cc77f-48d1-4147-9de2-b01281848122",
"metadata": {},
"source": [
"[![colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/davemlz/eemont/blob/master/docs/tutorials/035-Landsat-9.ipynb)\n",
"[![Open in SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/davemlz/eemont/blob/master/docs/tutorials/035-Landsat-9.ipynb)\n",
"[![Open in Planetary Computer](https://img.shields.io/badge/Open-Planetary%20Computer-black?style=flat&logo=microsoft)](https://pccompute.westeurope.cloudapp.azure.com/compute/hub/user-redirect/git-pull?repo=https://github.com/davemlz/eemont&urlpath=lab/tree/eemont/docs/tutorials/035-Landsat-9.ipynb&branch=master)"
]
},
{
"cell_type": "markdown",
"id": "962f49b0-c041-49c9-9d1f-5075859312b9",
"metadata": {
"id": "jZEthLln92Ep"
},
"source": [
"# Landsat-9"
]
},
{
"cell_type": "markdown",
"id": "c4bcbe8c-c06e-46a1-9999-4f9603d29c09",
"metadata": {
"id": "dNa470OZ8Oec"
},
"source": [
"_Tutorial created by **David Montero Loaiza**_: [GitHub](https://github.com/davemlz) | [Twitter](https://twitter.com/dmlmont)\n",
"\n",
"- GitHub Repo: [https://github.com/davemlz/eemont](https://github.com/davemlz/eemont)\n",
"- PyPI link: [https://pypi.org/project/eemont/](https://pypi.org/project/eemont/)\n",
"- Conda-forge: [https://anaconda.org/conda-forge/eemont](https://anaconda.org/conda-forge/eemont)\n",
"- Documentation: [https://eemont.readthedocs.io/](https://eemont.readthedocs.io/)\n",
"- More tutorials: [https://github.com/davemlz/eemont/tree/master/docs/tutorials](https://github.com/davemlz/eemont/tree/master/docs/tutorials)"
]
},
{
"cell_type": "markdown",
"id": "53ebc385-903d-4d89-9ff1-ec84ee0034a0",
"metadata": {
"id": "CD7h0hbi92Er"
},
"source": [
"## Let's start!"
]
},
{
"cell_type": "markdown",
"id": "5185cd5d-a392-45be-bb0e-abc1ad1eac6e",
"metadata": {
"id": "E0rc6Cya92Es"
},
"source": [
"If required, please uncomment:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "db957a97-1325-4160-8c05-395acbcac05d",
"metadata": {
"id": "NYzyvKtk92Es"
},
"outputs": [],
"source": [
"#!pip install eemont\n",
"#!pip install geemap"
]
},
{
"cell_type": "markdown",
"id": "6626551e-3468-4d61-831e-aa9a55b6af47",
"metadata": {
"id": "x3Rm3qt_92Et"
},
"source": [
"Import the required packages."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2a2cc6e3-2cca-42c0-8425-ee58a2127aac",
"metadata": {
"id": "H0C9S_Hh92Et"
},
"outputs": [],
"source": [
"import ee, eemont, geemap\n",
"import geemap.colormaps as cm"
]
},
{
"cell_type": "markdown",
"id": "cbcb9ef8-99ec-4148-bc72-f06dc95361d3",
"metadata": {
"id": "k1sdX2p592Eu"
},
"source": [
"Authenticate and Initialize Earth Engine and geemap."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "65d44d62-876d-4234-8113-f39b7a569ff7",
"metadata": {
"id": "7QDXqVwy8Oef"
},
"outputs": [],
"source": [
"Map = geemap.Map()"
]
},
{
"cell_type": "markdown",
"id": "48ac77b4-b37d-4ac9-9d4c-4fb959a971f6",
"metadata": {},
"source": [
"Let's define a point of interest:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a0c4fc00-5b8a-4544-9960-d8d5c5232971",
"metadata": {},
"outputs": [],
"source": [
"poi = ee.Geometry.BBoxFromQuery(\"Salvajina, Colombia\",user_agent = \"eemont-tutorial-035\")"
]
},
{
"cell_type": "markdown",
"id": "cff4535d-3136-4aff-bd16-07c39dd47880",
"metadata": {},
"source": [
"## Scale and Offset, Cloud Masking and Spectral Indices"
]
},
{
"cell_type": "markdown",
"id": "e0780679-8f0f-47d3-985e-7e4d32e72c7e",
"metadata": {},
"source": [
"Let's compute one of the mew Spectral Indices!"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "e901b115-47d5-4ddf-8383-dbeeea7a04c7",
"metadata": {},
"outputs": [],
"source": [
"L9 = (ee.ImageCollection(\"LANDSAT/LC09/C02/T1_L2\")\n",
" .filterBounds(poi)\n",
" .filterDate(\"2021-10-01\",\"2022-04-01\")\n",
" .preprocess()\n",
" .spectralIndices([\"NIRv\",\"NDWI\"])\n",
" .median())"
]
},
{
"cell_type": "markdown",
"id": "81428dc8-d1ac-4cb4-b258-2eb136578c7d",
"metadata": {},
"source": [
"Let's visualize everything using `geemap` (and also container emulation methods!):"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "48864148c29a424fbce94a0155250b49",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[2.94214084968257, -76.70673205008194], controls=(WidgetControl(options=['position', 'transparent_b…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Map = geemap.Map()\n",
"Map.addLayer(L9['SR_B4','SR_B3','SR_B2'],{\"min\":0,\"max\":0.2},\"RGB\")\n",
"Map.centerObject(poi.centroid(1),11)\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "de976bc8-338f-40ba-81cb-3048ab894228",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aa9f88e8b211492b88831c8336a7b534",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[2.94214084968257, -76.70673205008194], controls=(WidgetControl(options=['position', 'transparent_b…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Map = geemap.Map()\n",
"Map.addLayer(L9['NIRv'],{\"min\":0,\"max\":0.8,\"palette\":cm.palettes.ndvi},\"NIRv\")\n",
"Map.centerObject(poi.centroid(1),11)\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4196b40dc91d4ab3980c5f0674e7ae38",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[2.94214084968257, -76.70673205008194], controls=(WidgetControl(options=['position', 'transparent_b…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Map = geemap.Map()\n",
"Map.addLayer(L9['NDWI'],{\"min\":0,\"max\":1,\"palette\":cm.palettes.ndwi},\"NDWI\")\n",
"Map.centerObject(poi.centroid(1),11)\n",
"Map"
]
}
],
"metadata": {
"interpreter": {
"hash": "327d5e621b974e147ccdb6304d32641b717e1682a943007f603cee52dd910c1d"
},
"kernelspec": {
"display_name": "Python 3.9.4 64-bit ('eemont': conda)",
"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.9.4"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit c5c905b

Please sign in to comment.