My goal is to download RGB imagery over a selection of regions and times. To do this, I am using the geemap python library to locally export a filtered image collection. However, the images are exported as almost solid colour blocks, except for the last two image rows. After investigating the metadata of faulty images, I noticed that all the faulty images have MGRS_TILE=32UMG. At first, I thought I could filter the collection to only download images with MGRS_TILE=32VMH, as those look fine for this region, using the following command:
col = ee.ImageCollection('COPERNICUS/S2_SR') \
.filterBounds(bbox) \
.filterDate('2018-01-01', '2018-12-31') \
.select(band_list) \
.filter(filterCloudCoverage) \
.filterMetadata('MGRS_TILE','equals','32VMH')
but that filters out good looking images with the 32UMG code for different regions I need to cover.
Is there a way to filter these solid colour images, or do I have to somehow find and delete these images later on?
I do not care if the exported image is 32UMG or 32VMH, but I do care about the overall number of images exported as I am using this number for some statistics.
If such a thing is not possible, could you explain to me why is this happening?
The attached picture shows how the same image is downloaded twice, once with MGRS_TILE=32UMG and faulty, and then again with MGRS_TILE=32VMH.
Here is my code:
import ee
ee.Initialize()
import geemap
import os
filterCloudCoverage = ee.Filter.lt('CLOUD_COVERAGE_PERCENTAGE', 50)
filterNoData = ee.Filter.lt('NODATA_PIXEL_PERCENTAGE', 10)
proj=ee.Projection('EPSG:25832')
bbox = ee.Geometry.Rectangle([440000, 6200000, 450000, 6210000],proj, True, False)
band_list = ['TCI_R','TCI_G','TCI_B']
out_dir_samples = os.path.join(os.path.expanduser('~'), 'Downloads/EE/RGB')
filename = os.path.join(out_dir_samples, 'metadata.csv')
col = ee.ImageCollection('COPERNICUS/S2_SR') \
.filterBounds(bbox) \
.filterDate('2018-01-01', '2018-12-31') \
.select(band_list) \
.filter(filterCloudCoverage)
geemap.ee_export_image_collection(col, out_dir=out_dir_samples, scale=10, crs='EPSG:25832', region=bbox)
feature_col = ee.FeatureCollection(col)
geemap.ee_to_csv(feature_col, filename=filename)