I define the following ImageCollection, which is 24 hourly images from a single day:
collection = ee.ImageCollection("ECMWF/ERA5_LAND/HOURLY").select("total_precipitation")
collection = collection.filterDate("2020-01-01", "2020-01-02")
Then I download the first image in the collection:
region = ee.Geometry.Polygon([
(-119.69680109161911, 37.9180436245507),
(-119.23634853488707, 37.9180436245507),
(-119.23634853488707, 37.57830484843708),
(-119.69680109161911, 37.57830484843708),
(-119.69680109161911, 37.9180436245507)
])
img = collection.first()
task = ee.batch.Export.image.toDrive(
img.toFloat(),
description="sample_hourly_image",
fileNamePrefix="sample_hourly_image",
region=region,
fileFormat="GeoTIFF")
task.start()
After downloading I can open this image and convert to a numpy array, which looks as follows - with 4 rows and 6 columns:
Then I want to take the mean of all 24 hourly images in the collection to produce a single image of mean temperature for that day. This is what I tried:
daily_img = collection.mean()
task = ee.batch.Export.image.toDrive(
daily_img.toFloat(),
description="sample_daily_image",
fileNamePrefix="sample_daily_image",
region=region,
fileFormat="GeoTIFF",
)
task.start()
However this time when I download the image and convert to a numpy array it only has a single scalar value:
What am I doing wrong here?