Skip to content

Instantly share code, notes, and snippets.

@PratyushTripathy
Last active July 16, 2022 19:17
Show Gist options
  • Save PratyushTripathy/3dec556062bedfa46762e98c92732ba6 to your computer and use it in GitHub Desktop.
Save PratyushTripathy/3dec556062bedfa46762e98c92732ba6 to your computer and use it in GitHub Desktop.
// define a function to pull Landsat data for a given footprint
var band_names = ['Blue', 'Green', 'Red', 'NIR', 'SWIR1', 'Thermal', 'SWIR2'];
function get_landsat_for_aoi(aoi){
return ee.ImageCollection("LANDSAT/LT05/C02/T1_L2").filterBounds(aoi)
// fetching scenes for Jan-May of 2010 and 2011
.filter(ee.Filter.calendarRange(2010, 2011,'year')).filter(ee.Filter.calendarRange(1,5,'month'))
.select(['SR_B1', 'SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'ST_B6', 'SR_B7'],
band_names)
.filter(ee.Filter.lte('CLOUD_COVER', 30))
.reduce(ee.Reducer.percentile([25]))
.select(['Blue_p25', 'Green_p25', 'Red_p25', 'NIR_p25', 'SWIR1_p25', 'Thermal_p25', 'SWIR2_p25'],
band_names).toDouble();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment