I am using python to download data from GEE.
I would like to get the average of the Land Surface Temperature of all the months over the years. This is what I am doing
def returnGEEAverages(satellite, subset, gemetry, name, sdate, edate):
cover = ee.ImageCollection(satellite).filter(ee.Filter.date(str(sdate),
str(edate))).select([subset])
pcts = cover.reduce(ee.Reducer.mean())
task = ee.batch.Export.image.toDrive(
image=pcts,
folder=folderName,
region=geometry,
scale=926.625433056,
fileNamePrefix=name,
crs='epsg:4326')
task.start()
while task.active():
t = task.id
I am doing two loops over the years and the months
years = np.arange(2016, 2020, 1)
for y in years:
for months in range(1, 13):
days = calendar.monthrange(y, months)
sdate = date(y, months, 1) # start date
edate = date(y, months, days[1]) # end date
folderName = urban_gdf_cities['UC_NM_MN'][k]
geometry = returnGeometry(j)
name = str(y)+str(months)
lstDay = returnGEEPercentiles('MODIS/006/MYD11A1',
'LST_Day_1km', geometry, name+'LSTDay', sdate, edate)
I would like to know if there is a better way to do this. I found a similar solution but not for python.
dataas a geopandas dataframe withcrs='epsg:4326'? – emax May 11 '21 at 09:28