前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Google Earth Engine(GEE)——如何获取指定时间范围的影像值并进行图表展示(指定天数范围内的时序图)

Google Earth Engine(GEE)——如何获取指定时间范围的影像值并进行图表展示(指定天数范围内的时序图)

作者头像
此星光明
发布2024-02-02 14:42:09
3640
发布2024-02-02 14:42:09
举报

很多时候我们可以直接进行影像图表的加载,但是如何获取不同天数,或者给了指定的时间节点,如何获取这个指定时间范围内的月或者日的结果,从而正确的加载影像波段值的图表。我们需要了解几个函数:

difference(start, unit)

Returns the difference between two Dates in the specified units; the result is floating-point and based on the average length of the unit.

返回两个Date在指定单位中的差值;结果是浮点的,基于单位的平均长度。

Arguments:

this:date (Date)

start (Date)

unit (String):

One of 'year', 'month' 'week', 'day', 'hour', 'minute', or 'second'.

Returns: Float

advance(delta, unit, timeZone)//这个是进行日期的设定,按照年月日等格式

Create a new Date by adding the specified units to the given Date.

通过向给定的日期添加指定的单位来创建一个新的日期。 

Arguments:

this:date (Date)

delta (Float)

unit (String):

One of 'year', 'month' 'week', 'day', 'hour', 'minute', or 'second'.

timeZone (String, default: null):

The time zone (e.g. 'America/Los_Angeles'); defaults to UTC.

Returns: Date

ui.Chart.image.series(imageCollection, region, reducerscalexProperty)

Generates a Chart from an ImageCollection. Plots derived values of each band in a region across images. Usually a time series.

  • X-axis: Image, labeled by xProperty value.
  • Y-axis: Band value.
  • Series: Band names.

Returns a chart.

Arguments:

imageCollection (ImageCollection):

An ImageCollection with data to be included in the chart.

region (Feature|FeatureCollection|Geometry):

The region to reduce.

reducer (Reducer, optional):

Reducer that generates the values for the y-axis. Must return a single value. Defaults to ee.Reducer.mean().

scale (Number, optional):

Scale to use with the reducer in meters.

xProperty (String, optional):

Property to be used as the label for each image on the x-axis. Defaults to 'system:time_start'.

Returns: ui.Chart

代码:

代码语言:javascript
复制
var startDate = ee.Date('2022-01-01'); // set start time for analysis
var endDate = ee.Date('2022-12-31'); // set end time for analysis
var nDays = ee.Number(endDate.difference(startDate,'day')).round();

// coordinate Arpat Ponte alle Mosse
//var point = ee.Geometry.Point([11.230520538799576, 43.78480193916678]);

// Signa 11.097849 43.793234
//https://www.arpat.toscana.it/temi-ambientali/aria/qualita-aria/rete_monitoraggio/scheda_stazione/FI-SIGNA
var point = ee.Geometry.Point([11.097849, 43.793234]);
Map.setCenter(11.097849, 43.793234,14);


var chirps = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_O3')
            .select('O3_column_number_density')
            .filterBounds(point)
            .filterDate(startDate, endDate)
            .map(function(image){return image.clip(point)}) ;

      
//这个关键地方,,是需要我们建立一个时序,然后获取每一天的值,这里最主要的时间函数的运用,以及影像系统时间的设定
var byday = ee.ImageCollection(
  // map over each day
  ee.List.sequence(0,nDays).map(function (n) {
    var ini = startDate.advance(n,'day');
    // advance just one day
    var end = ini.advance(1,'day');
    return chirps.filterDate(ini,end)
                .select(0).mean()
                .set('system:time_start', ini);
}));



// plot full time series
print(
  ui.Chart.image.series({
    imageCollection: byday,
    region: point,
    scale: 1
  }).setOptions({title: 'O3 Signa 2020 mol/m2'})
);

Export.table.toDrive({
        collection: chirps,
        description: 'O3', 
    fileNamePrefix: 'O3', 
    fileFormat: 'CSV'
    });
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Arguments:
  • Returns: Float
  • Arguments:
  • Returns: Date
  • Arguments:
  • Returns: ui.Chart
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档