The following automation interfaces are described next:
- Product searches
- Download products
- Download a whole directory
- Incremental download
The simplest way of finding data products in CODE-DE is using OpenSearch queries. The following example demonstrates an OpenSearch URL with a time specification of one day and an area of interest (AOI) over Germany, OpenSearch URL example:
Paging can be achieved by adding the parameters &startPage=1
or &startRecord=1
to the URL
and you can specify the page size with &maximumRecords=100
https://catalog.code-de.org/opensearch/description.xml?parentIdentifier=EOP:CODE-DE:S2_MSI_L1C]
for example to locate the &cloudCover=[0,20]
parameter.
💡 Note: you can extract an prepared OpenSearch query from the CODE-DE Catalog Client by setting-up the desired filter parameters and taking the executed query from the Browser debug window (visible after pressing F12 key and in the network tab right-click on the openasearch URL, then copy address)
The most effective way of downloading CODE-DE data products is using the HTTP Download Service. The download URLs can be extracted from the above OpenSearch query result. A utility script is included in this package. The follwing bash script snippet demonstrates the process:
#!/usr/bin/bash
baseUrl=https://catalog.code-de.org/opensearch/request/?httpAccept=application/atom%2Bxml
parentIdentifier=EOP:CODE-DE:S2_MSI_L1C
startDate=2017-01-04T00:00:00.000Z
endDate=2017-01-04T23:59:59.999
AOI=5.9,47.2,15.2,55
batchSize=100
downloadParallel=4
# execute query and extract the dwnload URL list
urls=$(curl "${baseUrl}&parentIdentifier=${parentIdentifier}&startDate=${startDate}&endDate=${endDate}&bbox=${AOI}&maximumRecords=${batchSize}" | xmllint --xpath '//*[local-name()="link" and @title="Download"]/@href' - |sed -e 's/ *href="//g' | tr '"' '\n' )
# download them all to the local directory
echo $urls | xargs -n1 -P4 curl -O
💡 the above command can be assembled to run as a bash one-liner.
-u <user>:<password>
parameter.
Another example to download a whole directory from the download server:
Download directories
wget -O- -nv https://code-de.org/Sentinel2/2016/06/14 2> /dev/null | grep 'a href=".*.zip' | cut -d'"' -f2 ; done | head -10 | xargs -n1 -P10 -I{} wget http://code-de.org/download/{}
This command can be enhanced to filter for specific Sentinel-2 tiles, based on the new compact file naming convention,
inserting another | grep _T32UPU_
filter (example tile over munich).
The script dataHubTransfer.sh provides the means to incrementally download new products from a DHuS (ESA Data Hub Software). CODE-DE operates a DHuS mirror providing access to Sentinel prodcuts. The script is intended to be run in a cron job. Instructions are included in the README.md and in the script header itself.