Download presentation
Presentation is loading. Please wait.
Published byNicola Moretti Modified over 6 years ago
1
Monitoraggio Geodetico e Telerilevamento EarthEngine exercizes
Carla Braitenberg Dip. Matematica e Geoscienze Universita’ di Trieste Tel Tel. Assistente Dr. Nagy:
2
Please follow the next scripts
Javascript Reference:
3
Script 00 introduction to scripter language
// 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'));
4
Script 00-Continues introduction to scripter language
// define sum and multiplication in function var my_sum_function = function(s1,s2) { var t3=[s1+s2, s1*s2] return t3; }; print(my_sum_function(2,3)); Access other possible numerical operations: Create object of type number in ee: s1=1.3 var t5 = ee.Number(s1) Call the method cos which you find in the documentation Docs for the object ee.Number: var t6 = t5.cos() Equivalent: Var t6=ee.Number(s1).cos() Equivalent- basic Javascript instructions (see Javascript guide): Var t6=Math.cos(s1)
5
01 Script var srtm = ee. Image("USGS/SRTMGL1_003"); Map
01 Script var srtm = ee.Image("USGS/SRTMGL1_003"); Map.addLayer(srtm, {min:0, max:3000});
6
02 script // Using mathematical functions
// 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')); // define sum and multiplication in function var my_sum_function = function(s1,s2) { var t3=[s1+s2, s1*s2] return t3 print(my_sum_function (4,5)) var t4= s1+s2 var t3 =s1*s2 var t5 = ee.Number(s1) var t6 = t5.cos() return [t3,t4,t6]; var tg = my_sum_function(2,3); print(tg) // useful sometimes: get present date: var d = new Date(); print(d)
7
Script 03 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'); ee.Terrain.slope(): Calculates slope in degrees from a terrain DEM. The local gradient is computed using the 4-connected neighbors of each pixel, so missing values will occur around the edges of an image. Arguments: input (Image):An elevation image, in meters. Returns: Image
8
Script 03 continues var srtm = ee.Image("USGS/SRTMGL1_003");
// we compure the slope explicitly // Compute the image gradient in the X and Y directions. var xyGrad = srtm.gradient(); // Compute the magnitude of the gradient. var gradient = xyGrad.select('x').pow(2) .add(xyGrad.select('y').pow(2)).sqrt(); // Compute slope angle in radians var slope1 = gradient.atan(); // Compute the slope angle in degrees using an expression. var slopedeg = slope1.expression( '180*1.0/ *sl', { 'sl': slope1 }); // Compute the direction of the gradient in radians var direction = xyGrad.select('y').atan2(xyGrad.select('x')); // Display the results. Map.setCenter(12, 45, 10); Map.addLayer(direction, {min: -2, max: 2, format: 'png'}, 'direction'); Map.addLayer(gradient, {min:-0.01, max: 0.02, format: 'png'}, 'gradient'); Map.addLayer(slopedeg, {min:0, max: 10, format: 'png'}, 'slope1');
9
Script 04 var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var images = landsat8.filterDate(' ', ' '); Map.addLayer(images); Dettagli sulla missione Landsat Vedi documentazione della NASA Esempi di immagini a diverse bande di frequenza:
10
Landsat8 - summary Landsat 8 launched on February 11, 2013, from Vandenberg Air Force Base, California, on an Atlas-V 401 rocket, with the extended payload fairing
(EPF) from United Launch Alliance, LLC. The Landsat 8 satellite payload consists of two science instruments—the Operational Land Imager (OLI) and the Thermal Infrared Sensor (TIRS). These two sensors provide seasonal coverage of the global landmass at a spatial resolution of 30 meters (visible, NIR, SWIR); 100 meters (thermal); and 15 meters (panchromatic). Landsat 8 instruments represent an evolutionary advance in technology. OLI improves on past Landsat sensors. OLI is a push-broom sensor with a four-mirror telescope and 12-bit quantization. OLI collects data for visible, near infrared, and short wave infrared spectral bands as well as a panchromatic band. It has a five-year design life. The graphic below compares the OLI spectral bands to Landsat 7′s ETM+ bands. OLI provides two new spectral bands, the coastal band (band 1) and a cirrus cloud band (band 9),
11
Comparison of spectral bands of Landsat 8 and Landsat 7
12
Landsat 1 Landsat 1 Launch Date: July 23, 1972
Status: expired, January 6, 1978 Sensors: RBV, MSS Altitude: nominally 900 km Inclination: 99.2° Orbit: polar, sun-synchronous Equatorial Crossing Time: nominally 9:42 AM mean local time (descending node) Period of Revolution : 103 minutes; ~14 orbits/day Repeat Coverage : 18 days
13
Script 04 var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA");
var images = landsat8.filterDate(' ', ' '); 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.
14
Script 04 var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA"); var images = landsat8.filterDate(' ', ' '); Map.addLayer(images); Ispezionare le proprieta’ della figura in scala di grigi nel menu “Inspector” Nell’imagine sono sovrapposte tutte le bande facenti parte della collezione. Nel prossimo script selezioniamo le bande del visibile e dell’infrarosso.
15
Script 05 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:['B','G','R']}; var images = landsat8.select(['B2','B3','B4','B5'], ['B','G','R','N']); images = images.filterDate(' ', ' '); Map.addLayer(images, rgb_viz, 'True Color'); Map.addLayer(images, rgb_viz1, 'False Color');
16
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(' ', ' '); Map.addLayer(images, rgb_viz, 'True Color'); Map.addLayer(images.median(), rgb_viz, 'True Color median'); Next to median, you have also: mode and mean. Median: Middle value separating the greater and lesser halves of a data set Mode: Most frequent value in a data set Mean: Sum of values of a data set divided by number of values
17
Script 7 Sentinel var geometry = /* color: 0000ff */ee.Geometry.Point([13, 45.5]); var sentinel2 = ee.ImageCollection("COPERNICUS/S2"); var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA"); var rgb_viz = {min:0, max:0.3, bands:['R','G','B']}; var rgb_viz2 = {min:0, max:2000, bands:['R','G','B']}; var images = landsat8.select(['B2','B3','B4','B5'], ['B','G','R','N']); var images2 = sentinel2.select(['B2','B3','B4','B5'], ['B','G','R','N']); images = images.filterDate(' ', ' '); images2 = images2.filterDate(' ', ' '); Map.addLayer(images, rgb_viz, 'True Color'); Map.addLayer(images2, rgb_viz2, 'True Color sentinel'); Map.addLayer(images.median(), rgb_viz, 'True Color median');
18
Script 7 Sentinel- filter on location
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(' ', ' '); 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');
19
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(' ', ' '); print(s2.size()); Map.addLayer(s2, rgb_viz, 'RGB'); Map.addLayer(s2.max(), rgb_viz, 'max'); Map.addLayer(s2.min(), rgb_viz, 'min');
20
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(' ', ' '); 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.2, max:0.2, palette:'black,green'}; Map.addLayer(ndvi, ndwi_viz, 'NDVI'); NDVI=(NIR-Red)/(NIR+Red) Normalized Difference vegetation Index
21
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(' ', ' '); images = images.filterBounds(geometry); images7 = images7.filterDate(' ', ' '); 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');
22
False color image compared to true image Landsat 8 (april 2015
23
Landsat 7 April 2000
24
sediment identification by histogram analysis
The histograms were generated in Earth Engine for the caribbean Sea Water with sediments Water without sediments
25
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
26
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(' ', ' '); images = images.filterBounds(geometry); images_water = images_water.filterDate(' ', ' '); images_water = images_water.filterBounds(geometry); Map.addLayer(images, rgb_viz, 'True Color L8'); Map.addLayer(images_water.min(), rgb_viz1, 'False Color L8');
27
Laguna Grado- false colors Landsat8
28
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 , Reference:
29
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA"), geometry = /* color: ffc82d */ee.Geometry.Point([ , ]); 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(' ', ' '); images1 = images1.filterBounds(geometry); images = images.filterDate(' ', ' '); images = images.filterBounds(geometry); images_water1 = images_water1.filterDate(' ', ' '); images_water1 = images_water1.filterBounds(geometry); images_water = images_water.filterDate(' ', ' '); 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');
30
Island birth in Red Sea BEFORE AFTER
images1.filterDate(' ', ' '); images.filterDate(' ', ' '); Landsat 8. Bands 'B5','B6','B7
31
Projects of students for final exam year 2016
Ermes zoccolan: ultimi 20 anni su ghiacciai delle Alpi Nicola bruzzese: indice NDVI per osservare di parchi urbani nelle grandi citta’= isole di calore Riccardo minetto: Analisi termica di zona da definire Rudy Conte: indice NDVI nella valle dell’Indo in Pakistan, area desertica Marco Bartola: presenza di metano in Adriatico, se possibile. Oppure Espansione della cementificazione Giulia Areggi: analisi termica in zona vulcanica Gaia Travan: Analisi multispettrale laghi per inquinamento Elisa Venturini: analisi dei sedimenti del volga in mar caspio. Oppure slope analisi di topografia SRTM in area alpina. Andrea Geniram: variazione di paesaggio in zone colpite da incendi.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.