I have tried and added the code for both, but something isn't quite working. I think I need to convert the image from float to integers?

var before_start= '2020-07-14';
var before_end='2020-07-16';

                           SET SAR PARAMETERS (can be left default)*/

var polarization = "VH"; 
var pass_direction = "DESCENDING"

// rename selected geometry feature 
var aoi = ee.FeatureCollection(studyarea);

// Load and filter Sentinel-1 GRD data by predefined parameters 
var collection= ee.ImageCollection('COPERNICUS/S1_GRD')
  .filter(ee.Filter.listContains('transmitterReceiverPolarisation', polarization))
  //.filter(ee.Filter.eq('relativeOrbitNumber_start',relative_orbit ))
// Select images by predefined dates
var before_collection = collection.filterDate(before_start, before_end);

// Print selected tiles to the console

      // Extract date from meta data
      function dates(imgcol){
        var range = imgcol.reduceColumns(ee.Reducer.minMax(), ["system:time_start"]);
        var printed = ee.String('from ')
          .cat(' to ')
        return printed;
      // print dates of before images to console
      var before_count = before_collection.size();
      print(ee.String('Tiles selected: Before Flood ').cat('(').cat(before_count).cat(')'),
        dates(before_collection), before_collection);
        // Create a mosaic of selected tiles and clip to study area
var before = before_collection.mosaic().clip(aoi);

// Apply reduce the radar speckle by smoothing  
var smoothing_radius = 50;
var before_filtered = before.focal_mean(smoothing_radius, 'circle', 'meters');

      var connections = before_filtered.int16().connectedPixelCount(8, false);    
      var flooded = before_filtered.updateMask(connections.gte(8));
      // Mask out areas with more than 3 degreeslope using a Digital Elevation Model 
      var DEM = ee.Image('WWF/HydroSHEDS/03VFDEM');
      var terrain = ee.Algorithms.Terrain(DEM);
      var slope = terrain.select('slope');
      var flooded = flooded.updateMask(slope.lt(3));

Map.addLayer(flooded, {min:-25,max:0}, 'Before Flood',0)
//downloaded before_filtered
  image: flooded,
  description: 'Sentinel2',
  scale: 30,
  region: aoi,


Also is it possible to analyze the downloaded tiff image from this directly in ArcGIS without any further pre-processing steps? Or is there anything else that needs to be corrected?


Your process is essentially correct, however you're using some operators that work in units of pixels (connectedCount, slope), and those are "pixels at the zoom level I'm look at on the map", which is probably what's confusing you. (Your export probably worked as expected because you specified a 30m scale explicitly there).

Force a reprojection and zoom in so you can see what the results really look like at the projection your export will be at.

var proj = ee.Projection("EPSG:4326").atScale(30)
var before_filtered = before.focal_mean(smoothing_radius, 'circle', 'meters').reproject(proj)
Map.addLayer(flooded.reproject(proj), {min:-25,max:0}, 'Before Flood')


Arc should be able to open that file just fine, although you might want to include the mask band so it knows transparent from non-transparent pixels:

  image: flooded.addBands(flooded.mask()).float()

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.