GEE16: 区域日均降水量计算及分析

2023-11-09 11:20

本文主要是介绍GEE16: 区域日均降水量计算及分析,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Precipitation

    • 1. 区域日均降水量计算
    • 2. 降水时间序列
    • 3. 降水数据年度时间序列对比分析
    • 4. 降水等值线绘制

1. 区域日均降水量计算

今天分析一个计算区域日均降水量的方法:

数据信息:
  Climate Hazards Group InfraRed Precipitation with Station data (CHIRPS) is a 30+ year quasi-global rainfall dataset. CHIRPS incorporates 0.05° resolution satellite imagery with in-situ station data to create gridded rainfall time series for trend analysis and seasonal drought monitoring.

在这里插入图片描述

var startDate = ee.Date('2022-01-01');
var endDate = ee.Date('2023-01-01');// 以重庆为目标
var geometry = ee.FeatureCollection('projects/ee-*****736/assets/Chongqing_Province')
Map.centerObject(geometry,5)
var styling = {color:"red",fillColor:"00000000"}
Map.addLayer(geometry.style(styling),{},"geometry")
var geometry = geometry.geometry()var dataset = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY").filterDate(startDate, endDate);var list_dataset = dataset.toList(dataset.size());
print(list_dataset);// 计算区域内的日平均值
var getPrecipitation = function(image) {var value_precipit = ee.Image(image).reduceRegion(ee.Reducer.mean(), geometry).get('precipitation');var precipit_mm = ee.Number(value_precipit); return precipit_mm;
};// 输出每日平均降水量(mm)
var count = dataset.size();
var precipit_list = dataset.toList(count).map(getPrecipitation);
print("precipitation list", precipit_list);// 输出所有日期
var allDates = ee.List(dataset.aggregate_array('system:time_start'));
var allDatesSimple = allDates.map(function(date){return ee.Date(date).format().slice(0,10);});
print('allDates',allDatesSimple);// 将日期与降水数据组合
var paired = allDatesSimple.zip(precipit_list);
print (paired);var title = {title: 'Daily precipitation',hAxis: {title: 'Time'},vAxis: {title: 'Precipitation (mm)'},
};// 构建日平均降水量图表
var chartDaily = ui.Chart.image.seriesByRegion({imageCollection: dataset, regions: geometry,reducer: ee.Reducer.mean(),band: 'precipitation',scale: 5566,xProperty: 'system:time_start',seriesProperty: 'SITE'
}).setOptions(title).setChartType('ColumnChart');
print(chartDaily);// 将日平均降水量输出CSV文件
var myFeatures = ee.FeatureCollection(paired.map(function(el){el = ee.List(el); // cast every element of the listvar geom = geometry;return ee.Feature(null, {'date': ee.String(el.get(0)),'value':ee.Number(el.get(1))});
}));// Export features, specifying corresponding names.
Export.table.toDrive(myFeatures,
"precipitation", //my task
"GEE_Folder", //my export folder
"daily_precipit",  //file name
"CSV");

结果展示:
在这里插入图片描述

2. 降水时间序列

var geometry = ee.FeatureCollection('projects/ee-*****736/assets/Chongqing_Province')
Map.centerObject(geometry ,6)
var CHIRPS= ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD');var precip = CHIRPS.filterDate('2022-01-01', '2022-12-31');
var precip1year=CHIRPS.filterDate('2020-01-01', '2022-12-31');var TS1 = Chart.image.series(precip, geometry, ee.Reducer.mean(),5566, 'system:time_start').setOptions({title: 'Precipitation Full Time Series',vAxis: {title: 'mm/pentad'},
});
print(TS1);var TS2 = Chart.image.series(precip1year, geometry,  ee.Reducer.mean(),5566, 'system:time_start').setOptions({title: 'Precipitation 1-Year Time Series',vAxis: {title: 'mm/pentad'},
});
print(TS2);

结果展示:

在这里插入图片描述
在这里插入图片描述

3. 降水数据年度时间序列对比分析

