Package: tsd
Time Series Downloader (TSD)Automatic download of Sentinel, Landsat and Planet crops.Carlo de Franchis,
CMLA, ENS Cachan, Université Paris-Saclay, 2016-19With contributions fromEnric Meinhardt-Llopis,Axel DavyandTristan Dagobert.The main source code repository for this software ishttps://github.com/cmla/tsd.Installationtsdis easily installed from sources withpip:git clone https://github.com/cmla/tsd
cd tsd
pip install -e .Alternatively,tsdlatest release can also be installed from PyPI:pip install tsdUsageSearch and download is performed byget_sentinel2.py,get_landsat.py,get_planet.pyandget_sentinel1.py(one file per satellite constellation).
They can be used both as command line scripts or as Python modules.They use the Python modulessearch_stac.py,search_scihub.py,search_peps.pyandsearch_planet.py(one file per API provider).From the command lineTSD can be used from the command line through the Python scriptsget_*.py. For instance, to download and process Sentinel-2 images of the
Jamnagar refinery, located at latitude 22.34806 and longitude 69.86889, runpython get_sentinel2.py --lat 22.34806 --lon 69.86889 -b B02 B03 B04 -o testThis 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 thetestdirectory.It should print something like this onstdout(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.066992Images 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 thetest/cloudysubfolder.To specify the desired bands, use the-bor--bandflag. The crop size can
be changed with the--widthand--heightflags. For instancepython get_sentinel2.py --lat 22.34806 --lon 69.86889 -b B11 B12 --width 8000 --height 6000downloads crops of size 8000 x 6000 meters, only for the SWIR channels (bands 11
and 12).All the available options are listed with the-hor--helpflag:python get_sentinel2.py -hYou can also run any of thesearch_*.pyscripts from the command line
separately. Run them with-hto get the list of available options.  For a
nice output formatting, pipe their output tojq(brew install jq).python search_stac.py --lat 22.34806 --lon 69.86889 | jqFor example, this should print ready to usecurlcommands for downloading
Sentinel-5P netCDF files:python search_scihub.py --lon 2 --lat 48 -s 2020-3-1 --satellite Sentinel-5P --product-type L1B_RA_BD8 | jq -r '.[] | "curl --user s5pguest:s5pguest \"\(.links.alternative)\\$value\" > \(.title).nc"'As Python modulesThe 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 a STAC API
x = tsd.search_stac.search(aoi, satellite='Landsat-8')Common issuesWarning: Arasterioissue on Ubuntu causes the need for this environment
variable (more info onrasterio's
github):export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt