Skip to content
Snippets Groups Projects
Commit aecb0b5c authored by Dr. Matthias Baumann's avatar Dr. Matthias Baumann
Browse files

Small Landsat tool

parent 2b187f87
Branches main
No related tags found
No related merge requests found
%% Cell type:code id:bc8ef65c-d244-4450-a735-6bca65944ec1 tags:
``` python
import ee
import geemap
import eemont
ee.Initialize()
```
%% Cell type:code id:943b80fa-eeab-4865-b297-11cee3fca3bb tags:
``` python
import sys
sys.path.append('D:/OneDrive - Conservation Biogeography Lab/_RESEARCH/baumiTools20/') # map the path where the module file is located
from tools import *
```
%% Cell type:markdown id:68d406be-38db-47f5-93e8-f8e7e5577352 tags:
# Quick setup for exporting some Landsat STMs from GEE using manually digitized polygons
* Open a Map Layer, manually draw a SMALL rectangle, save it
* Overlay the desired collection, use the geemap function to download the file. **Works only with small extents**
%% Cell type:code id:fc56e414-5f80-4a3d-87e3-5d721949d8b8 tags:
``` python
# Version II
Map_01 = geemap.Map(zoom=4)
Map_01.add_tile_layer("https://tiles.planet.com/basemaps/v1/planet-tiles/global_quarterly_2020q4_mosaic/gmap/{z}/{x}/{y}.png?api_key=a45e0fc148ed44d18b34b5e14ae0ed61", name='Planet 2020-Q4')
Map_01
```
%% Output
%% Cell type:code id:15518682-aaf9-4f68-9563-58d1f869ca64 tags:
``` python
rect = Map_01.draw_last_feature
aoi = rect.geometry()
```
%% Cell type:code id:486a962b-4249-4bf9-82c0-a6f234bcb76b tags:
``` python
img = GetL8_9LandsatCollection(aoi, 2022).reduce(ee.Reducer.mean().unweighted()).clip(aoi)
Map_01.addLayer(img, {'bands': ['R_mean', 'G_mean', 'B_mean'], 'min': 0, 'max': 0.2, 'gamma': 0.9}, 'Landsat')
```
%% Cell type:code id:c52ffd9b tags:
``` python
outPath = "D:/LandsatSnippets/"
fileName = outPath + "arg11.tif"
geemap.ee_export_image(img, filename=fileName, scale=30, region=aoi, file_per_band=False)
```
%% Output
Generating URL ...
Downloading data from https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/adc95fc72fef57656fcefa661b0e9a29-fb297ec477977a168aaf4b4a2a44f7ce:getPixels
Please wait ...
Data downloaded to D:\LandsatSnippets\arg11.tif
%% Cell type:code id:6a03d83d-94e6-4dab-907e-8f2b4822c592 tags:
``` python
```
......@@ -32,7 +32,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "39e9659db587478c9df52ab219e93de0",
"model_id": "ea5f01af396c4dfab52872c28ffa1b1c",
"version_major": 2,
"version_minor": 0
},
......@@ -233,9 +233,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "py310",
"language": "python",
"name": "python3"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment