惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
I
InfoQ
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
Recent Announcements
Recent Announcements
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
Docker
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
博客园 - Franky
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
WordPress大学
WordPress大学
MyScale Blog
MyScale Blog
月光博客
月光博客
罗磊的独立博客

博客园 - 风过 无痕

基于Sentinel-2影像和AI算法的北海金海湾国际湿地红树林时空动态分析Spatiotemporal Dynamics of Mangroves in the Jinhaiwan Ramsar Wetland, Beihai, Based on Sentinel-2 Imagery and AI Algorithms ArcGIS Pro+Gemini+ChatGPT+遥感AI+图解建模+无人机赠送GMail+高分影像 3种数字高程模型模型精度对比研究Accuracy Assessment of Alos W3d30, Aster Gdem and Srtm30 Dem The State of World Fisheries and Aquaculture 2024 - Blue Transformation in action Global Food and Nutrition Security - Key messages What is the naming convention for Landsat Collections Level-1 scenes? 大模型的幻觉是不可避免 GEE哨兵-2光学卫星(S2)地表反射率和NDVI下载 CreateHolesInImage说明文档-对于遥感影像的空洞创建多边形矢量数据 博客园导入word文档docx, doc, markdown md文档的方法 搜狗输入法占用vs visual studio 编译快捷键冲突的解决方法 安卓平板小米平板5取消自动分屏 LANDSAT LC08 C02 T1_L2 metadata dictory 元数据字典 Landsat 8 Collection 2 Tier 1 calibrated top-of-atmosphere (TOA) reflectance Acrobat pdf 编辑添加下划线acrobat pro SuperMap iObjects.NET 64位开发入门 多个文本文件合并 IDL实现TM遥感影像直方图统计(中值、均值、方差、众数及峰度系数计算)(转) envi5.3打开失败JSON_PARSE: Invalid string, no closing '"' GEE的存储空间 Photoshop无法载入动作,因为意外地遇到文件尾-处理办法 ArcGIS空间分析案例教程-网格和标记生成
GEE云量计算简单云量估计 主要功能 从数据集中选择云量最小的...
风过 无痕 · 2023-11-27 · via 博客园 - 风过 无痕

 GEE云量计算

作者:赤豆冰棍
链接:https://www.jianshu.com/p/b9e8de78c951

简单云量估计

主要功能

从数据集中选择云量最小的像素,输出展示

代码

// SimpleCloudScore, an example of computing a cloud-free composite with L8

// by selecting the least-cloudy pixel from the collection.

// A mapping from a common name to the sensor-specific bands.

var LC8_BANDS = ['B2',   'B3',    'B4',  'B5',  'B6',    'B7',    'B10'];

var STD_NAMES = ['blue', 'green', 'red', 'nir', 'swir1', 'swir2', 'temp'];

// Compute a cloud score.  This expects the input image to have the common

// band names: ["red", "blue", etc], so it can work across sensors.

var cloudScore = function(img) {

  // A helper to apply an expression and linearly rescale the output.

  var rescale = function(img, exp, thresholds) {

    return img.expression(exp, {img: img})

        .subtract(thresholds[0]).divide(thresholds[1] - thresholds[0]);

  };

  // Compute several indicators of cloudyness and take the minimum of them.

  var score = ee.Image(1.0);

  // Clouds are reasonably bright in the blue band.

  score = score.min(rescale(img, 'img.blue', [0.1, 0.3]));

  // Clouds are reasonably bright in all visible bands.

  score = score.min(rescale(img, 'img.red + img.green + img.blue', [0.2, 0.8]));

  // Clouds are reasonably bright in all infrared bands.

  score = score.min(

      rescale(img, 'img.nir + img.swir1 + img.swir2', [0.3, 0.8]));

  // Clouds are reasonably cool in temperature.

  score = score.min(rescale(img, 'img.temp', [300, 290]));

  // However, clouds are not snow.

  var ndsi = img.normalizedDifference(['green', 'swir1']);

  return score.min(rescale(ndsi, 'img', [0.8, 0.6]));

};

// Filter the TOA collection to a time-range and add the cloudscore band.

var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')

    .filterDate('2017-05-01', '2017-07-01')

    .map(function(img) {

      // Invert the cloudscore so 1 is least cloudy, and rename the band.

      var score = cloudScore(img.select(LC8_BANDS, STD_NAMES));

      score = ee.Image(1).subtract(score).select([0], ['cloudscore']);

      return img.addBands(score);

    });

// Define visualization parameters for a true color image.

var vizParams = {bands: ['B4', 'B3', 'B2'], max: 0.4, gamma: 1.6};

Map.setCenter(-120.24487, 37.52280, 8);

Map.addLayer(collection.qualityMosaic('cloudscore'), vizParams);

步骤分析

  1. 创建LC8波段顺序名称列表
  2. 定义函数cloudScore用于计算云量
  3. 创建数据集对象,获取LC8数据,使用时间筛选,选择云量(cloudscore)波段,获取1-cloudscore结果作为score新波段,添加到该景影像中
  4. 定义显示参数
  5. 设置地图中心,缩放等级
  6. 添加图层,图层内容使用函数cloudScore来计算数据集中的所有数据,并且返回云量最少部分,镶嵌成为一个图层用于显示

主要方法

  1. ee.Image.qualityMosaic()
    Composites all the images in a collection, using a quality band as a per-pixel ordering function.
    Arguments:
    this:collection (ImageCollection):
    The collection to mosaic.
    qualityBand (String):
    The name of the quality band in the collection.
    Returns: Image

组合一个数据集内的所有数据,使用一个质量控制波段来决定像素值
输入参数:数据集,质量控制波段名称