TransWikia.com

Downloading RGB Sentinel-2 with Google Earth Engine and Python

Geographic Information Systems Asked on June 3, 2021

I am fairly new to the Google Earth Engine platform, and I want to create a dataset for my machine learning project using the aforesaid platform. As far I have this code for downloading a single picture:

import ee
 
# Trigger the authentication flow.
ee.Authenticate()
 
# Initialize the library.
ee.Initialize()

geoJSON = ... # coordinates of rectangle
coords = geoJSON['features'][0]['geometry']['coordinates']
aoi = ee.Geometry.Polygon(coords)

ffa_db = ee.Image(ee.ImageCollection('COPERNICUS/S1_GRD') 
                       .filterBounds(aoi) 
                       .filterDate(ee.Date('2020-08-01'), ee.Date('2020-08-31')) 
                       .first() 
                       .clip(aoi))

url = ffa_db.select('VV').getThumbURL({'min': -20, 'max': 0})

After that, I just download a file with this command: !wget {url} (From Jupyter Notebook)
The question is fairly simple, but I had much struggled with it due to the lack of Pythonic ways of doing such things. I searched GEE Community tutorials and Github, but have no luck with them.

How can I download RGB images from Sentinel-2 using Python?

Better to download to a local directory rather than a Google disk.

One Answer

You could try to define visualization parameters and then make a new variable where you add the visualization. It would look something like this:

var vis = {
  min: 0,
  max: 3000,
  bands:['B4','B3','B2'],
};          

var ffa_db_new = ffa_db.visualize(vis);

And then you export the new variable ffa_db_new instead of the old one.

Correct answer by Sciencegeek on June 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP