mirror of
https://github.com/google/earthengine-api.git
synced 2025-12-08 19:26:12 +00:00
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
#!/usr/bin/env python
|
|
"""HDR Landsat.
|
|
|
|
Display portions of an image with different dynamic ranges.
|
|
The land areas are displayed normally, but the water areas
|
|
are streched to show more details.
|
|
"""
|
|
|
|
import datetime
|
|
import ee
|
|
import ee.mapclient
|
|
|
|
ee.Initialize()
|
|
ee.mapclient.centerMap(-95.738, 18.453, 9)
|
|
|
|
# Filter the LE7 collection to a single date.
|
|
collection = (ee.ImageCollection('LE7_L1T')
|
|
.filterDate(datetime.datetime(2002, 11, 8),
|
|
datetime.datetime(2002, 11, 9)))
|
|
image = collection.mosaic().select('B3', 'B2', 'B1')
|
|
|
|
# Display the image normally.
|
|
ee.mapclient.addToMap(image, {'gain': '1.6, 1.4, 1.1'}, 'Land')
|
|
|
|
# Add and stretch the water. Once where the elevation is masked,
|
|
# and again where the elevation is zero.
|
|
elev = ee.Image('srtm90_v4')
|
|
mask1 = elev.mask().eq(0).And(image.mask())
|
|
mask2 = elev.eq(0).And(image.mask())
|
|
ee.mapclient.addToMap(
|
|
image.mask(mask1), {'gain': 6.0, 'bias': -200}, 'Water: Masked')
|
|
ee.mapclient.addToMap(
|
|
image.mask(mask2), {'gain': 6.0, 'bias': -200}, 'Water: Elev 0')
|