// 研究区域边界可视化
var geometry = ee.FeatureCollection('projects/ee-*****736/assets/Chongqing_Province')
Map.centerObject(geometry);
var styling = {color:'red',fillColor:'00000000'}
Map.addLayer(geometry.style(styling),{},'roi')var dataset = ee.ImageCollection('UCSB-CHG/CHIRPS/DAILY').filter(ee.Filter.date('2017-01-01', '2023-10-01')).select('precipitation').filterBounds(geometry).map(function(image){return image.clip(geometry)});var Chart1 = ui.Chart.image.doySeriesByYear({imageCollection:dataset,bandName:'precipitation',region:geometry,regionReducer:ee.Reducer.mean(),scale:5566,
})
print('每年的降水量走势',Chart1)// 计算每月的平均值
// 自行修改起始年份即可
var years = ee.List.sequence(2017, 2023);
var months = ee.List.sequence(1, 12);
var Monthlymean = ee.ImageCollection(years.map(function(y) {return months.map(function(m) {var perc = dataset.filter(ee.Filter.calendarRange(y,y, 'year')).filter(ee.Filter.calendarRange(m, m, 'month')).mean().clip(geometry)return perc.set('system:time_start',ee.Date.fromYMD(y,m,1)).set('system:index',ee.String(ee.Number(y).int()).cat("_").cat(ee.String(ee.Number(m).int())))})}).flatten());
print('月平均数据集',Monthlymean)var Chart2 = ui.Chart.image.doySeriesByYear({imageCollection:Monthlymean,bandName:'precipitation',region:geometry,regionReducer:ee.Reducer.mean(),scale:5566,
})
print('每年的月度降水量走势',Chart2)

结果展示:
每年的降水量走势:
在这里插入图片描述

每年的月度降水量走势:
在这里插入图片描述

4. 降水等值线绘制

var geometry = ee.FeatureCollection('projects/ee-yipeizhao736/assets/Chongqing_Province')
Map.centerObject(geometry,6.5)
var styling = {color:"red",fillColor:"00000000"}
Map.addLayer(geometry.style(styling),{},"geometry")
var geometry = geometry.geometry()// Load the CHIRPS data
var CHIRPS= ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD');// 选择两个研究时间段
var precip = CHIRPS.filterDate('2022-01-01', '2022-12-31');
var precip1year=CHIRPS.filterDate('2020-01-01', '2022-12-31');// 绘制两个时间序列图
var TS1 = Chart.image.series(precip, geometry, ee.Reducer.mean(),5566, 'system:time_start').setOptions({title: '2022 Precipitation Time Series',vAxis: {title: 'mm/pentad'},
});
print(TS1);var TS2 = Chart.image.series(precip1year, geometry,  ee.Reducer.mean(),5566, 'system:time_start').setOptions({title: '2020-2022 Precipitation Time Series',vAxis: {title: 'mm/pentad'},
});
print(TS2);// Short and Long Term Rainfall in MM
var GujaratPrecip1 = precip.sum().clip(geometry);
var GujaratPrecip = precip1year.sum().clip(geometry).multiply(0.33);
Map.addLayer(GujaratPrecip1, {'min': 100, 'max': 3000, 'palette':"f6ffa9,1fe2b5,1da0fd,2b7bf3,141899"},'Short-term Rainfall');
Map.addLayer(GujaratPrecip, {'min': 100, 'max': 3000, 'palette':"f6ffa9,1fe2b5,1da0fd,2b7bf3,141899"},'Long-term Rainfall');
print(GujaratPrecip)// 绘制等值线
var lines = ee.List.sequence(0, 3000, 50);
var contourlines = lines.map(function(line) {var mycontour = GujaratPrecip1.convolve(ee.Kernel.gaussian(5, 3)).subtract(ee.Image.constant(line)).zeroCrossing().multiply(ee.Image.constant(line)).toFloat();return mycontour.mask(mycontour);
})contourlines = ee.ImageCollection(contourlines).mosaic();
Map.addLayer(contourlines, {min: 0, max: 3000, palette:['green', 'red']}, 'Annual Contour Map');

结果展示:

这篇关于GEE16: 区域日均降水量计算及分析的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/375785

