Giter Site home page Giter Site logo

ddachkinov / sentinel-downloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rpitonak/sentinel-downloader

0.0 1.0 0.0 76 KB

Library and CLI tool for downloading satellite images from the https://www.sentinel-hub.com/

License: MIT License

Dockerfile 1.88% Python 95.28% Makefile 2.84%

sentinel-downloader's Introduction

Sentinel Downloader Build Status

Library and CLI tool for downloading satellite images from the sentinel-hub.com

Providing access to Sentinel Hub

Sentinel Downloader is automation tool for downloading imagery from sentinel-hub.com. You need to have account in order to access the data and provide access token (instance ID) to start using this tool. Instance ID can be found in your dashboard in Configuration Utility section.

Usage without installation

If you want to use this tool you can easily do it with published docker image:

$ docker pull zaitra/sentinel-downloader
$ docker run -it --rm -v <PATH_TO_IMAGES>:/tmp/images -v <PATH_TO_CONFIG_FILE>:/.sd.yaml -e SD_SENTINEL_INSTANCE_ID=<INSTANCE_ID> zaitra/sentinel-downloader bash -c "sentinel-downloader download -c /.sd.yaml"
  • <PATH_TO_IMAGES> - directory where the images will be stored (absolute path on host)
  • <PATH_TO_CONFIG_FILE> - absolute path on host to configuration file .sd.yaml
  • <INSTANCE_ID> - access token to Sentinel Hub (instance ID)

Configuration

Example

debug: true
layers:
  - "TRUE-COLOR-S2-L1C"
times:
  -  ["2015-05-01", "2015-08-30"]
  -  ["2016-05-01", "2016-08-30"]
  -  ["2017-05-01", "2017-08-30"]
  -  ["2018-05-01", "2018-08-30"]
  -  ["2019-05-01", "2019-08-30"]

# area of interest. Coordinates representing top left x,y and right bottom x,y
bounding_box: [14.42, 50.42, 14.42, 50.42]

width: 42
height: 42

max_cloud_percentage: 0.42

images_dir: "/tmp/images/"

Here are the configuration options:

Option Description Required
debug Provide debug logs. Default is False No
layers List of layers from sentinel-hub configuration Yes
bounding_box Bounding box location Yes
times Array of time ranges Yes
width Image width No
height Image height No
max_cloud_percentage Max cloud coverage. Default is 1 No
image_dir Path to directory where images should be saved. Yes

If image width and height are not specified, the highest resolution will be used. If one of the photo resolution (width or height) is not specified, it would be set automatically in a way that image would best fit bounding box ratio.

Docker

Installation

$ git clone https://github.com/zaitra/sentinel-downloader
$ cd sentinel-downloader
$ touch .sd.yaml  # configurarution file has to be in the root directory of this project
$ vim .sd.yaml  # edit as described in Configuration section
$ make build  # builds docker image

Usage

Run docker command

$ docker run -it --rm -v <PATH_TO_IMAGES>:/tmp/images -e SD_SENTINEL_INSTANCE_ID=<INSTANCE_ID> zaitra/sentinel-downloader:dev bash -c "sentinel-downloader download -c /src/.sd.yaml"

or use Makefile

$ make run-in-container INSTANCE_ID=<INSTANCE_ID> LOCAL_IMAGE_DIR=<PATH_TO_IMAGES> CONFIG_FILE=<PATH_TO_CONFIG_FILE>

Defaults are: <PATH_TO_IMAGES> = /tmp/images <PATH_TO_CONFIG_FILE> = $(PWD)/.sd.yaml <INSTANCE_ID> = exported Sentinel Instance Id into SD_SENTINEL_INSTANCE_ID env variable

CLI

Prepare environment

Add your instance ID to your environment.

$ echo "export SD_SENTINEL_INSTANCE_ID=<INSTANCE_ID>" >> .env
$ source .env

Installation

$ pip3 install git+https://github.com/zaitra/sentinel-downloader

Usage

sentinel-downloader download -c <PATH_TO_CONFIG_FILE>

Logging

The default logging level is INFO. If you want to enable DEBUG logs, create .env file with variable SD_DEBUG=1 and load it to your environment.

$ echo "export SD_DEBUG=1" >> .env
$ source .env

Since structlog is used for logging, you can have nice colorized output in the CLI. You just need to install colorama.

$ pip3 install colorama

You can also switch between JSON logs renderer good for logs management services (enabled by SD_JSON_LOGS=1) or console render.

$ echo "export SD_JSON_LOGS=1" >> .env

References

This tool uses official Sentinel hub python library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.