Sentinel 2 data import using ENVI version 5.3

If you are using ENVI version 5.4 or greater please see the much simpler instructions on importing Sentinel 2 data.  The YCEO Lab currently uses ENVI 5.4.1 so if you are working in the Center, please follow the separate ENVI 5.4 instructions. 

These instructions are for those using ENVI version 5.3.

Sentinel 2 data use very long folder and filenames that may cause problems in the Windows operating system.  You should extract (unzip) the data into a folder near the top of the file structure.  By this we mean U:\  rather than something like:  U:\Project\Rasters\Sentinel\MyNewData\ImageDate.  Once the data are extracted rename the new data folder to a shorter name.  For example, a typical Sentinel data folder name might be: 
S2A_OPER_PRD_MSIL1C_PDMC_20160613T000058_R084_V20160612T181447_20160612T181447.SAFE.  You should rename this to something like:  June10

In December 2016 the ESA revised their naming conventions and data packaging structures.  This impacts how we can access these data.  On the USGS Earth Explorer site data in the original format can be identified by the ENITY ID beginning with “S2A_OPER” and were acquired until 5 December 2016.  These data can be opened in ENVI 5.3.x. 

Data acquired from 6 December 2016 on have an ENTITY ID beginning with “L1C_T” and use the new format and naming convention.  If you do not have ENVI version 5.4 you can open these files using the European Space Agency program SNAP in the Sentinel-2 Toolbox, available here.  Instructions on how to import these data can be found below.

S2A_OPER format:

From the main ENVI menu select File | Open As | Optical Sensors | Sentinel 2.  Navigate into the new folder and select the XML file.  This will also be a very long filename such as:
S2A_OPER_MTD_SAFL1C_PDMC_20160613T000058_R084_V20160612T181447_20160612T181447.xml

ENVI should open the data into files based on spatial resolution.  You can examine the data and save the file to ENVI format if you wish to use these data in the future.  From the ENVI main menu select File | Save As | ENVI Standard.  Save this file to a new folder structure for your project; it should not be placed in any of the original Sentinel folders.  Consider including 10m or 20m as part of the filename to distinguish the resolution.

In some cases ENVI will generate an error message such as: 
       File: S2A_OPER_MSI…..  File does not appear to be a valid JPEG2000 file
This message is generated when the XML header file references data that are not part of the distribution package provided by the USGS.  You will need to edit the XML file to remove these references. 

First determine what files are provided in your package.  Using the Windows File Explorer open the Snetinel data folder.  Search for and double click on the folder Granule | S2A… (the long name again) | IMG_Data.  Expand the column width to show the full file name.  A typical filename is:
  S2A_OPER_MSI_L1C_TL_SGS__20160612T214651_A005086_T12TWM_B01.jp2

You want to keep any data references to the files ending with T12TWM and remove the rest.

First make a backup copy of the XML file used to open the data.  Now open the original XML file using the text editor Notepad++ found on the YCEO systems.  Scroll down to the  <Product_Organisation> section and examine the many <Granule_List> … </Granule_List> entries.  Remove all but the entry that refers to your specific data set.  In this example, this would be the <Granule_List> that has images with T12TWM as the end part of the filenames.  Save the XML file and return to ENVI to open this as you did earlier.  ENVI should create three new files based on the spatial resolution.

L1C_T format:

ENVI 5.3.1 cannot be used to open Sentinel 2 data in this new format.  You can open these data using the ESA Sentinel-2 Toolbox program SNAP.  This is installed on the YCEO Lab systems.  You can also download this software from the ESA site:
  https://sentinel.esa.int/web/sentinel/toolboxes/sentinel-2

The ESA website has links to documentation and YouTube videos to instruct users.  While you can view and manipulate these data quite easily in SNAP, it is a bit difficult to export these data into a format that can be used by ENVI.  In order to export these data, they must all have a common spatial resolution.  So if you want to use the four 10-meter bands you must resample the entire file to 10 meters. (this is a very large file!)  You can then open this in ENVI and spectrally subset this to extract just the four bands of interest.  You should then delete the large work files.  Again, if you have ENVI version 5.4 you do NOT need to do this.

Category: