0

I am trying to determine the correlation between Sentinel-1 log(VH/VV) data and the corresponding MODIS 4 day LAI product. For the first step, I am trying to add the corresponding LAI data as a band to the Sentinel-1 log(VH/VV) collection. My code so far is provided. I am getting the errors shown below.

var point = ee.Geometry.Point(-96.47664, 41.16506);
var proj = ee.Projection('EPSG:32614');

var reproject = function(image) {
  var reprojected = image.reproject(proj, null, 1000);
  return reprojected};

var LogRatio = function(img) {
  var logVV = img.select('VV');
  var logVH = img.select('VH');
  var logratio = logVH.subtract(logVV).rename('logVH/VV');
  var logratio_float = logratio.toFloat();
  return img.addBands(logratio_float)};

var S1 = ee.ImageCollection('COPERNICUS/S1_GRD');
var S1_TempFilt = S1.filterDate('2017-01-01', '2020-02-20');
var S1_TempFilt_Resamp = S1_TempFilt.map(reproject);
var S1_TempSpatFilt_Resamp = S1_TempFilt_Resamp.filterBounds(point);
var S1_TempSpaceFiltResamp_W_LogCR = S1_TempSpatFilt_Resamp.map(LogRatio);
var S1_Log_VH_VV = S1_TempSpaceFiltResamp_W_LogCR.select('logVH/VV');
print('S1_Log_VH_VV',S1_Log_VH_VV);

var MODIS = ee.ImageCollection('MODIS/006/MCD15A3H');
var MODIS_TempFilt = MODIS.filterDate('2017-01-01', '2020-02-20');
var MODIS_TempFilt_Resamp =  MODIS_TempFilt.map(reproject);
var MODIS_TempSpatFilt_Resamp = MODIS_TempFilt_Resamp.filterBounds(point);
var M_LAI = MODIS_TempSpatFilt_Resamp.select('Lai');
print(M_LAI);

var Find_MODIS_LAI = function(image2) {
  var S1date = ee.Date(image2.get('system:time_start'));
  var LAI_start_date_min = S1date.advance(-1,"day");
  var LAI_start_date_max = S1date.advance(2,"day");
  var MODIS_LAI = M_LAI.filterDate(LAI_start_date_min, LAI_start_date_max);
  return MODIS_LAI};

var MODIS_LAI = S1_Log_VH_VV.map(Find_MODIS_LAI);
print('MODIS_LAI', MODIS_LAI);

var LAI_Band = MODIS_LAI.select('Lai');
print('LAI_Band',LAI_Band);
var LogCR_LAI = S1_Log_VH_VV.addBands(LAI_Band);

Error:

ImageCollection (Error)
Error in map(ID=S1A_IW_GRDH_1SDV_20170108T002112_20170108T002137_014733_017FB8_9BC3):
Image.select, argument 'input': Invalid type. Expected: Image<unknown bands>. Actual: ImageCollection.

S1_Log_VH_VV.addBands is not a function
1
  • How exactly is a correlation between 10m and 500m resolution data going to work? Just GEE will do it does not mean it is correct. Commented Apr 5, 2022 at 16:53

1 Answer 1

0

You can join the two image collections. Something like this:

var s1Lai = ee.ImageCollection(ee.Join.saveAll('lai')
  .apply({
      primary: s1,
      secondary: lai,
      condition: ee.Filter.and(
        ee.Filter.intersects({
          leftField: '.geo',
          rightField: '.geo'
        }),
        ee.Filter.maxDifference({
          // Include LAI within 4 days of s1
          difference: 4 * 24 * 3600 * 1000, 
          leftField: 'system:time_start',
          rightField: 'system:time_start'
        })
      )
  }))
  .map(function (s1) {
    var lai = ee.ImageCollection(
        ee.List(s1.get('lai'))
      )
      .mosaic()
      .rename('LAI')
    return s1
      .addBands(lai)
      .float()
      .set('lai', null)
  })

https://code.earthengine.google.com/dcdd4d8e1c3845ae84ed65a5de9ee828

1
  • That worked great. Thank you very much.
    – Fritz
    Commented Feb 27, 2020 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.