如何在Google Earth Engine 中累计CHIRPS 每天提供的每日降雨量?
How to cumulate the daily rainfall provided by CHIRPS daily in Google Earth Engine?
我想把《CHIRPS Daily》提供的GoogleEarth Engine在一个ROI和规定时间段内的每日降水量累加起来,得到如图这样的图表1(时间步长为 1 天)。
你有什么建议吗?
提前谢谢你:)
这是code of CHIRPS daily precipitation Chart
// Select Dates
var startDate = '2021-06-01'
var endDate = '2021-09-01'
// Select Band (precipitation in case of CHIRPS dataset)
var selected_band = 'precipitation'
// create an Image collection
var dataset = ee.ImageCollection('UCSB-CHG/CHIRPS/DAILY')
.filterBounds(Sonipat)
.filter(ee.Filter.date(startDate, endDate))
.select(selected_band)
// Check the count of days for which you want to extract the data
var count = dataset.size();
print("image collection count between selected dates is :", count);
// check the Cumulative rainfall of the region of interest during that period
// an Image will also be displayed which will confirm your Area of Interest
var cumulativeRainfallImage = dataset.sum().clip(Sonipat);
print(cumulativeRainfallImage );
var precipitationVis = {
min: 1.0,
max: 17.0,
palette: ['001137', '0aab1e', 'e7eb05', 'ff4a2d', 'e90000'],
};
Map.setCenter(76, 30, 7);
Map.addLayer(cumulativeRainfallImage , precipitationVis, 'Precipitation');
// Set some Vector Properties to see your shapefile/vector layer
var shown = true; // true or false, 1 or 0
var opacity = 0.8; // number [0-1]
var nameLayer = 'Sonipat'; // string
var visParams = {color: 'Black'}; // dictionary:
Map.addLayer(Sonipat, visParams, nameLayer, shown, opacity);
// Define the chart properties and see the output in the console.
var chart =
ui.Chart.image
.seriesByRegion({
imageCollection: dataset,
band: selected_band,
regions: Sonipat,
reducer: ee.Reducer.mean(),
scale: 5000,
seriesProperty: 'DISTRICT',
xProperty: 'system:time_start'
})
.setOptions({
title: 'Daily CHIRPS Rainfall',
hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
vAxis: {
title: 'Rainfall (mm)',
titleTextStyle: {italic: false, bold: true}
},
lineWidth: 5,
colors: ['CE7E45'],
});
print(chart);
图像将在控制台的右侧面板中生成,
点击右上角的箭头图标后,
您将被重定向到另一个 window,您可以在其中下载 CSV,并稍后累积,
否则将无法获取每日时间步长的图表。
我想把《CHIRPS Daily》提供的GoogleEarth Engine在一个ROI和规定时间段内的每日降水量累加起来,得到如图这样的图表1(时间步长为 1 天)。
你有什么建议吗? 提前谢谢你:)
这是code of CHIRPS daily precipitation Chart
// Select Dates
var startDate = '2021-06-01'
var endDate = '2021-09-01'
// Select Band (precipitation in case of CHIRPS dataset)
var selected_band = 'precipitation'
// create an Image collection
var dataset = ee.ImageCollection('UCSB-CHG/CHIRPS/DAILY')
.filterBounds(Sonipat)
.filter(ee.Filter.date(startDate, endDate))
.select(selected_band)
// Check the count of days for which you want to extract the data
var count = dataset.size();
print("image collection count between selected dates is :", count);
// check the Cumulative rainfall of the region of interest during that period
// an Image will also be displayed which will confirm your Area of Interest
var cumulativeRainfallImage = dataset.sum().clip(Sonipat);
print(cumulativeRainfallImage );
var precipitationVis = {
min: 1.0,
max: 17.0,
palette: ['001137', '0aab1e', 'e7eb05', 'ff4a2d', 'e90000'],
};
Map.setCenter(76, 30, 7);
Map.addLayer(cumulativeRainfallImage , precipitationVis, 'Precipitation');
// Set some Vector Properties to see your shapefile/vector layer
var shown = true; // true or false, 1 or 0
var opacity = 0.8; // number [0-1]
var nameLayer = 'Sonipat'; // string
var visParams = {color: 'Black'}; // dictionary:
Map.addLayer(Sonipat, visParams, nameLayer, shown, opacity);
// Define the chart properties and see the output in the console.
var chart =
ui.Chart.image
.seriesByRegion({
imageCollection: dataset,
band: selected_band,
regions: Sonipat,
reducer: ee.Reducer.mean(),
scale: 5000,
seriesProperty: 'DISTRICT',
xProperty: 'system:time_start'
})
.setOptions({
title: 'Daily CHIRPS Rainfall',
hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
vAxis: {
title: 'Rainfall (mm)',
titleTextStyle: {italic: false, bold: true}
},
lineWidth: 5,
colors: ['CE7E45'],
});
print(chart);
图像将在控制台的右侧面板中生成,
点击右上角的箭头图标后,
您将被重定向到另一个 window,您可以在其中下载 CSV,并稍后累积,
否则将无法获取每日时间步长的图表。