Exemplo n.º 1
0
def get_sentinel(
    product: str,
    aoi,
    start_date: str,
    end_date: str,
    bands=["B2", "B3", "B4", "B8"],
    export=False,
):

    kenya_region = region_to_polygon(get_kenya())
    col = (ee.ImageCollection(product).filterBounds(
        kenya_region.getInfo()['coordinates']).filterDate(
            start_date, end_date).map(sentinel_cloud_mask))
    mosaic = ee.ImageCollection([col.select(bands)]).mosaic()

    if export is False:
        return mosaic

    # do the export
    task_config = {
        "description": "imageToDriveExample",
        "scale": 30,
        "crs": "EPSG:4326",
    }
    task = (batch.Export.image.toDrive(mosaic, "00_exported_image",
                                       task_config))

    task.start()
Exemplo n.º 2
0
import ee
from GEExarray.lib.make_bounds import get_kenya, region_to_polygon

polygon = region_to_polygon(get_kenya())
bounds = polygon.bounds()

landsat_collection = (ee.ImageCollection('LANDSAT/LE07/C01/T1').filterDate(
    '2018-06-01', '2018-06-11').filterBounds(bounds))

modis_collection = (ee.ImageCollection('MODIS/006/MOD09A1').filterDate(
    '2015-12-31', '2016-8-4').filterBounds(bounds))

image = landsat_collection.first()
date = ee.Date(collection.first().get('system:time_start'))
date_dict = date.format('Y-MM-dd').getInfo()
Exemplo n.º 3
0
import ee
# import ee.mapclient
from GEExarray.lib.make_bounds import get_kenya, region_to_polygon

region = get_kenya()
bounds = region_to_polygon(region)
"""
[[33.501, -5.202],
   [42.283, -5.202],
   [42.283, 6.002],
   [33.501, 6.002],
   [33.501, -5.202]]
"""

landsat_collection = (ee.ImageCollection('LANDSAT/LE07/C01/T1').filterDate(
    '2000-06-01', '2000-06-11').filterBounds(bounds))

modis_collection = (ee.ImageCollection('MODIS/006/MOD09A1').filterDate(
    '2016-1-31', '2016-8-4').filterBounds(bounds))

# listOfImages = modis_collection.toList(modis_collection.size());
# image_first = ee.Image(listOfImages.get(0))

#
img = modis_collection.first()
img = img.clip(bounds)

export_region = polygon.getInfo()['coordinates']

task = ee.batch.Export.image.to(
    img,