Search and download of Sentinel, Landsat and Planet crops.
Time Series Downloader (TSD)
Automatic download of Sentinel, Landsat and Planet crops.
Carlo de Franchis, CMLA, ENS Cachan, Université Paris-Saclay, 2016-19
The main source code repository for this software is https://github.com/cmla/tsd.
Installation and dependencies
The main dependency is GDAL. All the others can be installed
pip as shown in the next section.
gdal can be installed with
apt-get. In order to get a
recent version we recommend adding the PPA
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable sudo apt-get update sudo apt-get install libgdal-dev gdal-bin
There are several ways of installing
gdal. I recommend option 1 as it
gives a version of gdal 2.3 that works with JP2 files.
Note: a shell script installing all the needed stuff (
gdal...) on an empty macOS system is given in the file
Option 1: using the GDAL Complete Compatibility Framework.
and install the
.dmg file. Update your
PATH after the installation by
running this command:
Copy it in your
Option 2: using brew
brew install gdal --with-complete
Note that this version doesn't support JP2 files (hence it will fail to get Sentinel-2 crops).
Install TSD as a python package
gdal is installed on your machine you can install
git clone https://github.com/cmla/tsd cd tsd pip install numpy # required by rasterio pip install -e . --no-binary rasterio
tsd can also be installed without downloading a tarball or a git clone:
pip install --upgrade https://github.com/cmla/tsd/tarball/master --no-binary rasterio
Search and download is performed by
get_sentinel1.py (one file per satellite constellation).
They can be used both as command line scripts or as Python modules.
They use the Python modules
search_planet.py (one file per API provider).
From the command line
TSD can be used from the command line through the Python scripts
get_*.py. For instance, to download and process Sentinel-2 images of the
Jamnagar refinery, located at latitude 22.34806 and longitude 69.86889, run
python get_sentinel2.py --lat 22.34806 --lon 69.86889 -b B02 B03 B04 -o test
This downloads crops of size 5000 x 5000 meters from the bands 2, 3 and 4,
corresponding to the blue, green and red channels, and stores them in geotif
files in the
It should print something like this on
stdout (the number of images might vary):
Found 22 images Elapsed time: 0:00:02.301129 Downloading 66 crops (22 images with 3 bands)... 66 / 66 Elapsed time: 0:00:57.620805 Reading 22 cloud masks... 22 / 22 6 cloudy images out of 22 Elapsed time: 0:00:15.066992
Images with more than half of the pixels covered by clouds (according to the
cloud polygons available in Sentinel-2 images metadata, or Landsat-8 images
quality bands) are moved in the
To specify the desired bands, use the
--band flag. The crop size can
be changed with the
--height flags. For instance
python get_sentinel2.py --lat 22.34806 --lon 69.86889 -b B11 B12 --width 8000 --height 6000
downloads crops of size 8000 x 6000 meters, only for the SWIR channels (bands 11 and 12).
All the available options are listed with the
python get_sentinel2.py -h
You can also run any of the
search_*.py scripts from the command line
separately. Run them with
-h to get the list of available options. For a
nice output formatting, pipe their output to
brew install jq).
python search_devseed.py --lat 22.34806 --lon 69.86889 | jq
As Python modules
The Python modules can be imported to call their functions from Python. Refer to their docstrings to get usage information. Here are some examples.
# define an area of interest import tsd lat, lon = 42, 3 aoi = tsd.utils.geojson_geometry_object(lat, lon, 5000, 5000) # search Landsat-8 images available on the AOI with Development Seed's API x = tsd.search_devseed.search(aoi, satellite='Landsat-8')
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size tsd-0.6.0.tar.gz (42.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|