相关文章

Python实现精确小数计算的完全指南

《Python实现精确小数计算的完全指南》在金融计算、科学实验和工程领域,浮点数精度问题一直是开发者面临的重大挑战,本文将深入解析Python精确小数计算技术体系,感兴趣的小伙伴可以了解一下... 目录引言:小数精度问题的核心挑战一、浮点数精度问题分析1.1 浮点数精度陷阱1.2 浮点数误差来源二、基础解决

Python文本相似度计算的方法大全

《Python文本相似度计算的方法大全》文本相似度是指两个文本在内容、结构或语义上的相近程度,通常用0到1之间的数值表示,0表示完全不同,1表示完全相同,本文将深入解析多种文本相似度计算方法,帮助您选... 目录前言什么是文本相似度?1. Levenshtein 距离(编辑距离)核心公式实现示例2. Jac

Python中经纬度距离计算的实现方式

《Python中经纬度距离计算的实现方式》文章介绍Python中计算经纬度距离的方法及中国加密坐标系转换工具,主要方法包括geopy(Vincenty/Karney)、Haversine、pyproj... 目录一、基本方法1. 使用geopy库(推荐)2. 手动实现 Haversine 公式3. 使用py

Android 缓存日志Logcat导出与分析最佳实践

《Android缓存日志Logcat导出与分析最佳实践》本文全面介绍AndroidLogcat缓存日志的导出与分析方法,涵盖按进程、缓冲区类型及日志级别过滤,自动化工具使用,常见问题解决方案和最佳实... 目录android 缓存日志(Logcat)导出与分析全攻略为什么要导出缓存日志?按需过滤导出1. 按

Linux中的HTTPS协议原理分析

《Linux中的HTTPS协议原理分析》文章解释了HTTPS的必要性:HTTP明文传输易被篡改和劫持,HTTPS通过非对称加密协商对称密钥、CA证书认证和混合加密机制,有效防范中间人攻击,保障通信安全... 目录一、什么是加密和解密?二、为什么需要加密?三、常见的加密方式3.1 对称加密3.2非对称加密四、

MySQL中读写分离方案对比分析与选型建议

《MySQL中读写分离方案对比分析与选型建议》MySQL读写分离是提升数据库可用性和性能的常见手段,本文将围绕现实生产环境中常见的几种读写分离模式进行系统对比,希望对大家有所帮助... 目录一、问题背景介绍二、多种解决方案对比2.1 原生mysql主从复制2.2 Proxy层中间件:ProxySQL2.3

python使用Akshare与Streamlit实现股票估值分析教程(图文代码)

《python使用Akshare与Streamlit实现股票估值分析教程(图文代码)》入职测试中的一道题,要求:从Akshare下载某一个股票近十年的财务报表包括,资产负债表,利润表,现金流量表,保存... 目录一、前言二、核心知识点梳理1、Akshare数据获取2、Pandas数据处理3、Matplotl

python panda库从基础到高级操作分析

《pythonpanda库从基础到高级操作分析》本文介绍了Pandas库的核心功能,包括处理结构化数据的Series和DataFrame数据结构,数据读取、清洗、分组聚合、合并、时间序列分析及大数据... 目录1. Pandas 概述2. 基本操作:数据读取与查看3. 索引操作:精准定位数据4. Group

MySQL中EXISTS与IN用法使用与对比分析

《MySQL中EXISTS与IN用法使用与对比分析》在MySQL中,EXISTS和IN都用于子查询中根据另一个查询的结果来过滤主查询的记录,本文将基于工作原理、效率和应用场景进行全面对比... 目录一、基本用法详解1. IN 运算符2. EXISTS 运算符二、EXISTS 与 IN 的选择策略三、性能对比

MySQL 内存使用率常用分析语句

《MySQL内存使用率常用分析语句》用户整理了MySQL内存占用过高的分析方法,涵盖操作系统层确认及数据库层bufferpool、内存模块差值、线程状态、performance_schema性能数据... 目录一、 OS层二、 DB层1. 全局情况2. 内存占js用详情最近连续遇到mysql内存占用过高导致