0

The following code is to filter, clip and select images from the Sentinel-1 GRD Collection in the Google Earth Engine Platform.

When I print the image collection, and set the start and end date of 1 day difference, I get more than 200 images per orbit (descending, ascending). I was expecting one image in the image collection.

var polygon = ee.Geometry.Polygon([[10.8393, 50.3165],[10.8465, 50.3165],
                                    [10.8465,50.3213], [10.8393, 50.3213],
                                    [10.8393, 50.3165]]); 

// Centering the map to our target parcel
Map.centerObject(polygon, 17);

// Function to clip image 
function clip_image(image){
  return image.clip(polygon); 
}

// Function to mask image to certain backscatter signal
function update_s1_mask(image) {
          var edge = image.lt(-30.0);
          var maskedImage = image.mask().and(edge.not());
          return image.updateMask(maskedImage);
        }

var start = '2022-04-01';
var end = '2022-04-02'; 
var dateRange = ee.DateRange(start, end); 
     
var s1_collection = ee.ImageCollection('COPERNICUS/S1_GRD')
                    .filterDate(dateRange)
                    .map(clip_image)
                    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
                    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
                    .filter(ee.Filter.eq('resolution_meters', 10))
                    .filter(ee.Filter.eq('instrumentMode', 'IW'))
                    .map(update_s1_mask);
                    
var s1_collection_ = s1_collection.select(['VV', 'VH']);

var desc = s1_collection_.filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'));
var asc = s1_collection_.filter(ee.Filter.eq('orbitProperties_pass', 'ASCENDING'));

print(asc);
print('descending tiles ', desc.size());
print('ascending tiles ', asc.size()); 

print(asc.first()); 

Map.addLayer(desc, {min: -25, max: 5}, 'Multi-T Mean DESC', true);

var visParams_1 = {
  color: 'FF0000',
  width: 2,
  fillColor: '1',  // with alpha set for partial transparency
  lineType: 'dotted',
  pointSize: 10,
  pointShape: 'circle'

Could someone explain me why do I get for a given location many images for such a short period of time?

1 Answer 1

1

To retrieve only the images that intersect a given region, you need to filter the image collection by bounds using ee.ImageCollection.filterBounds (short for ee.ImageCollection.filter(ee.Filter.bounds()).

var s1_collection = ee.ImageCollection('COPERNICUS/S1_GRD')
                      .filterDate(dateRange)
                      .filterBounds(polygon) // <-- FILTER BY BOUNDS
                      ...

I think that maybe you are using ee.Image.clip to perform this, but that function is masking pixels by region, not filtering by region. See this resource that describes the difference. As an aside, it is best to not clip all images in a collection; only clip collection composites, the final exports, and/or use the region parameter whenever possible in reductions and other functions.

Note that when I run your code using filterBounds, there are no images. My assumption is that there was no S1 overpass for that region on 2022-04-01.

1
  • Thank you very much! I will take a look at the documentation about filtering by bounds and clip images. And the explanation about why filterBounds doesn't yield any results, was helpful, it avoided me asking this same follow-up point. :) Sep 16 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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