Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/developmentseed/sentinel-2-cog
Convert Sentinel-2 JPEG 2000 to COG with AWS Lambda
https://github.com/developmentseed/sentinel-2-cog
Last synced: 3 months ago
JSON representation
Convert Sentinel-2 JPEG 2000 to COG with AWS Lambda
- Host: GitHub
- URL: https://github.com/developmentseed/sentinel-2-cog
- Owner: developmentseed
- License: mit
- Created: 2019-04-26T16:33:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T15:32:17.000Z (almost 2 years ago)
- Last Synced: 2024-05-16T11:55:45.979Z (6 months ago)
- Language: Python
- Homepage: https://gist.github.com/vincentsarago/0e8c3fba19a4b2b6855bca77f18b88fb
- Size: 340 KB
- Stars: 17
- Watchers: 5
- Forks: 4
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-earthobservation-code - Sentinel-2-cog - Convert Sentinel-2 JPEG 2000 to COG with AWS Lambda `Python` (`Python` processing of optical imagery (non deep learning) / Cloud Native Geospatial)
README
# sentinel2 to COGEO
Use AWS Lambda and [rio-cogeo](github.com/cogeotiff/rio-cogeo) to convert Sentinel-2 JPEG2000 to CloudOptimized GeoTIFF.
## Deployment
#### Package Lambda
Create `package.zip`
```bash
$ docker-compose build --no-cache
$ docker-compose run --rm package
```#### Deploy to AWS
```bash
$ npm install
$ sls deploy --bucket my-output-bucket
```## Use
A CLI is porvided within this repo to invoke the lambda function directly.
```bash
$ python scripts/invoke.py --help
Usage: invoke.py [OPTIONS] SCENEIDInvoke Lambda.
Options:
-b, --bidx TEXT Band index to copy [required]
--stage TEXT Stack stage
--function TEXT Function's name
--region TEXT AWS Lambda region
--help Show this message and exit.
```sentinel-2-cog works with Sentinel scene id as defined by [rio-tiler](https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/sentinel2.py#L40-L67)
### Example
```bash
$ python scripts/invoke.py S2B_tile_20190421_18TXR_0 --bidx 04 --bidx 03 --bidx 02
```## Cost
Each band is processed in ~40Sec, meaning that if you want to process 1M scenes with 4 bands (04, 03, 02, 08) it should cost you around 11$ + the datatransfer (writing to S3).
## Contribution & Development
Issues and pull requests are more than welcome.
**Dev install & Pull-Request**
```
$ git clone http://github.com/developmentseed/sentinel-2-cog.git
$ cd sentinel-2-cog
$ pip install -e .[dev]
```**Python >=3.6 only**
This repo is set to use `pre-commit` to run *flake8*, *pydocstring* and *black* ("uncompromising Python code formatter") when committing new code.
```
$ pre-commit install
$ git add .
$ git commit -m'my change'
black....................................................................Passed
Flake8...................................................................Passed
Verifying PEP257 Compliance..............................................Passed
$ git push origin
```## About
Created by [Development Seed]()