...

var

by user

on
Category: Documents
6

views

Report

Comments

Description

Transcript

var
Monitoraggio Geodetico e
Telerilevamento
EarthEngine exercizes
Carla Braitenberg
Dip. Matematica e Geoscienze
Universita’ di Trieste
[email protected]
Tel. 339 8290713 Tel. Assistente Dr. Nagy: 040 5582257
Please follow the next scripts
• https://code.earthengine.google.com/
5 may 2016 start
var srtm = ee.Image("USGS/SRTMGL1_003");
Map.addLayer(srtm, {min:0, max:3000});
Script 2
•
•
•
// String objects can also start and end with double quotes.
// But don't mix and match them.
var my_other_variable = "I am also a string";
•
•
// Statements should end in a semi-colon, or the editor complains.
var test = 'I feel incomplete...'
•
•
// Parentheses are used to pass parameters to functions.
print('This string will print in the Console tab.');
•
•
•
•
•
•
•
•
•
•
•
•
// Square brackets are used for selecting items within a list.
// The zero index refers to the first item in the list.
var my_list = ['eggplant', 'apple', 'wheat'];
print(my_list[0]);
var the_answer=42;
// Curly brackets (or braces) can be used to define dictionaries (key:value pairs)
var my_dict = {'food':'bread', 'color':'red', 'number':the_answer};
// Square brackets can be used to access dictionary items by key.
print(my_dict['number']);
print(my_dict['color']);
// Or you can use the dot notation to get the same result.
print(my_dict.color);
•
•
•
•
•
// Functions can be defined as a way to reuse code and make it easier to read
var my_hello_function = function(string) {
return 'Hello ' + string + '!';
};
print(my_hello_function('world'));
Script 3
• var srtm = ee.Image("USGS/SRTMGL1_003");
var slope = ee.Terrain.slope(srtm);
• Map.addLayer(srtm, {min:0, max:3000}, 'DEM');
• Map.addLayer(slope, {min:0, max:10}, 'slope');
Script 4
• var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
• var images = landsat8.filterDate('2015-04-01', '2015-04-06');
• Map.addLayer(images);
Per esercizio: variare i periodi temporali
Consultare l proprieta’ del database Landsat8
Variare le bande rappresentate
5 may 2016 end. 11 and 12 may 2016 GPS exercizes
Script 4
• var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
• var images = landsat8.filterDate('2015-04-01', '2015-04-06');
• Map.addLayer(images);
Per esercizio: variare i periodi temporali
Consultare le proprieta’ del database Landsat8.
Caricare un altro database, per esempio sentinel 2 o landsat 7. Confrontare
con le proprieta’ di landsat 7. Attenzione a scegliere le date opportune
avendo controllato la copertura sulla documentazione.
Script 5
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
var images = landsat8.select(['B2','B3','B4','B5'], ['B','G','R','N']);
images = images.filterDate('2015-04-01', '2015-04-06');
Map.addLayer(images, rgb_viz, 'True Color');
Script 6 Median
var landsat8 =
ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
var images = landsat8.select(['B2','B3','B4','B5'],
['B','G','R','N']);
images = images.filterDate('2015-04-01', '2015-10-06');
Map.addLayer(images, rgb_viz, 'True Color');
Map.addLayer(images.median(), rgb_viz, 'True Color
median');
Script 7 Sentinel
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var s2 = ee.ImageCollection("COPERNICUS/S2");
var geometry = /* color: 0000ff */ee.Geometry.Point([13, 45.5]);
// // Landsat 8
// var images = landsat8.select(['B2','B3','B4','B5'], ['B','G','R','N']);
// var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
// Sentinel 2
var images = s2.select(['B2','B3','B4','B8'], ['B','G','R','N']);
var rgb_viz = {min:0, max:2000, bands:['R','G','B']};
//images = images.filterDate('2015-08-01', '2015-12-11');
images = images.filterBounds(geometry);
var sample = ee.Image(images.first());
Map.addLayer(sample, rgb_viz, 'sample');
Map.addLayer(images.median(), rgb_viz, 'True Color median');
End 18 may 2016
Script 8 sentinel Min-max
•
•
•
•
•
•
•
•
var s2toa = ee.ImageCollection("COPERNICUS/S2");
var rgb_viz = {min:0, max:2000, bands:['R','G','B']};
var s2 = s2toa.select(['B2','B3','B4','B5'], ['B','G','R','N'])
.filterDate('2016-01-26', '2016-04-28');
print(s2.size());
Map.addLayer(s2, rgb_viz, 'RGB');
Map.addLayer(s2.max(), rgb_viz, 'max');
Map.addLayer(s2.min(), rgb_viz, 'min');
Script 9 NDVI
• var s2toa = ee.ImageCollection("COPERNICUS/S2");var
rgb_viz = {min:0, max:2000, bands:['R','G','B']};
• var s2 = s2toa.select(['B2','B3','B4','B5'], ['B','G','R','N'])
•
.filterDate('2016-01-26', '2016-04-28');
• print(s2.size());
• Map.addLayer(s2, rgb_viz, 'RGB', false);
• var image = s2.min();
• Map.addLayer(image, rgb_viz, 'image');
• var ndvi = image.normalizedDifference(['N', 'R']);
• var ndwi_viz = {min:0, max:0.3, palette:'black,green'};
• Map.addLayer(ndvi, ndwi_viz, 'NDVI');
Script 10 sediment identification
Example from Caribbean Sea. The problem is to identify the sediment input from the
River and detect the seasonal changes of the size and form of the sediment cloud.
This is done from multispectarl Landsat images.
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA"),
landsat7 = ee.ImageCollection("LANDSAT/LE7_L1T_TOA");
var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
var rgb_viz1 = {min:0, max:0.3, bands:['B','G','N']};
var images = landsat8.select(['B2','B3','B5','B4'], ['B','G','N','R']);
var images7 = landsat7.select(['B1','B2','B4','B3'], ['B','G','N','R']);
var geometry = /* color: 0000ff */ee.Geometry.Point([-75, 11]);
images = images.filterDate('2015-04-01', '2015-04-06');
images = images.filterBounds(geometry);
images7 = images7.filterDate('2000-04-01', '2000-12-30');
images7 = images7.filterBounds(geometry);
Map.addLayer(images, rgb_viz, 'True Color L8');
Map.addLayer(images, rgb_viz1, 'False Color L8');
Map.addLayer(images7, rgb_viz, 'True Color L7');
Map.addLayer(images7, rgb_viz1, 'False Color L7');
May 19, 2016
False color image compared to true image Landsat 8
(april 2015
Landsat 7 April 2000
sediment identification by histogram analysis
The histograms were generated in Earth Engine for the caribbean Sea
Water with sediments
Water without sediments
Distinction of water covered areas from land areas
• Modiying the bands used for the false images
we can distinguish water covered areas better
from land areas.
• This can be accomplished by using the bands
Script 11 Distinguish water from land covered areas
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
var rgb_viz1 = {min:0, max:0.3, bands:['B5','B6','B7']};
var images = landsat8.select(['B2','B3','B5','B4'], ['B','G','N','R']);
var images_water = landsat8.select(['B5','B6','B7']);
var geometry = ee.Geometry.MultiPoint([12, 45,14,46]);
images = images.filterDate('2015-04-01', '2015-04-30');
images = images.filterBounds(geometry);
images_water = images_water.filterDate('2015-04-01', '2015-04-30');
images_water = images_water.filterBounds(geometry);
Map.addLayer(images, rgb_viz, 'True Color L8');
Map.addLayer(images_water.min(), rgb_viz1, 'False Color L8');
Laguna Grado- false colors Landsat8
Script 12 Birth of an Island
• Between September and October 2013 in the Red Sea
an Island was born. This can be well seen in the
Landsat 8 images. To enhance the signal we display
both the true color and the false color image before
and after the appearance of the island.
• The approximate coordinate of the area of interest is
the following: Long 42.1367,15.0960
• Reference:
http://www.nature.com/ncomms/2015/150526/ncom
ms8104/pdf/ncomms8104.pdf
•
•
•
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA"), geometry = /* color: ffc82d
*/ee.Geometry.Point([42.136688232421875, 15.095991084505304]);
var rgb_viz = {min:0, max:0.3, bands:['R','G','B']};
var rgb_viz1 = {min:0, max:0.3, bands:['B5','B6','B7']};
•
•
•
•
var images = landsat8.select(['B2','B3','B5','B4'], ['B','G','N','R']);
var images1 = landsat8.select(['B2','B3','B5','B4'], ['B','G','N','R']);
var images_water = landsat8.select(['B5','B6','B7']);
var images_water1 = landsat8.select(['B5','B6','B7']);
•
•
•
•
•
•
•
•
•
var geometry = ee.Geometry.Point([42,15]);
images1 = images1.filterDate('2013-04-01', '2013-07-01');
images1 = images1.filterBounds(geometry);
images = images.filterDate('2013-11-1', '2013-12-30');
images = images.filterBounds(geometry);
images_water1 = images_water1.filterDate('2013-08-01', '2013-09-11');
images_water1 = images_water1.filterBounds(geometry);
images_water = images_water.filterDate('2013-11-1', '2013-12-30');
images_water = images_water.filterBounds(geometry);
•
•
•
•
Map.addLayer(images1.min(), rgb_viz, 'before');
Map.addLayer(images.min(), rgb_viz, 'after');
Map.addLayer(images_water1, rgb_viz1, 'False Color before');
Map.addLayer(images_water, rgb_viz1, 'False Color after');
Island birth in Red Sea
BEFORE
AFTER
images1.filterDate('2013-04-01', '2013-07-01'); images.filterDate('2013-11-1', '2013-12-30');
Landsat 8. Bands 'B5','B6','B7
Fly UP