GEE归一化指数计算

归一化指数计算

主要功能

计算指定数据集指定两个波段的归一化指数

代码

// NormalizedDifference example.
//
// Compute Normalized Difference Vegetation Index over MOD09GA product.
// NDVI = (NIR - RED) / (NIR + RED), where
// RED is sur_refl_b01, 620-670nm
// NIR is sur_refl_b02, 841-876nm

// Load a MODIS image.
var img = ee.Image('MODIS/006/MOD09GA/2012_03_09');

// Use the normalizedDifference(A, B) to compute (A - B) / (A + B)
var ndvi = img.normalizedDifference(['sur_refl_b02', 'sur_refl_b01']);

// Make a palette: a list of hex strings.
var palette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
               '74A901', '66A000', '529400', '3E8601', '207401', '056201',
               '004C00', '023B01', '012E01', '011D01', '011301'];

// Center the map
Map.setCenter(-94.84497, 39.01918, 8);

// Display the input image and the NDVI derived from it.
Map.addLayer(img.select(['sur_refl_b01', 'sur_refl_b04', 'sur_refl_b03']),
         {gain: [0.1, 0.1, 0.1]}, 'MODIS bands 1/4/3');
Map.addLayer(ndvi, {min: 0, max: 1, palette: palette}, 'NDVI');

步骤分析

  1. 创建ee影像对象,通过影像数据集名称日期来筛选指定数据集特定日期的数据
  2. 计算影像两个波段的归一化指数
  3. 添加一个色板
  4. 地图对象设置显示中心,缩放等级
  5. 添加原始影像图层,设置显示参数
  6. 添加计算的归一化指数图层,设置显示参数

主要方法

  1. img.normalizedDifference()
    Computes the normalized difference between two bands. If the bands to use are not specified, uses the first two bands. The normalized difference is computed as (first − second) / (first + second).
    Arguments:
    this:input (Image):
    The input image.
    bandNames (List, default: null):
    A list of names specifying the bands to use. If not specified, the first and second bands are used.
    Returns: Image

计算输入的两个波段的归一化指数,计算表达式为:b1-b2/b1+b1

  • this,应该是一个影像对象
  • 波段名称,默认为空
  • 一个列表用于指定波段,如果没有指定输入波段,默认使用前两个波段
  1. 色板参数设置

['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
'74A901', '66A000', '529400', '3E8601', '207401', '056201',
'004C00', '023B01', '012E01', '011D01', '011301'];

CSS的颜色

Snipaste_2019-01-03_01-29-11.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 声明:作者翻译论文仅为学习,如有侵权请...
    SnailTyan阅读 10,595评论 0 8
  • 众里寻她千百度, 渺茫偶遇佳人座。 缘份巧遇情牵处, 月老冥冥安排中。 …… 深蓝(清亭) 微信:SHENLAN9...
    深蓝清亭阅读 2,144评论 0 0
  • 年少的我,曾到过许多地方,可如今那些记忆依旧清晰可见,父母为了挣钱,四处奔波,而我在那时候认识了很多的人和事。这些...
    莱夫321阅读 1,657评论 0 1
  • 当我的遗忘成了习惯, 你就是我唯一的不习惯。 当我的心有节律的跳动, 遇到你心跳快了一个节拍。 当我的沉默成了抑郁...
    8532b7bc93b9阅读 1,540评论 6 5