4

I'm new at Google Earth Engine and Javascript.

I'm trying to use Sentinel-2 data in the API following this tutorial of Landsat data .

According to this, it is possible to load/add a Sentinel-2 granule by naming the image like this:

COPERNICUS/S2/20151128T002653_20151128T102149_T56MNN

So, in my case, I've tried to load an existing Sentinel-2 granule, writing this:

var s2 = ee.ImageCollection('COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG');
Map.centerObject(s2, 8);

The result of this script is:

s2 image: Layer error: ImageCollection.load: ImageCollection asset 'COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG' not found.

However, if I look Sentinel-2 images in the same area of the granule with the following code:

Map.addLayer(ee.ImageCollection('COPERNICUS/S2'));
Map.setCenter(-2.44, 37.77, 12);

I can visualize the Sentinel-2 image.

How can I know the ID of the visualized image?

2 Answers 2

9

Two issues with your script:

1) A single image works best when you use ee.Image instead of ee.ImageCollection.

2) You switched up the granule name. The first part is the sensing time and the second the ingestion time. An acquisition taken in 2016 cannot be ingested in 2015. It should be 20150828T110656_20160412T015159_T30SVG not the other way round.

As a complete script (on EarthEngine):

// not in Collection - switched sensing and acquisition time
// var s2 = ee.Image('COPERNICUS/S2/20160412T015159_20150828T110656_T30SVG');
// in Collection - correct granule
var s2 = ee.Image('COPERNICUS/S2/20150828T110656_20160412T015159_T30SVG');
Map.addLayer(s2, {bands: ['B8', 'B4', 'B3'], max: 4000}, 'S2')
Map.centerObject(s2, 8);
3
  • 1
    Hi Kersten, how would I know the granule name? 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,CLOUD_COVER,GEOMETRIC_QUALITY_FLAG,GENERATION_TIME, NORTH_LAT,SOUTH_LAT,WEST_LON,EAST_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. Cannot determine how to come up with Granule Name.
    – user32145
    Commented May 16, 2017 at 3:48
  • 1
    @user32145 This is quite a complex question, especially after the naming convention changes and depending where you want to use/search the data. I think "How to determine Sentinel Productnames for EarthEngine/AWS/Google Storage/???" would warrant its own question.
    – Kersten
    Commented May 20, 2017 at 10:38
  • @Kersten i think thats the question in the first place.find my answer below. Complex it is!
    – csheth
    Commented Jun 2, 2017 at 14:36
6

This is the documentation for the Sentinel-2 dataset on the Google Cloud Platform: https://cloud.google.com/storage/docs/public-datasets/sentinel-2

This is the actual dataset: https://console.cloud.google.com/storage/browser/gcp-public-data-sentinel-2/tiles/?_ga=1.77516694.2042140325.1496307293

which refers to the military grid system that you can find here: https://mappingsupport.com/p/coordinates-mgrs-google-maps.html

Now the GRANULE numbers for images before December 2016 are slightly different.

  1. Find the first 15 digit number from https://scihub.copernicus.eu/dhus/#/home

Here the numbers will be something like this: Filename: S2A_OPER_PRD_MSIL1C_PDMC_20161019T100431_R047_V20161018T040752_20161018T042009

  1. Use the 15 digit number after PDMC_ in the above line to search within the dataset after getting the grid number:

  2. To link it with the Google Earth Engine Platform: var scene = ee.Image('COPERNICUS/S2/###############_###############_#####');

The above code line shows us how to access the data set. There are two 15 digit numbers and a 5 digit number. Presuming you are in the Google cloud dataset.

  1. The first 15 digit number in the code after ~S2/~ is the number after S2A_MSIL1C_###############_N ... .SAFE This is found in the first directory of your image, it is the acquisition date.

  2. The second number is the 15 digit number of the images nested in the GRANULE directory. This is image ingestion date and just like Kersten says and is of a latter date. For example: S2A_OPER_MSI_L1C_TL_MTI__###########################_N02.04

  3. The 5 digit number (=grid reference) is the one before N02.04.

For images after November 2016 downloading the Metadata and using the two 15 digit numbers and 5 digit grid code from generally the last 3-5 lines of the data set and whichever has the .jp2 file extension: GRANULE/L1C_#####A008081###############/QI_DATA/#####_###############_PVI.jp2

Here the first 5 digit number after L1C_ and QI_DATA/ is the grid code. The rest two are either of the two 15 digit numbers.

Phew I hope everyone understands this.

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.