-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLST Landsat 8
65 lines (54 loc) · 3.48 KB
/
LST Landsat 8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var dataset = ee.Image("USGS/SRTMGL1_003"),
geometry =
/* color: #00ffff */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[-59.751372767456054, -38.51863302951356],
[-59.751372767456054, -38.573678585587004],
[-59.67807335949707, -38.573678585587004],
[-59.67807335949707, -38.51863302951356]]], null, false);
/***** End of imports. If edited, may not auto-convert in the playground. *****/
//LST
var regionJSON = JSON.stringify(geometry.getInfo());
function LST (image){
var RADIANCE_MULT_BAND_10 = ee.Number(image.get('RADIANCE_MULT_BAND_10'));
var RADIANCE_ADD_BAND_10 = ee.Number(image.get('RADIANCE_ADD_BAND_10'));
var K1_CONSTANT_BAND_10 = ee.Number(image.get('K1_CONSTANT_BAND_10'));
var K2_CONSTANT_BAND_10 = ee.Number(image.get('K2_CONSTANT_BAND_10'));
var TOA = image.select('B10').multiply(RADIANCE_MULT_BAND_10).add(RADIANCE_ADD_BAND_10);
var BT = (ee.Image(K2_CONSTANT_BAND_10).divide((ee.Image(K1_CONSTANT_BAND_10).divide(TOA).add(1)).log())).subtract(273.15);
var NDVI = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
var NDVImin = ee.Number(NDVI.reduceRegion(ee.Reducer.min(), geometry).get('NDVI'));
var NDVImax = ee.Number(NDVI.reduceRegion(ee.Reducer.max(), geometry).get('NDVI'));
var PV = ((NDVI.subtract(NDVImin)).divide(ee.Image(NDVImax.subtract(NDVImin)))).pow(2);
var LSE = PV.multiply(0.004).add(0.986);
var TS = BT.divide((BT.divide(1.4388).multiply(0.00115)).multiply(LSE.log()).add(1));
return image.addBands(TS.rename('LST'));
}
var landsat = ee.ImageCollection('LANDSAT/LC08/C01/T1').filterBounds(geometry).filterDate('2010-01-01','2022-01-01').filter(ee.Filter.lt('CLOUD_COVER',1));
var temp = landsat.map(LST).select(['LST']);
var temp_min = temp.reduce(ee.Reducer.percentile([1])).rename('LST_min').clip(geometry);
var dem_pal = ['#333CFF','#FF5733'];
var lst_min = ee.Number(temp_min.reduceRegion({reducer: ee.Reducer.min(),geometry:geometry,maxPixels:1e9,scale:30,}).get('LST_min'));
var lst_max = ee.Number(temp_min.reduceRegion({reducer: ee.Reducer.max(),geometry:geometry,maxPixels:1e9,scale:30,}).get('LST_min'));
print (lst_min);
print (lst_max);
Map.addLayer(temp_min, {min:lst_min.getInfo(), max:lst_max.getInfo(), palette: dem_pal}, 'LST');
Export.image.toDrive({image:temp_min, folder:"earth_engine", description:'LST', scale:30, 'region':geometry});
var title = {title: 'LST',hAxis: {title: 'Tiempo'},vAxis: {title: 'ºC'}};
print(ui.Chart.image.series(temp, geometry).setOptions(title));
var training = temp_min.sample({region:geometry,scale:10,factor:1});
var clusterer = ee.Clusterer.wekaKMeans(5).train(training);
var result = temp_min.cluster(clusterer);
Map.addLayer(result.randomVisualizer(), {}, 'clusters');
var elevation = dataset.select('elevation').clip(geometry);
var p90_lote = ee.Number(elevation.reduceRegion({reducer: ee.Reducer.percentile([90]),geometry:geometry,maxPixels:1e9,scale:30,}).get('elevation'));
var p10_lote = ee.Number(elevation.reduceRegion({reducer: ee.Reducer.percentile([10]),geometry:geometry,maxPixels:1e9,scale:30,}).get('elevation'));
var dem_pal = ['#33E6FF','#734F00'];
Map.addLayer(elevation, {min:p10_lote.getInfo(), max:p90_lote.getInfo(), palette: dem_pal}, 'DEM');
Export.image.toDrive({image: elevation,folder: "earth_engine",description: 'DEM',scale: 30,'region':geometry,});