-
Notifications
You must be signed in to change notification settings - Fork 0
/
video_frp
189 lines (154 loc) · 5.05 KB
/
video_frp
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
var utils = require('users/gena/packages:utils');
var text = require('users/gena/packages:text');
var start = ee.Date('2020-09-07');
var finish = ee.Date('2020-09-10');
// Amazon: -60, -21, -56, -17
// US east coast -129.616321,32.849042,-115.957213,49.212594
var bounds = ee.Geometry.Rectangle([-125.216751,38.420277,-117.132287,48.953600], null, true);
var image = ee.Image('NOAA/GOES/16/FDCF/2019167024053900000');
var area = image.select('Area');
var temp = image.select('Temp');
var dqf = image.select('DQF');
var frp = ee.ImageCollection("NOAA/GOES/16/FDCF").select('Power').filterDate(start,finish).filterBounds(bounds);
var dqf = ee.ImageCollection("NOAA/GOES/16/FDCF").select('DQF').filterDate(start,finish).filterBounds(bounds);
//print(dqf,'dqf');
var xmin = -142; // On station as GOES-E
var xmax = xmin + 135;
Map.setCenter((xmin+xmax)/2, 15, 3);
///////////////////////////////////////////////////////////////////////////
//1. define visualization params
////////////////////////////////////////////////////////////////////////
///1.1 burnt area
var DQFVis = {
min: 0,
max: 5,
palette: [
'red', // Good quality fire pixel
'olive', // Good quality fire free land
'dcd159', // Opaque cloud
// Bad surface type, sunglint, LZA threshold exceeded,
'1c0dff', // off earth, or missing input data
'lemonchiffon', // Bad input data
'burlywood' // Algorithm failure
]};
///1.2 frp area
var frpVis = {
min: 0,
max: 2000,
palette: [
'purple', 'cyan', 'green', 'yellow', 'red'
]};
////plot
//Map.addLayer(dqf, DQFVis, 'DQF');
//Map.addLayer(frp, frpVis, 'FRP');
///////////////////////////////////////////////////////////////////////////
//2. make the data 8-bit which is necessary for making a video and add timestamp
// replace frp in frp.map to export burnt area and frpVis
////////////////////////////////////////////////////////////////////////
var animation = dqf.map(function(image){
var start = ee.Date(image.get('system:time_start'));
var end = ee.Date(image.get('system:time_end'));
var label = start.format('YYYY-MM-dd-HH:mm');
return image.visualize(DQFVis).clip(bounds).set({label: label});
});
// annotate
var annotations = [
{
position: 'left', offset: '1%', margin: '1%', property: 'label', scale: Map.getScale()*0.4
}
]
animation = animation.map(function(image) {
return text.annotateImage(image, {}, bounds, annotations)
})
// Define GIF visualization parameters.
var gifParams = {
'region': bounds,
'dimensions': 150,
'framesPerSecond': 60
};
// Print the GIF URL to the console.
print(animation.getVideoThumbURL(gifParams));
// set position of panel
var legend = ui.Panel({
style: {
position: 'bottom-left',
padding: '8px 15px'
}
});
// Create legend title
var legendTitle = ui.Label({
value: 'FRP (MW)',
style: {
fontWeight: 'bold',
fontSize: '18px',
margin: '0 0 4px 0',
padding: '0'
}
});
// Add the title to the panel
legend.add(legendTitle);
// create the legend image
var lon = ee.Image.pixelLonLat().select('latitude');
var gradient = lon.multiply((frpVis.max-frpVis.min)/100.0).add(frpVis.min);
var legendImage = gradient.visualize(frpVis);
// create text on top of legend
var panel = ui.Panel({
widgets: [
ui.Label(frpVis['max'])
],
});
legend.add(panel);
// create thumbnail from the image
var thumbnail = ui.Thumbnail({
image: legendImage,
params: {bbox:'0,0,10,100', dimensions:'10x200'},
style: {padding: '1px', position: 'bottom-center'}
});
// add the thumbnail to the legend
legend.add(thumbnail);
// create text on top of legend
var panel = ui.Panel({
widgets: [
ui.Label(frpVis['min'])
],
});
legend.add(panel);
Map.add(legend);
/*
//Export NDVI from whole study area to video
Export.video.toDrive({
collection: dqf,
description: "fireamazon2019", // Filename, no spaces allowed
framesPerSecond: 10, // I.e., 1 year / second
region: bounds,
scale: 2000, // Scale in m
});
/*
// Fires are small enough that they are difficult to see at the scale of
// an entire GOES image. Buffer fires based on area to make them stand out.
var area = area.reduceToVectors({
geometry: geometry,
scale: 2000,
geometryType: 'centroid',
labelProperty: 'area',
maxPixels: 1e10,
}).map(function(feature){
return feature.buffer(ee.Number(feature.get('area')).add(1).pow(1.76));
});
Map.addLayer(area, {color: 'orange'}, 'area');
// Buffer fires based on temperature to make them stand out.
var temp = temp.reduceToVectors({
geometry: geometry,
scale: 2000,
geometryType: 'centroid',
labelProperty: 'temp',
maxPixels: 1e10,
}).map(function(feature){
return feature.buffer(ee.Number(feature.get('temp')).add(2).pow(1.3));
});
//Map.addLayer(temp, {color: 'red'}, 'temp');.
// Create RGB visualization images for use as animation frames.
var rgbVis = dqf.map(function(img) {
return img.visualize(DQFVis);
});
*/