基于遥感的dryness Index(aridy Index)指数提取

文章内容仅用于自己知识学习和分享,如有侵权,还请联系并删除 :)

1. 目的:提取给定站点(经纬度)的aridity index值

2. 数据来源:Zomer R J, Xu J, Trabucco A. Version 3 of the global aridity index and potential evapotranspiration database[J]. Scientific Data, 2022, 9(1): 409. link

3. 数据简介

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

4. 代码

  1. GEE: link

  2. GEE提取给定经纬度AI值

我当时是将link 中的文件下载下来,传到GEE再提取,后来发现它直接提供了aridity index image的链接,可以跳过这一步。


// 以Global-AI_ET0_v3_annual/ai_v3_yr.tif为例


// step1: 将本地的"ai_v3_yr.tif"和经纬度shapefile文件"site_LATLON"分别上传到GEE

// step2: GEE code 

/*---------------------------------*/
// 1. 导入数据
/*---------------------------------*/
var aridity_index = ee.Image("users/xxx/ai_v3_yr") //aridity index文件
var table = ee.FeatureCollection("projects/xxx/assets/site_LATLON"); //经纬度文件
var fluxnetsite = ee.FeatureCollection(table3);
//print('fluxnetsite',fluxnet2015site);


/*---------------------------------*/
// 2. Display AI map 
/*---------------------------------*/

//==================
// 2.1 显示底图
//==================

//(1) Import palette
var palettes = require('users/gena/packages:palettes')

/*
(2) Convert back by multiplying by 10,000 [The Aridity Index values reported within the Global Aridity Index_ET0 geodataset
have been multiplied by a factor of 10,000 to derive and distribute the data as integers (with 4 decimal accuracy).
This multiplier has been used to increase the precision of the variable values without using decimals.]
*/
var image = ee.Image(aridity_index.multiply(0.0001))


// (3) Define an SLD style of discrete intervals to apply to the image.
// Blue: light to deep,Hyper Arid to Humid
var sld_intervals =
  '<RasterSymbolizer>' +
    '<ColorMap type="intervals" extended="false" >' +
      '<ColorMapEntry color="#D2E1E6" quantity="0.03" label="0-0.03"/>' +      //Oyster Boy:      Hyper Arid  
      '<ColorMapEntry color="#C1E3ED" quantity="0.21" label="0.03-0.2" />' +   //Onahau:          Arid 
      '<ColorMapEntry color="#AAC9DD" quantity="0.51" label="0.2-0.51" />' +   //Light steel blue:Semi-Arid 
      '<ColorMapEntry color="#78AED3" quantity="0.65" label="0.5-0.65" />' +   //Swagull:         Dry sub-humid
      '<ColorMapEntry color="#4F77AA" quantity="2.5" label=">0.66" />' +       //San Marino:      Humid
    '</ColorMap>' +
  '</RasterSymbolizer>';
Map.addLayer(image.sldStyle(sld_intervals),{},'Aridity index')
Map.addLayer(image,{'min':0,'max':2.5,palette: palettes.cmocean.Haline[7]},'Aridity Index',false)

//==================
// 2.2 Add lengend 
//==================

// (1)set position of panel
var legend = ui.Panel({
  style: {
    position: 'bottom-right',//'bottom-left',
    padding: '8px 15px'
  }
});

// (2) Create legend title
var legendTitle = ui.Label({
  value: 'Aridity Index',
  style: {
    fontWeight: 'bold',
    fontSize: '18px',
    margin: '0 0 4px 0',
    padding: '0'
    }
});

// (3) Add the title to the panel
legend.add(legendTitle);
    
// (4) Creates and styles 1 row of the legend.
var makeRow = function(color, name) {
      
      // Create the label that is actually the colored box.
      var colorBox = ui.Label({
        style: {
          backgroundColor: '#' + color,
          // Use padding to give the box height and width.
          padding: '8px',
          margin: '0 0 4px 0'
        }
      });
      
      // Create the label filled with the description text.
      var description = ui.Label({
        value: name,
        style: {margin: '0 0 4px 6px'}
      });
      
      // return the panel
      return ui.Panel({
        widgets: [colorBox, description],
        layout: ui.Panel.Layout.Flow('horizontal')
      });
};


//  (5) Palette with the colors
var palette =["D2E1E6","C1E3ED","AAC9DD","78AED3","4F77AA"];

// (6) name of the legend
var names = ['Hyper Arid(<0.03)','Arid(0.03-0.2)','Semi-Arid(0.2-0.5)','Dry sub-humid(0.5-0.65)','Humid(>0.65)'];

// (7) Add color and and names
for (var i = 0; i < 5; i++) {
  legend.add(makeRow(palette[i], names[i]));
  }  

// (8) add legend to map (alternatively you can also print the legend to the console)  
Map.add(legend); 


/*---------------------------------*/
// 3. Display site distribution 
/*---------------------------------*/
// Paint FeatureCollection to an image using collection-wide style arguments.
var fcVis = fluxnetsite.style({
  color: 'black',
  width: 0.5,
  fillColor: 'orange',//'#67b932',  // with alpha set for partial transparency
  //lineType: 'dotted',
  pointSize: 5,
  pointShape: 'circle'
});
Map.addLayer(fcVis, null, 'FLUXNET');




/*---------------------------------
4. 导出数据到 csv文件
--------------------------------*/

var extractData =image.reduceRegions({
  collection: fluxnetsite,
  crs: ee.Projection('EPSG:4326'),
  scale:30,
  reducer: ee.Reducer.mean()});

Export.table.toDrive({
  collection: extractData,
  description: 'Aridity_index_site.csv',
  folder: 'Aridity_index/',
  fileFormat: 'CSV'
});


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值