2

I want to generate monthly average Sentinel-1 images in GEE and adapted this answer here to get 12 mean radar images over a year. However, as radar imagery in GEE is in decibel, this returns the geometric mean and not the arithmetic mean. I have been able to convert a single decibel image to power using the equation:

var PWR = ee.Image(10).pow(image.select('VH').divide(10))

but I do not know how to implement this over each image in a collection prior to calculating the monthly average. Is it possible to calculate this when generating an image collection?

My code is:

var sentinel1 = ee.ImageCollection("COPERNICUS/S1_GRD");

var months = ee.List.sequence(1, 12);

var byMonth = ee.ImageCollection.fromImages(
    months.map(function (m) {
      return sentinel1
      .filter(ee.Filter.eq('instrumentMode', 'IW'))
      .filterBounds(geometry)
      .filterDate('2017-01-01','2017-12-31')
      .filter(ee.Filter.calendarRange(m, m, 'month'))
                .select('VH')
                .mean()
                .set('month', m);
}));

and a working example can be found here

GeoMonkey
  • 1,357
  • 11
  • 26

1 Answers1

2

You would need to map a function over the entire Sentinel-1 collection to apply the power calculation to each image. Here is an example:

var geometry = ee.Geometry.Point([-122,37.5])

// apply all of the filtering up front to prevent processing on large image collection
var sentinel1 = ee.ImageCollection("COPERNICUS/S1_GRD")
  .filter(ee.Filter.eq('instrumentMode', 'IW'))
  .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
  .filterBounds(geometry)
  .filterDate('2017-01-01','2017-12-31');

// converting decibels to power for the VH polarization
var power = sentinel1.map(function(image){
  return ee.Image(10).pow(image.select('VH').divide(10))
    .rename('VH') // rename band
    .copyProperties(image,['system:time_start']); // copy time property for later
});

// months to map over
var months = ee.List.sequence(1,12);

var byMonth = ee.ImageCollection.fromImages(
  months.map(function (m) {
    return power // using the calculated power images instead of decibel
      .filter(ee.Filter.calendarRange(m, m, 'month')) // get the month of interest
        .select('VH')
        .mean() // mean composite
        .set('month', m);
}));
print(byMonth);

Map.addLayer(ee.Image(byMonth.first()),{min:0,max:1,gamma:4},'Jan. composite');

Here is the link to the code: https://code.earthengine.google.com/d41474f8d717b1c1a67c5a1dea6e8d5e

Kel Markert
  • 1,128
  • 5
  • 11
  • Thanks for the help, but I can't seem to get data out of this. It runs ok and returns an image collection with 12 elements, but there are no image bands in the output – GeoMonkey Nov 20 '19 at 14:21
  • It appears to be due to the timestamp. the filterDate and Filter.calendarRange arguments, return 0 bands – GeoMonkey Nov 20 '19 at 14:50
  • There were a couple pieces missing in my first response. I updated the answer to be correct and run as is. Basically, when you do some band math in EE it drops all of the properties and you would need to copy the system:time_start property to time filter when calculating the composites. Hopefully this answer is a better for your needs. – Kel Markert Nov 20 '19 at 15:42
  • 1
    I guessed that it may be losing the properties somewhere, but was not sure why, or how to put them back.Works perfectly and I've learned a bit more GEE! – GeoMonkey Nov 20 '19 at 16:33