Release of sentinelhub Python Package 2.0
Good news, we have recently released version 2.0 of Sentinel Hub’s main open-source Python package for Earth observation research.
In case you haven’t yet heard about sentinelhub Python package - it contains a collection of tools for downloading, managing and transforming satellite data. It primarily supports Sentinel Hub Services, however it also provides data from other sources and has a wide range of useful utilities. The code is available at GitHub repository.
Since the previous blog post about sentinelhub a lot has happened. We have been constantly improving, bug fixing and expanding the package according to users’ wishes and internal demands. Here are the main changes of sentinelhub package in the last 3 months:
More Data Sources
In order to fully support Sentinel Hub Services the package was upgraded to work with more satellite sources. Besides Sentinel-2 L1C the package now also provides an easy access to Sentinel-2 L2A, Sentinel 1, Landsat 8, MODIS and Mapzen DEM data. This enables you to analyze and combine data not only from different locations and times but also from different satellite sources. Detailed examples are a part of documentation.
Custom URL Parameters
Easier Package Configuration
The package installation contains a config.json file with various configurable parameters. From now on you don’t have to manually seek and edit this file but instead can examine and edit it in command line:
$ sentinelhub.config --show
"instance_id": "<here goes your Sentinel Hub instance id>",
"aws_access_key_id": "<here goes your AWS access id>",
"aws_secret_access_key": "<here goes your AWS access key>",
Instead of writing your Sentinel Hub instance id in the code you can simply set it in the configuration file:
$ sentinelhub.config --instance_id <your instance id>
More in the documentation.
Download Sentinel-2 L2A Products in .SAFE Format From AWS
Since the initial release the package enabled downloading Sentinel-2 L1C data from AWS into .SAFE format defined by ESA. As this turned out to be a popular feature in the community the package now also supports download of Sentinel-2 L2A data into .SAFE format. The same as before this can be simply done in command line
$ sentinelhub.aws --product S2A_MSIL2A_20180402T151801_N0207_R068_T33XWJ_20180402T202222
or within Python code. Check examples for more.
However, because L2A data is only available at s3 Requester Pays Bucket you first have to set your AWS credentials in package’s config.json file:
$ sentinelhub.config --aws_access_key_id <your access id> --aws_secret_access_key <your access key>
Soon even access to L1C data at AWS will become limited to Requester Pays Bucket therefore the next update of sentinelhub will already allow you to choose between http and s3 download source.
Utilities For Large Areas
Many times the final phase of a research project is upscaling the processing over a large geographical area. In order to support this process sentinelhub now works with shapely Python package for geometrical manipulations. The new version of sentinelhub also contains tools for dividing polygons into smaller bounding boxes for which data can be obtained separately using WMS/WCS requests. These are described in examples and more such functionalities are planned to be added in the future.
Reversed Coordinate Order
Beware, there is also one code-breaking change in sentinelhub Python package version 2.0. In previous versions you had to specify bounding box coordinates in order latitude-longitude while working in WGS84. That was in accordance with OGC standard 1.3.0 for WMS requests. However after a lot of consideration the order in new version was reversed into longitude-latitude. It is now in accordance with commonly used projection library PROJ which will remain the standard for coordinate order or sentinelhub package in the future. Hopefully the order will now be compatible with the majority of geographical data standards.
The order of coordinates remains the same in any other coordinate reference system supported by the package.
A nice blog post describing general lon-lat, lat-lon confusion:
Geospatial software has a fundamental inconsistency: which order we put longitude and latitude in. Below, a table of…macwright.org
Thanks For Support
Many thanks to users who contributed to the package or provided their feedback. Many improvements were done because of your effort.
Our team will continue to expand Sentinel Hub open-source Python codebase and keep you posted. If you have any questions or feedback in the meantime, feel free to contact us.