Using the Copernicus Open Access Hub with the Sentinel Python API to source and process satellite rasters for zonal statistics.
Below is an example of an RGB GeoTIFF layer produced by the program. This layer can be loaded into any GIS applications such as ArcGIS and QGIS.
Download and unzip the latest release here. Unzip into location of your choice.
IMPORTANT: Specifications on the Python versions used and the packages installed can be found in requirements.txt
.
-
Navigate to the Copernicus Open Access Hub and create an account: https://scihub.copernicus.eu/dhus/#/self-registration
-
Your username and password will be used to access the SentinelAPI within the script
-
Open
sentinel_query.py
and enter your credentials as theUSER
andPASS
constant variables. -
Customize search parameters
COUNTRY
,YEAR_SEARCH
, andCLOUD_COVER
to search predefined country locations or perform a custom latitude/longitude search for any location by setting the booleanCUSTOM
toTrue
. -
Run the script. The average file size is around 900MB and downloads range from 2-14 minutes.
-
Downloaded imagery can be located in your working directory at
../data/image
-
Open
image_processing.py
and adjust theFOLDER
constant variable to the name of the satellite data in../data/image
. ex.FOLDER = 'sentinelUS'
. -
Run the script.
-
The following files have been written:
- RGB .tif file will be output to
../data/processed/rgb
. - NDVI .tif file will be output to
../data/processed/ndvi
. - NDWI .tif file will be output to
../data/processed/ndwi
.
- RGB .tif file will be output to
-
The mean vegitation and water density of the rasters are also printed to the console.
Below are two examples of NDVI and NDWI layers produced by the image processesing steps. The layers are produced using Sentinel-2 data of the greater Seattle area. These layers can be loaded into GIS applications such as ArcGIS or QGIS.
NDVI | NDWI |
---|---|
![]() |
![]() |