TransWikia.com

Assigning bands for cart classification

Geographic Information Systems Asked on August 17, 2021

I am classifying Landsat 8 and Sentinel 1 in Google Earth Engine but the console tells me I do not have the required bands for classification even after assigning all the bands.

Attached a link to my workflow (JavaScript for GEE):

var season1 = Landsat.filterDate('2018-10-01', '2018-12-31')
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 25))
                  .filterBounds(mis)
                  .map(maskL8sr)
                  .median().clip(mis);
print('Landsat_season1:', season1);
                
var season2 = Landsat.filterDate('2019-01-01', '2019-03-31')
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 25))
                  .filterBounds(mis)
                  .map(maskL8sr)
                  .median().clip(mis);
print('Landsat_season2:', season2);
var season3 = Landsat.filterDate('2019-04-01', '2019-06-30')
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 25))
                  .filterBounds(mis)
                  .map(maskL8sr)
                  .median().clip(mis);
print('Landsat_season3:', season3);
var season4 = Landsat.filterDate('2019-07-01', '2019-09-30')
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 25))
                  .filterBounds(mis)
                  .map(maskL8sr)
                  .median().clip(mis);
print('Landsat_season4:', season4);

// Define False color visualization
var rgbVis = {
  min: 0.0,
  max: 0.3,
  bands: ['B5', 'B4', 'B3'],
  gamma: 1.7
};

///Visualize the FCC of each season Landsat images
Map.addLayer(season1, rgbVis, 'Landsat MSI - season1',false);
Map.addLayer(season2, rgbVis, 'Landsat MSI - season2',false);
Map.addLayer(season3, rgbVis, 'Landsat MSI - season3',false);
Map.addLayer(season4, rgbVis, 'Landsat MSI - season4',true);

// Below four lines select season wise Sentinel 1 RADAR data again median and clipped to MIS
var vh_s1 =  S1.filterBounds(mis).filterDate('2018-10-01', '2018-12-31').median().clip(mis).select('VH').rename(['vh_s1']);
var vh_s2 =  S1.filterBounds(mis).filterDate('2019-01-01', '2019-03-31').median().clip(mis).select('VH').rename(['vh_s2']);
var vh_s3 =  S1.filterBounds(mis).filterDate('2019-04-01', '2019-06-30').median().clip(mis).select('VH').rename(['vh_s3']);
var vh_s4 =  S1.filterBounds(mis).filterDate('2019-07-01', '2019-09-30').median().clip(mis).select('VH').rename(['vh_s4']);

// Here we combine all the seasonal Landsat and Sentinel 1 to a single image collection called
// 'dataset'
var dataset = season1.addBands(season2).addBands(season3).addBands(season4).addBands(vh_s1).addBands(vh_s2).addBands(vh_s3).addBands(vh_s4);
print('dataset:', dataset);

//Below codes split the training data into Training (70%) and Validation (30%) - Random
var trdata_table = field.randomColumn({seed: 1});
var training = trdata_table.filter(ee.Filter.lt('random', 0.70));
var validation = trdata_table.filter(ee.Filter.gte('random', 0.70));

// Create a new feature collection (vector) with all the bands in 'dataset' sampled to training points
var training = dataset.sampleRegions({
  collection: training,
  properties: ['class_id'],
  scale: 20,
  tileScale: 8
});
print('training:', training);
// Create a new feature collection (vector) with all the bands in 'dataset' sampled to validation points
var validation = dataset.sampleRegions({
  collection: validation,
  properties: ['class_id'],
  scale: 20,
  tileScale: 8
});

//Define bands require for training and classification. So Bands 1,2,3,4,5,6,7,9,10,11 for 4 seasonal
// images and Sentinel 1 (1 band) representing 4 seasons
var bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10', 'B11', 'B1_1', 'B2_1', 'B3_1', 'B4_1', 'B5_1', 'B6_1', 'B7_1', 'B8_1', 'B9_1', 'B10_1', 'B11_1', 'B1_2', 'B2_2', 'B3_2', 'B4_2', 'B5_2', 'B6_2', 'B7_2', 'B8_2', 'B9_2', 'B10_2', 'B11_2', 'B1_3', 'B2_3', 'B3_3', 'B4_3', 'B5_3', 'B6_3', 'B7_3', 'B8_3', 'B9_3', 'B10_3', 'B11_3', 'vh_s1', 'vh_s2', 'vh_s3', 'vh_s4'];
print('bands:', bands);

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP