-
Notifications
You must be signed in to change notification settings - Fork 0
/
RFP
253 lines (220 loc) · 7.89 KB
/
RFP
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var geometry = /* color: #98ff00 */ee.Geometry.MultiPoint(
[[-60.83686853274497, -17.694779052071606],
[-56.57417322024497, -21.318533135869046]]);
/***** End of imports. If edited, may not auto-convert in the playground. *****/
var start = ee.Date('2019-01-01');
var finish = ee.Date('2019-01-02');
var bbox = ee.Geometry.Rectangle({coords:[-168.199948,-55.877669,-30.412549,71.462030],geodesic:false});
var biomass = ee.Image('WHRC/biomass/tropical').select('Mg');
print(biomass,'biomass');
var burnt = ee.ImageCollection("MODIS/006/MCD64A1").select('BurnDate').filterDate(start,finish).mean();
print(burnt,'burnt');
var mask = burnt.gt(1);
burnt=burnt.updateMask(mask);
var FIRMS = ee.ImageCollection("FIRMS").filterDate(start,finish);
print(FIRMS,'firms');
// Define a mask to clip the data by.
var ame = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')
.filter(ee.Filter.eq('wld_rgn', 'America'));
print(ame,'america');
//var frp = ee.ImageCollection("NOAA/GOES/16/FDCF").select('Power').filterDate(start,finish).sum();
//var bbox = ame.bounds();
//print(frp,'frp');
var litter = ee.FeatureCollection("users/dsandovalhdh/litter_ame");
print(litter,'litter');
var burnedAreaVis = {
min: 30.0,
max: 341.0,
palette: ['4e0400', '951003', 'c61503', 'ff1901'],
};
Map.addLayer(burnt, burnedAreaVis, 'burnedAreaVis');
//aggregation to yearly
var frp_yr = ee.List.sequence(0, 3).map(function(n) { // .sequence: number of years from starting year to present
var start = ee.Date('2017-01-01').advance(n, 'year'); // Starting date
var end = start.advance(1, 'year'); // Step by each iteration
// 900 secs per 15 min
var frp = ee.ImageCollection('NOAA/GOES/16/FDCF')
.filterDate(start, end).filterBounds(bbox)
.select('Power').map(function(img) {
return img.toFloat().multiply(900);
}).sum()
.reproject('EPSG:4326', null, 1000).toFloat().set('date',start)
;
//how many readings >0?
var frps= ee.ImageCollection('NOAA/GOES/16/FDCF')
.filterDate(start, end).filterBounds(bbox)
.select('Power')
.map(function(img) {
var mask = img.gt(1);
return img.toFloat().updateMask(mask);
})
.set('date',start)
;
var nreadings= frps.count().toFloat().reproject('EPSG:4326', null, 1000);
var laimax = ee.ImageCollection("MODIS/006/MYD15A2H")
.select('Lai_500m').filterBounds(bbox)
.filterDate(start,end)
.max().multiply(0.1)
.set('date', start);
var laimin = ee.ImageCollection("MODIS/006/MYD15A2H")
.select('Lai_500m')
.filterDate(start,end)
.min().multiply(0.1)
.set('date', start);
var dlai = laimax.subtract(laimin).toFloat().reproject('EPSG:4326', null, 1000);
var gpp = ee.ImageCollection("MODIS/006/MOD17A2H")
.select('Gpp').filterBounds(bbox)
.filterDate(start,end)
.sum().multiply(0.0008)
.set('date', start).toFloat().reproject('EPSG:4326', null, 1000);
var aet = ee.ImageCollection("MODIS/006/MOD16A2")
.select('ET').filterBounds(bbox)
.filterDate(start,end)
.sum().multiply(0.8)
.set('date', start);
var pet = ee.ImageCollection("MODIS/006/MOD16A2")
.select('PET').filterBounds(bbox)
.filterDate(start,end)
.sum().multiply(0.8)
.set('date', start);
var alph= aet.divide(pet).toFloat().reproject('EPSG:4326', null, 1000);
return frp.addBands(dlai).addBands(alph).addBands(gpp);
//return dlai.addBands(alph).addBands(gpp);
//return frp;
});
frp_yr = ee.ImageCollection(frp_yr);
print(frp_yr,'fre');
var values = frp_yr.map(function(image) {
return image.reduceRegions({
collection: litter,
reducer: ee.Reducer.mean(),
crs :'EPSG:4326',
scale: 1000,
tileScale :8
})});
// console.log(values);
Export.table.toDrive(values,
"Fire_analysis",
"ROS_cor",
"ROS_cor");
//Map.addLayer(ee.Image(frp_yr.get(0)).select('Power'),burnedAreaVis, 'burnedAreaVis');
/*
var values = frp_yr.map(function(image) {
return image.reduceRegions({
collection: litter,
reducer: ee.Reducer.mean(),
crs :'EPSG:4326',
scale: 1000,
tileScale :8
}).map(function(feature) {
// Add some identifying information from the image.
return feature.set('date', image.get('date'));
});
});
// Export the image, specifying scale and region.
Export.image.toDrive({
image: burnt,
description: 'burnt_2019',
scale: 10000,
region: bbox
});
/*
var frp = ee.ImageCollection("NOAA/GOES/16/FDCF").select('Power').filterDate(start,finish).map(function(img) {
var mask = img.gt(1);
return img.updateMask(mask);
});
print(frp,'frp');
var firesVis = {
min: 1000,
max: 20000,
palette: ['red', 'orange', 'yellow'],
};
Map.addLayer(burnt, burnedAreaVis, 'burnedAreaVis');
Map.addLayer(frp, firesVis, 'frp');
Map.addLayer(litter);
/*
var monthly_evi = ee.List.sequence(0, 11).map(function(n) { // .sequence: number of months from starting year to present
var start = ee.Date('2011-01-01').advance(n, 'month'); // Starting date
var end = start.advance(1, 'month'); // Step by each iteration
var eviterr = ee.ImageCollection("MODIS/006/MOD13Q1")
.select('EVI')
.filterDate(start,end)
.mean().multiply(0.0001)
.set('date', start);
var eviaqua = ee.ImageCollection("MODIS/006/MYD13Q1")
.select('EVI')
.filterDate(start,end)
.mean().multiply(0.0001)
.set('date', start);
var lai = ee.ImageCollection("MODIS/006/MYD15A2H")
.select('Lai_500m')
.filterDate(start,end)
.mean().multiply(0.1)
.set('date', start);
var evi = eviterr.add(eviaqua).divide(2).set('date', start);
return evi.addBands(lai);
});
monthly_evi = ee.ImageCollection(monthly_evi);
print(monthly_evi,'evi');
var palsar = ee.ImageCollection("JAXA/ALOS/PALSAR/YEARLY/SAR")
.select('HH','HV')
.filterDate(ee.Date('2009-01-01'),ee.Date('2009-12-12')).
palsar = ee.Image(palsar)
.pow(2).log10().multiply(10).subtract(83);
print(palsar,'sar');
var strct = biomass.addBands(palsar);
print(strct,'structure');
var visParams = {
min: 0.0,
max: 350.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
//Map.setCenter(-69.43, 0.35, 3);
var shapes = ee.FeatureCollection("users/dsandovalhdh/fire_perimeter_2011");
Map.addLayer(biomass, visParams, 'Aboveground Live Woody Biomass');
var gpp = ee.ImageCollection("CAS/IGSNRR/PML/V2")
.filterDate(start, end)
.select('GPP').map(function(img) {
return img.multiply(8);
})
.sum().toFloat()
.set('date',start)
;
var ec = ee.ImageCollection("CAS/IGSNRR/PML/V2")
.filterDate(start, end)
.select('Ec').map(function(img) {
return img.multiply(8);
})
.sum().toFloat()
.set('date',start)
;
var es = ee.ImageCollection("CAS/IGSNRR/PML/V2")
.filterDate(start, end)
.select('Es').map(function(img) {
return img.multiply(8);
})
.sum().toFloat()
.set('date',start)
;
var ei = ee.ImageCollection("CAS/IGSNRR/PML/V2")
.filterDate(start, end)
.select('Ei').map(function(img) {
return img.multiply(8);
})
.sum().toFloat()
.set('date',start)
;
var et = ee.ImageCollection("CAS/IGSNRR/PML/V2")
.filterDate(start, end)
.select('ET_water').map(function(img) {
return img.multiply(8);
})
.sum().toFloat()
.set('date',start)
;
*/