Ошибка GEE: слой 1: ошибка слоя: Image.lte: если у одного изображения нет полос, у другого также не должно быть полос. Получил 0 и 1 - PullRequest
0 голосов
/ 06 февраля 2020

Я написал следующий код, чтобы вычислить количество пикселей, классифицированных как вода, в моей области интересов. Я вручную настраиваю даты несколько раз, чтобы получить временной ряд затопленного размера / озера, т.е. я считываю рассчитанное значение «объекта» и записываю его в файл Excel. Мой код отлично работал на 2019, 2018 и большую часть 2017 года, но теперь, когда я пытаюсь сделать то же самое для 2016 и 2015 годов, я получаю ошибку "Слой 1: Ошибка слоя: Image.lte: Если одно изображение имеет нет полос, у другой также не должно быть полос. Получил 0 и 1. "

Кто-нибудь знает, как я это исправлю ??

Мой код указан ниже:

//I am trying to construct a time series of flood extent over the duration of a whole year. The code will then be edited to be replicated for previous years as well


//This does all that I want.
//When you press run it will spit out two object values. The top one is the number of water pixles. The bottom value is the area classifiied as water
//Record these in excel spreadsheet.
//To get the next time step i need to go through and change the code each time i.e do this for each month, and then also for each year.
//So i need to change it all manually, rather than the code working it all out at for me

// Load Sentinel-1 C-band SAR Ground Range collection (log scale, VH, descending)
var collectionVH = ee.ImageCollection('COPERNICUS/S1_GRD')
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
.filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
.filterMetadata('resolution_meters', 'equals' , 10)
.filterBounds(roi)
.filter(ee.Filter.date('2016-01-01', '2016-12-31'))
.select('VH');
print(collectionVH, 'Collection VH');

//filter the date for the first half of january

var Jan1 = collectionVH.filterDate('2016-01-01', '2015-01-15').mean();

//smooth image to remove error
var SMOOTHING_RADIUS = 100;
var Jan1filtered = Jan1.focal_mean(SMOOTHING_RADIUS, 'circle', 'meters');


//mask image to just get water. This is using high certainity water mask
var Jan1mask = Jan1filtered.updateMask(Jan1filtered.lte(-23));

//map this layer

Map.addLayer(Jan1mask,{palette:"00FFFF"});

//The next step calculated the number of pixles classified as water (i.e they had a value of 1 rather than 0? Or 0 rather than 1, need to check)
// Sum the values of water pixels in the ROI. I did this one at a time and deletedthe old one after each step to save room i.e its been repeated over and over
var stats = Jan1mask.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: roi,
  scale: 30,
  maxPixels: 1e9
});
print(stats);

...