radiometric-slope-correction icon indicating copy to clipboard operation
radiometric-slope-correction copied to clipboard

users/andreasvollrath/radar:slope_correction_lib.js Line 149: proj is not defined

Open ChloeDupuis opened this issue 3 years ago • 0 comments

Hi

I am trying to use the slope_correction function in GEE but I get this error "users/andreasvollrath/radar:slope_correction_lib.js Line 149: proj is not defined" and do not understand where the problem comes from. I used the following code a few months ago and it worked well so maybe something has changed. Could you please help me ?

" var batch = require('users/fitoprincipe/geetools:batch') ; var projet = "CD_Projet";

// Define Area of Interest and CRS //----------------------------------- var aoi = ee.FeatureCollection("users/AOI");

var CRS_epsg = 'EPSG:32633';

// Define a start and end date for the analysis //----------------------------------------------- var start_monitoring = ee.Date('2021-04-20'); var end_monitoring = ee.Date('2021-07-01');

// Get a collection of Sentinel-1 images in the area of interest and apply filters //-------------------------------------------------------------------------------------- var s1_collection = ee.ImageCollection('COPERNICUS/S1_GRD') .filter(ee.Filter.eq('instrumentMode', 'IW')) .filter(ee.Filter.eq('orbitProperties_pass', 'ASCENDING')) .filterDate(ee.Date(start_monitoring), ee.Date(end_monitoring)) .filterBounds(aoi) .map(maskBorder);

// Print the image collection to the console print('___'); print('Entire collection of Sentinel-1 images: ', s1_collection);

// Mask edges of scenes using angle //------------------------------------

function maskBorder(image) { var totalSlices = ee.Number(image.get('totalSlices')) var sliceNumber = ee.Number(image.get('sliceNumber')) var middleSlice = ee.Image(sliceNumber.gt(1).and(sliceNumber.lt(totalSlices))) var mask = image.select(['VV', 'VH']).mask().reduce(ee.Reducer.min()).floor() var pixelsToMask = mask.not() .fastDistanceTransform(128, 'pixels').sqrt() var metersToMask = pixelsToMask
.multiply(ee.Image.pixelArea().sqrt())
.rename('metersToMask') var notBorder = metersToMask.gte(500).and(pixelsToMask.gt(2)) var angle = image.select('angle') return image .updateMask( angle.gt(31).and(angle.lt(45)) .and(middleSlice.or(notBorder)) )
}

// Radiometric slope correction (Vollrath et al., 2020) //----------------------------------------------------------- var slope_lib = require('users/andreasvollrath/radar:slope_correction_lib.js');

// apply loaded lib function on collection (and get back corrected collection with volume model) var volume = slope_lib.slope_correction( s1_collection, // those are optional and need to be given as a dict {'model': 'surface', 'elevation': ee.Image('USGS/SRTMGL1_003'), 'buffer': 100 // buffer in meter } );

// Export to drive //-----------------

  batch.Download.ImageCollection.toDrive(
  volume,
  projet,
  {region: aoi,
  scale: 10,
  maxPixels: 10e10,
  crs: CRS_epsg})

ChloeDupuis avatar Sep 15 '21 12:09 ChloeDupuis