当前位置:网站首页>GEE - 数据集介绍MCD12Q1
GEE - 数据集介绍MCD12Q1
2022-07-24 21:48:00 【By-Q】
1、介绍
MODIS土地覆盖类型产品(MCD12Q1)提供了一套科学数据集(SDSs),以每年500米的空间分辨率绘制了6个不同的土地覆盖图例的全球土地覆盖。
2、GEE中使用
选择PFT分类(第五种分类),第五种分类有十一种类别
var LC = ee.ImageCollection("MODIS/006/MCD12Q1");
var igbpLandCover = LC.filter(ee.Filter.date('2018-01-01', '2018-12-31'))
.select('LC_Type5') // 选择其中PFT分类
// 可视化参数
var igbpLandCoverVis = {
min: 1.0,
max: 11.0,
palette: [
'05450a', '086a10', '54a708', '78d203', '009900', 'c6b044', 'dcd159',
'dade48', 'fbff13', 'b6ff05', '27ff87'
],
};
Map.addLayer(igbpLandCover, igbpLandCoverVis, 'IGBP Land Cover');
var mask=function(image){
var mask=image.gte(1).and(image.lte(4))// 选择1-4 代表的植被区
var masked_image=image.updateMask(mask);
return masked_image
}
// 提取出1-4的植被类型
var LCmask = mask(igbpLandCover)
Map.addLayer(LCmask, igbpLandCoverVis, 'type 5 ');
3、计算面积
计算面积使用的是ee.Image.pixelArea(),分级统计面积
var area = ee.Image.pixelArea().addBands(LCmask)
.reduceRegion({
// reducer: ee.Reducer.sum(),
reducer: ee.Reducer.sum().group({
groupField: 1,
groupName: "area"
}),
geometry: roi_AF,
crs:'EPSG:4326',
scale:250,
maxPixels:10e30,
})
打印出area的结果:可以看出有4类结果,依次对应的上述植被的1-4种植被类型,但是这样不是利于观看,我们期望得到总和面积。
将结果转化为列表:
var classAreas = ee.List(area.get('groups'))
var classAreaLists = classAreas.map(function(item) {
var areaDict = ee.Dictionary(item)
var classNumber = ee.Number(areaDict.get('area')).format()
var area = ee.Number(areaDict.get('sum')).divide(1e6)//.round()
return ee.List([classNumber, area])
})
print(classAreaLists)

对上述列表进行平整化并求和
// flatten()可以平整列表
var result = ee.Dictionary(classAreaLists.flatten())
print(result.values())
// 求和函数 iterate迭代
var List_1 = result.values()
function Do ( Number_1, Number_2 )
{
return ee.Number(Number_1).add(Number_2);
}
var List_2 = List_1.iterate( Do, 0 );
print( List_1, List_2 );

边栏推荐
- 图像处理笔记(1)图像增强
- P2404 splitting of natural numbers
- Leetcode 101. symmetric binary tree
- Today's nft/ digital collection hotspot
- Maixll dock QR code recognition
- Mathematical derivation in [pumpkin Book ml] (task4) neural network
- Thread pool learning
- 【ICML2022】气候变化与机器学习:机遇、挑战与考虑,121页ppt
- [good question with two points]
- 微机原理:CPU架构详解
猜你喜欢

Uniqueness and ordering in set

Feeding Program Source Code to ZK VMs

Easily make 2D tile map with unity tilemap - Basics

数据库之-元数据 DatabaseMetaData 初学

MQ release confirmation

Apipost signs up with Chinatelecom! Work together to accelerate the digital transformation of enterprises

Huawei Router: basic principle and configuration of Isis (including experiment)
![[combination of classes (define a class in a class)]](/img/ae/a8226e1795bb45171a11c65d35bcac.png)
[combination of classes (define a class in a class)]

陈春花与莫言,都有苦难言

My love lesson 2 - remove webpage pop-up
随机推荐
Establishment of China Mobile Chain (EOS based) test environment
Can bank financial products be redeemed and transferred out on the same day?
集成Swagger 学习
String matching (Huawei)
企业运营自媒体不能“自嗨”:内容要接地气不能接广告
第二十周作业
OSI的体系结构,以及各层协议
C # review the entrustment and event
Gradle学习集合整合
Tencent +360+ Sogou school recruitment test + summary of knowledge points
Leetcode: the shortest dice sequence impossible to get [thinking questions + grouping ideas]
day10:声明式事务控制
Maxcompute instance related operations
Using gcc to avoid stack smash attack
2018mysql technology Q & a collection, hoping to give some help to students who like MySQL
Feeding Program Source Code to ZK VMs
Low code that democratizes software development
P2404 splitting of natural numbers
Which type of database migration is suitable for choosing the self built database access method on ECs?
Esp32485 air temperature and humidity test