Google Earth Engine——影像统计过程中出现的空值问题
这里有一个问题,是单单只有一景影像, 但是这里我们需要看代码,代码中利用的函数就是原数据筛选,然后 就是这个函数用的等于,等于的值是单景影像的id
filterMetadata(name, operator, value)
已删除。使用 filter() 与 ee.Filter.eq(), ee.Filter.gte() 等。
通过元数据来过滤一个集合的快捷方式。这相当于this.filter(ee.Filter.metadata(..))。
返回过滤后的集合。
参数。
this:collection(集合)。
集合实例。
name(字符串)。
要过滤的属性名称。
operator (String):
比较运算符的名称。可能的值是。"equals", "less_than", "greater_than",
"not_equals", "not_less_than", "not_greater_than", "start_with",
"end_with", "not_starts_with", "not_ends_with", " contains",
"不包含"。
value(对象)。
- 要比较的值。
返回。集合
所以这里就解释了为啥只有单景影像的第一个问题
这里第二个问题就是我们这里再统计单景影像的函数的时候这里是将统计值返回给一个空的矢量,所以这里并没有将其统计的值给得到,而这里选择的是first,也就是选择的第一个shp矢量这里本身就是一个空值
SCL | Scene Classification Map (The "No Data" value of 0 is masked out) | 1 | 11 | 20 meters | 0 |
Class Table: SCL这里是具体的分类信息
Value | Color | Color Value | Description |
---|---|---|---|
1 | #ff0004 | Saturated or defective | |
2 | #868686 | Dark Area Pixels | |
3 | #774b0a | Cloud Shadows | |
4 | #10d22c | Vegetation | |
5 | #ffff52 | Bare Soils | |
6 | #0000ff | Water | |
7 | #818181 | Clouds Low Probability / Unclassified | |
8 | #c0c0c0 | Clouds Medium Probability | |
9 | #f1f1f1 | Clouds High Probability | |
10 | #bac5eb | Cirrus | |
11 | #52fff9 | Snow / Ice |
SLC波段将去掉0的数据
代码:
//影像筛选这里是单景影像的筛选
var S2 = ee.ImageCollection('COPERNICUS/S2_SR').filterMetadata("system:index", 'equals', '20210705T165901_20210705T165855_T20XNN')// 定义一个云遮蔽函数。
var maskcloud1 = function(image) {var QA60 = image.select(['QA60']);return image.updateMask(QA60.lt(1))
};// 定义一个植被掩蔽函数。这个大家需要去看这个波段的的影像信息
var masklandcover = function(image){var SCL = image.select(['SCL']);return image.updateMask(SCL.eq(4).or(SCL.eq(5)).or(SCL.eq(6)).or(SCL.eq(11)))
}// 选择大于0的
var maskpstv = function(image){var RE = image.select(['AbsError']);return image.updateMask(RE.gte(0))
}//选择小于0的
var maskngtv = function(image){var RE = image.select(['AbsError']);return image.updateMask(RE.lt(0))
}var AbsoluteError_oldc_f = function(image) {return image.expression('((2.5 * (NIR - RED) / (NIR + (6-7.5/2.08)*RED + 1))-(2.5 * (NIR - RED) / (NIR + 6*RED-7.5*BLUE + 1)))',{'NIR': image.select('B8').multiply(0.0001), 'RED': image.select('B4').multiply(0.0001), 'BLUE': image.select('B2').multiply(0.0001),}).rename('AbsError').copyProperties(image, image.propertyNames());
};//利用影像进行上面的map工作
var ImgsMasked = S2.map(maskcloud1).map(masklandcover).map(AbsoluteError_oldc_f);//然后再进行大于和小于的筛选
var ImgsMasked_pstv = ImgsMasked.map(maskpstv)
var ImgsMasked_ngtv = ImgsMasked.map(maskngtv)//求影像的均值
var BecomeTs = function(image){var date = image.get("DATE_ACQUIRED")//.format("Y-M-D");var mean = image.reduceRegion({reducer: ee.Reducer.mean(),geometry: image.geometry(),scale: 10,bestEffort: true});
//
// 并返回一个具有 "null "几何形状的特征,并带有属性(字典)。 return ee.Feature(null, {'mean': mean.get('AbsError'), 'date': date,'geometry':image.geometry().coordinates()})
}print('ImgsMasked_ngtv',ImgsMasked_ngtv)
// There is only one image with name 20210705T165901_20210705T165855_T20XNN
print('Result using map() function', ImgsMasked_ngtv.map(BecomeTs))
// get the mean value -119345390125318.16
print('Result using first() function',BecomeTs(ImgsMasked_ngtv.first()))
// get the mean value null
Google Earth Engine——影像统计过程中出现的空值问题相关推荐
- Google Earth Engine(GEE)中的颜色代码
今天来分享一下Google Earth Engine(GEE)中的各种颜色代码,经常使用的GEE的都想将自己的结果显示到图层,但是找不到合适的颜色,我整理了几乎涵盖所有颜色的代码,供大家使用 var ...
- 在Google Earth Engine(GEE)中利用人口数据进行分析
今天来分享下如何在GEE中利用人口数据进行分析,在GEE调用的数据为"WorldPop/GP/100m/pop" 分析山西省2001年到2020年人口的增长变化情况 GEE调用代码 ...
- GEEer成长日记十七:在Google Earth Engine(GEE)中批量下载MODIS NDVI数据
所使用数据集为:MOD13Q1.006 Terra Vegetation Indices 16-Day Global 250m 需注意的是,要得到真实的NDVI,需要乘以0.0001 完整代码如下: ...
- Google Earth Engine(gee)中的ImageCollection
目录 limit().first() filterBounds().filterDate().filterMetadata() select() map() 获取影像集中的影像数量:size() co ...
- Google Earth Engine(gee)中的FeatureCollection
目录 基本结构 FeatureCollection.geometry() 生成随机点:FeatureCollection.randomPoints() FeatureCollection中limit( ...
- Google Earth Engine(gee)中的Image
目录 Image.get() Image.clip() Image.select() Image.addBands() Image中的projection(),reproject() Image.un ...
- Google Earth Engine ——基于ENVISAT的中分辨率成像光谱仪全球土地覆盖300米分辨率数据集
GlobCover 2009 is a global land cover map based on ENVISAT's Medium Resolution Imaging Spectrometer ...
- Google Earth Engine(gee)中的Geometry
目录 点:ee.Geometry.Point() 多点:ee.Geometry.MultiPoint() 线:ee.Geometry.LineString() 多线:ee.Geometry.Multi ...
- Google Earth Engine(GEE)填补缺失影像
今日分享: Google Earth Engine(GEE)填补缺失影像 之前在做月合成NDVI的过程中,发现如果研究区较大时,一个月的影像覆盖不了整个研究区,就会有缺失的地方,还有就是去云之后,有云 ...
最新文章
- 【SICP练习】111 练习3.24
- 公司网络推广为你解答蜘蛛为什么有抓取网页却没收录?
- python平均工资-2019年我国程序员薪资统计,看看你出于什么水平?
- MySQL 备份和恢复策略(二)
- Win32程序简单演示-模拟电子表格移动光标到另一单元格
- SAP创建Web Service以及用ABAP调用
- 16款新品发布,数据揭秘小米MIX荣归背后逻辑
- JAVA 多用户商城系统b2b2c---配置中心和消息总线
- WINDOWS XP SP2 NTFS EFS加密文件的解密案例
- 张高兴的 .NET Core IoT 入门指南:(五)串口通信入门
- html隐藏块元素过度动画,CSS3实现DIV图层隐藏到显示的过渡效果
- 正式踏入24岁了……
- 016医疗项目 数据字典(概念和在本系统中的应用)
- jquery为元素绑定事件
- 集成学习—GBDT原理理解
- 谷歌放弃go_盘点国内可以使用的十种谷歌服务
- himawari-8卫星叶绿素a产品、_海洋卫星眼中的台风quot;海神quot;
- 产学研专题数据(区域、企业、地级市创新指标及研发、RD投入)
- TeamView 无法捕捉画面问题的解决办法
- 2022-2027年中国复合超硬材料行业发展前景及投资战略咨询报告