I'm trying to export the ERA5daily Image Collection data from Google Earth Engine using the GEE API in python. I need the Max Temp
, Min Temp
and Average Temp
for the time between 1979 and 2016 (in the example here just 1 day for convenience), within a specific bbox.
Basically I need the temperature time series (max, min, avg) for each grid within my geometry object, because I want to calculate different indices of temperature variability and extremes afterwards.
Unfortunately I haven't had much success so far. I managed to export single .tif images with the GEE Code Editor in JavaScript but it seems quite unreliable and I would have to press 'Run' thousands of times. I've read that for batch exports the Python API is recommended.
Below is the code I have tried so far, adopted from GEE Tools
This code works for exporting the images in .tif, however I'm running into several problems. First I don't manage to select the bands. In the GEE code editor this works with
var col = ee.ImageCollection('ECMWF/ERA5/DAILY').select()
But in Python it just doesn't export anything to drive when I use it.
Secondly I can't figure out what the scale parameter does. The default setting is 30, which leads to massive files (and the need to increase maxPixels
). When I set it to a higher value however the data stored in the .tif changes. So not really sure what to do about that.
I know there is likely a much better way to extract such large time series to reduce file size.
from geetools import batch
import ee
ee.Initialize()
region = ee.Geometry.Rectangle([79, 25, 89, 31])
col = ee.ImageCollection("ECMWF/ERA5/DAILY")\
.filterDate('1979-01-02', '1979-01-03')\
.filterBounds(region)
batch.Export.imagecollection.toDrive(col, "ERA5", region=region)