I'm having some trouble for a project work. I have to calculate NDVI for a specific area of the Apulia region, South Italy, using images from Sentinel 2 satellite and Python language.
In order to accomplish the task, I thought of dividing the workflow in these steps:
- create a ROI
- take the image collection from the satellite
- export the collection into the RGB bands (B4, B3, B2) in GEOTIFF format
- export the collection into the NIR band (B8) in GEOTIFF format
- use the SNAP tool to calculate the NDVI
First of all, my first problem is that I must insert my ROI (Geometry.Polygon) inline, otherwise I will have a completely blank image. How could I resolve this and have a variable "roi" so I can use the filterBounds command? (The code is shown below)
Then, how could I export the image as said before?
ee.mapclient.centerMap(15.7151226, 41.5049459, 11)
collection = (ee.ImageCollection('COPERNICUS/S2')
.filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE", 10))
.filterDate('2018-05-01', '2018-10-30')
.filterBounds(ee.Geometry.Polygon([
[15.031742, 41.736782], [16.152907, 41.736782],
[15.031742, 41.321053], [16.152907, 41.321053]]))
)