-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsec1.qmd
163 lines (133 loc) · 5.95 KB
/
sec1.qmd
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
# Remote sensing data collection
## Define study area
```{r fig-studyarea, echo=FALSE}
#| fig.cap: The location of study area, West Daly, in Australia
knitr::include_graphics("figures/study_area.jpg")
```
## Collecting bushfire data
::: {.callout-tip title="Aim"}
This code is designed to compute and export the annual burned area from the MODIS MCD64A1 dataset using Google Earth Engine (GEE).
:::
::: {.callout-caution title="Description of steps"}
1. Load the MODIS MCD64A1 burned area dataset from GEE.
2. Define a function to clip and export burned area data by year.
3. Set a time range (January 1st to December 31st of the given year).
4. Filter the dataset for the selected year and extract the burned area information.
5. Apply an aggregation method (e.g., mean) to summarize burned area data.
6. Clip the data to the Region of Interest (ROI).
7. Export the processed burned area data to Google Drive as a GeoTIFF.
8. Loop through the desired years (2023-2024) and execute the function.
:::
```js
// Load the MODIS MCD64A1 dataset
var dataset = ee.ImageCollection("MODIS/061/MCD64A1");
// Define a function to clip the dataset and export it by year
function exportYearlyBurnedArea(year) {
// Create a date range for the specific year
var startDate = ee.Date.fromYMD(year, 1, 1);
var endDate = startDate.advance(1, 'year');
// Filter the dataset for the specific year and clip to the ROI
var yearlyBurnedArea = dataset.filterDate(startDate, endDate)
.select('BurnDate')
.mean() // Or use another appropriate aggregation method
.clip(roi.geometry().bounds());
// Export the processed data
Export.image.toDrive({
image: yearlyBurnedArea,
description: 'BurnedArea_' + year,
scale: 500, // Adjust resolution as needed
region: roi,
fileFormat: 'GeoTIFF'
});
}
// Loop through and export data for the years 2000 to 2023
for (var year = 2023; year <= 2024; year++) {
exportYearlyBurnedArea(year);
}
```
The GEE code link: <https://code.earthengine.google.com/c4c9731308de7f49c6e468c3daa8cb03> .
## Collecting climate data
- **Temperature**
::: {.callout-tip title="Aim"}
This code is designed to compute and export the annual mean temperature from the ERA5-Land Hourly Temperature dataset using GEE.
:::
::: {.callout-caution title="Description of steps"}
1. Load ERA5 hourly temperature data from Google Earth Engine.
2. Define a function to compute the annual mean temperature.
3. Set a time range (January 1st to December 31st of the given year).
4. Filter the dataset for the given year and compute the mean temperature.
5. Convert temperature from Kelvin to Celsius.
6. Clip the data to the ROI.
7. Export the processed temperature data to Google Drive as a GeoTIFF.
8. Loop through the desired years and execute the function.
:::
```js
// Load the ERA5 daily temperature dataset
var dataset = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY");
// Define a function to calculate and export the annual mean temperature
function exportYearlyTemperature(year) {
// Create the date range
var startDate = ee.Date.fromYMD(year, 1, 1);
var endDate = startDate.advance(1, 'year');
// Filter the dataset and compute the annual mean temperature (unit: K)
var yearlyTemperature = dataset.filterDate(startDate, endDate)
.select('temperature_2m')
.mean() // Compute annual mean temperature
.subtract(273.15) // Convert to Celsius
.clip(roi.geometry().bounds());
// Export the result to Google Drive
Export.image.toDrive({
image: yearlyTemperature,
description: 'Tem' + year,
scale: 5000, // ERA5 resolution, recommended 5km (5000m)
region: roi,
fileFormat: 'GeoTIFF'
});
}
// Loop to calculate the annual mean temperature for the years 2000-2024
for (var year = 2002; year <= 2002; year++) {
exportYearlyTemperature(year);
}
```
The GEE code link: <https://code.earthengine.google.com/5a7f743bb1d0bd174f1d199e26dc4d61> .
- **Precipitation**
::: {.callout-tip title="Aim"}
This code is designed to compute and export the annual cumulative precipitation from the CHIRPS 5-day interval precipitation dataset using GEE.
:::
::: {.callout-caution title="Description of steps"}
1. Load CHIRPS 5-day interval precipitation data from Google Earth Engine.
2. Define a function to compute the annual cumulative precipitation.
3. Set a time range (January 1st to December 31st of the given year).
4. Filter the dataset for the given year and compute the total precipitation.
5. Clip the data** to the ROI.
6. Export the processed precipitation data to Google Drive as a GeoTIFF.
7. Loop through the desired years (2000-2024) and execute the function.
:::
```js
// Load the CHIRPS dataset (5-day interval precipitation)
var dataset = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD");
// Define a function to calculate and export the annual cumulative precipitation
function exportYearlyPrecipitation(year) {
// Create the date range
var startDate = ee.Date.fromYMD(year, 1, 1);
var endDate = startDate.advance(1, 'year');
// Filter the dataset and compute the total precipitation for the year
var yearlyPrecipitation = dataset.filterDate(startDate, endDate)
.select('precipitation')
.sum() // Compute annual total precipitation
.clip(roi.geometry().bounds());
// Export the result to Google Drive
Export.image.toDrive({
image: yearlyPrecipitation,
description: 'Pre' + year,
scale: 5000, // CHIRPS resolution (~5.5 km), adjustable
region: roi,
fileFormat: 'GeoTIFF'
});
}
// Loop to compute annual cumulative precipitation for the years 2000-2024
for (var year = 2000; year <= 2024; year++) {
exportYearlyPrecipitation(year);
}
```
The GEE code link: <https://code.earthengine.google.com/e8b09a65c7d506243e0895d7b6af4e41> .