2

How would I know the granule name for sentinel data in Google Earth Engine? I tried to look up the granule name in the "index.csv.gz" (gs://gcp-public-data-sentinel-2/index.csv.gz) and "scihub" but cannot get the code running. Here are the field names in the index.csv.gz GRANULE_ID,PRODUCT_ID,DATATAKE_IDENTIFIER,MGRS_TILE,SENSING_‌TIME,TOTAL_SIZE,CLOU‌​D_COVER,GEOMETRIC_QU‌​ALITY_FLAG,GENERATIO‌​N_TIME, NORTH_LAT,SO‌​UTH_LAT,WEST_LON,EAS‌​T_LON,BASE_URL.

On the other hand this is the sample granule ID I got from scihub: S2A_OPER_MSI_L1C_TL_EPA__20170512T230414_A002288_T50PQA_N02.‌​04.

I am struggling how to determine sentinel ID (specifically Granule ID) in Google Earth Engine.

1 Answer 1

7

In the Earth Engine public data catalog, Sentinel-2 data is stored in the "COPERNICUS/S2" image collection. The naming convention for the images is described on the Sentinel-2: MultiSpectral Instrument (MSI), Level-1C dataset description page:

Each Sentinel 2 product (zip archive) contains multiple granules. Each granule becomes a separate Earth Engine asset. EE asset ids for Sentinel 2 assets look like this: COPERNICUS/S2/20151128T002653_20151128T102149_T56MNN. Here the first numeric part represents the sensing date and time, the second numeric part represents the product generation date and time, and the final 6-character string is a unique granule identifier indicating its UTM grid reference (see MGRS).

A typical workflow for Sentinel-2 data analysis is to start with the entire Sentinel-2 collection, and then apply spatial and temporal filters:

// Define an object that refers to the Sentinel-2 collection.
var s2 = ee.ImageCollection("COPERNICUS/S2");

// Filter the Sentinel-2 collection by time and location.
var roi = ee.Geometry.Point([-5.55, 35.96]);
var s2_filtered_1 = s2.filterDate('2017-05-01', '2017-06-01')
                      .filterBounds(roi);
print('Collection filtered by time and location', s2_filtered_1);

To obtain the Granule IDs, you can extract metadata from the images in the filtered collection:

// Extract the Granule ID(s) from the metadata of images in the collection.
var granual_id_list = ee.Dictionary(
  s2_filtered_1.aggregate_histogram('GRANULE_ID')
).keys();
print('GRANULE_ID list', granual_id_list);

You can also filter collections by arbitrary metadata, which allows you easily access an image based on the product ID found on the Copernicus Open Access Hub:

// Filter the Sentinel-2 collection by Product ID obtained from the
// Copernicus Open Access Hub.
var id = 'S2A_MSIL1C_20170512T093041_N0205_R136_T34TDN_20170512T093649';
var s2_filtered_2 = s2.filterMetadata('PRODUCT_ID', 'equals', id);
print('Collection filtered by product ID', s2_filtered_2);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.