Google earth engine 使用Google Earth引擎从时间序列中提取最大值和最小值的日期
我试图提取时间序列的最大值和最小值的日期。最小值的日期必须在最大值的日期之后。在函数中使用“.qualityMosaic”可以获得最大值的日期。我有麻烦,使一个工作功能的日期检测,如果分钟 如何实现正确的功能Google earth engine 使用Google Earth引擎从时间序列中提取最大值和最小值的日期,google-earth-engine,Google Earth Engine,我试图提取时间序列的最大值和最小值的日期。最小值的日期必须在最大值的日期之后。在函数中使用“.qualityMosaic”可以获得最大值的日期。我有麻烦,使一个工作功能的日期检测,如果分钟 如何实现正确的功能 /////////THESE FUNCTIONS WORKS FOR A SINGLE YEAR (EXAMPLE) var max = example.qualityMosaic('precipitation').select('day'); print(max,'max') var
/////////THESE FUNCTIONS WORKS FOR A SINGLE YEAR (EXAMPLE)
var max = example.qualityMosaic('precipitation').select('day');
print(max,'max')
var min = example.map(
function(img) {
var date = img.date().millis()
return img.updateMask(max.lt(date))
}).select('precipitation', 'day').reduce(ee.Reducer.min(2)).rename('precipitation','day')
print(min,'min')
///////////HERE IS AS I HAVE IMPLEMENTED FOR A TIME-SERIES WITH > 1 YEAR
// Find the day of max for each year
var max = ee.ImageCollection(
years.map(function (y) {
var start = ee.Date.fromYMD(y, startmonth,startday);
var stop = ee.Date.fromYMD (y,endmonth,endday);
var x = collection.filterDate(start, stop)
var w = x.qualityMosaic('precipitation').select('day')
return w.set({'year': y})
}).flatten());
print(max,'max')
Map.addLayer(max, {min: 1, max: 365}, 'max')
// Find the day of min after day of max for each year
var min = ee.ImageCollection(
years.map(function (y) {
var start = ee.Date.fromYMD(y, startmonth,startday);
var stop = ee.Date.fromYMD (y,endmonth,endday);
var x = collection.filterDate(start, stop)
var z = max.filter(ee.Filter.calendarRange(y, y, 'year'))
var w = x.map(
function(img) {
var date = img.date().millis()
var k = img.updateMask(z.lt(date))
return k
}).select('precipitation', 'day').reduce(ee.Reducer.min(2)).rename('precipitation','day')
return w
}).flatten());
print(min,'min')
Map.addLayer(min, {min: 1, max: 365}, 'min')
它看起来相当复杂,因为要检测每年的最小日期,我需要使用上一步计算的最大日期
这是代码的链接
有什么建议吗?
谢谢 如果第119行更改,这可能会起作用
var z = ee.Image(max
.filterMetadata('year', 'equals', y).first());
什么是LTAdata_to_过程。它没有初始化任何地方。对不起,我的错误,这是新的代码与更正。谢谢这项工作能很好地解决问题!!它似乎工作得很好。谢谢