当我尝试获取插值的每月数据时,为什么Google Earth Engine中缺少属性?

问题描述

使用Google Earth Engine时遇到问题,希望您能为我提供帮助。尝试获取使用Kriging插值的月度盐度数据时出现错误

缺少属性“ salinity_0”。

salinity_0是HYCOM / sea_temp_salinity图像集合中的一个波段。当我不进行插值时,便能够检索数据。但是,我想要获取信息的大部分时间(代码中的 amerbs )位于没有数据的像素中。因此,我将盐度的插值信息用于空像素。

我没有在下面的代码中包含几何“智利”,因为它的数据点太多。

以下是我的代码链接 Link

谢谢您的帮助!

var MOdis_sst = ee.ImageCollection("NASA/OCEANDATA/MOdis-Aqua/L3SMI"),amerbs = ee.FeatureCollection("users/felipejquezadae/AMERB_coordinates_id"),HYCOM_salinity = ee.ImageCollection("HYCOM/sea_temp_salinity"),amerbs_region = ee.FeatureCollection("users/felipejquezadae/AMERB"),navy = ee.FeatureCollection("users/felipejquezadae/NAVY_jurisdiction");

    // Set years and month
    var startYear = 2002;
    var endYear = 2018;
    var years = ee.List.sequence(startYear,endYear);
    var months = ee.List.sequence(1,12);
    // load the image collection
    var data_satellite = HYCOM_salinity.filterDate('2002-01-01','2019-01-01').select('salinity_0')

    // make monthly summed mosaics
    // loop over the years and months to get summed monthly images
    var byMonth = ee.ImageCollection(ee.FeatureCollection(years.map(function (y) {
      var yearCollection = data_satellite.filter(ee.Filter.calendarRange(y,y,'year'));
      var byYear = ee.ImageCollection.fromImages(
        months.map(function (m) {
          var summedImage = yearCollection.filter(ee.Filter.calendarRange(m,m,'month'))
            .reduce(ee.Reducer.mean()).clip(chile);
            
          var proj = ee.Projection('epsg:4326');
          var summedImage2 = summedImage.reproject(proj,null,500);
            
          // Sample the sst image at 1000 random locations.
          var samples = summedImage2.addBands(ee.Image.pixelLonLat())
          .sample({region: chile,numPixels: 5500})
          .map(function(sample) {
            var lat = sample.get('latitude');
            var lon = sample.get('longitude');
            var salinity_0 = sample.get('salinity_0');
            return ee.Feature(ee.Geometry.Point([lon,lat]),{salinity_0: salinity_0});
            });
            // Interpolate sst from the sampled points.
            var interpolated = samples.kriging({
              propertyName: 'salinity_0',shape: 'exponential',range: 90 * 1000,sill: 1.0,nugget: 0.1,maxdistance: 90 * 1000,reducer: 'mean',});

          var date = ee.Date.fromYMD(y,5).format("MM_dd_YYYY");
          return interpolated.set('system:time_start',ee.Date.fromYMD(y,5))
            .rename(date)
            .reduce(ee.Reducer.mean());
          //.set('month',m).set('year',y); // eventually set year and month 
        }));
      return byYear;
    })).flatten());

    var outputMonthly = byMonth.filter(ee.Filter.listContains('system:band_names','constant').not())
      .sort('system:time_start').toBands();
    print(outputMonthly,"monthly_data");

    var features = outputMonthly.reduceRegions(amerbs,ee.Reducer.mean(),30);
    var data_print = ee.FeatureCollection(features);
    print(data_print);

    Export.table.toDrive(data_print,"Salinity_2003_2018_interpolated");

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)