[GIS] Best practice for opening Sentinel 2 data with Python

pythonrasteriosentinelsentinel-2sentinel-snap

I'm just trying to learn how to process Sentinel 2 data with Python. All of the tutorials seem to use the data in GeoTIFF format. So I opened the data with SNAP and tried to export as a GeoTIFF but it says that I would need to resample to do that due to the differing pixel sizes. I don't think there should be too much of a problem doing that as long as I'm resampling down the the smallest pixel size (10m) but I'm not sure I'm going about this the right way.

What is the best practice for taking raw Sentinel (2) data and opening it with Python/rasterio?

Edit: Level 2A, in case that matters

Best Answer

If you have obtained your Sentinel-2 data from the ESA in SAFE format (or from other providers such as the DIAS that also distribute it in the same format), you should have several JPEG2000 files (.jp2 extension), one file per band.

You should encounter no issue when reading these files with rasterio, because it uses GDAL for I/O operations and GDAL handles JPEG2000 files (source). There should be no need to convert your files to GeoTIFF.

See this GIS StackExchange answer for an example of how to use rasterio to open several bands and merge them into a single file.

Related Question