=> Note : the apihub is only accessible for those of you who submitted an account before the 21st of December. As a result, it is much easier to download the Sentinel- products at CNES PEPS facility. To access the data within PEPS, I have written a similar program to the one described below . The Sentinel Scihub interface lets you search the catalog or download Sentinel data through a simple https request. For instance, to search all the S2 products within the catalog, just try the following URLs : To select all the products which contain Toulouse :

• you may login with your own Scihub account or with « guest », « guest »
• All you need to know are your site  Lat, Lon (in this order) coordinates.

To select all the products which contain Toulouse ingested in the catalog after the first of December :

python  Sentinel_download.py -s S2 --latmin 43 --latmax 46 --lonmin -1 --lonmax 2 -a apihub.txt -o 94 -m 25 -d 20151206

Here is the meaning of the options :

• -s defines the satellite (S2, S2A, S2B, S1, S1, S1B)
• --latmin 43 --latmax 46 --lonmin -1 --lonmax 2 define the bounding box in degrees (you can also only specify a point with --lat and --lon options)
•  - a apihub.txt provide the authentification to the website (guest guest still works)



• -o is the path number (if you only want that one)



• -m 25 is the maximum accepted cloud percentage to download (25%)



• -d 20151206 is the start date of the period, and the download goes until now, unless you specify the final date (with -f option)

So, if you want to use this tool, get it from the github repository of sentinel-download.

## 71 thoughts on “A python module for batch download of Sentinel data from ESA”

1. Omar dit :

Dear Sir, I tried to use the python script for downloading S1 data as described in the readme file. I got the following message and I do not fine any data on my hard disk. Would you please provide some info on the error and where the data will downloadedThanks in advance,Best regards2016-02-02 17:12:58 (422 KB/s) – ‘query_results.xml’ saved [26693]d1aed4e0-8991-4d05-93bf-02eb532ac93c===============================================S1A_IW_SLC__1SDV_20160201T173911_20160201T173938_009756_00E41D_15E6.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘d1aed4e0-8991-4d05-93bf-02eb532ac93c’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160201T173911_20160201T173938_009756_00E41D_15E6.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘d1aed4e0-8991-4d05-93bf-02eb532ac93c’)/\$value »970a37cf-4dd5-4f8c-bb9a-35b51694ecbe===============================================S1A_IW_SLC__1SDV_20160201T173847_20160201T173914_009756_00E41D_0DD9.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘970a37cf-4dd5-4f8c-bb9a-35b51694ecbe’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160201T173847_20160201T173914_009756_00E41D_0DD9.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘970a37cf-4dd5-4f8c-bb9a-35b51694ecbe’)/\$value »7e2dce33-6006-48aa-8ced-c0bd29385583===============================================S1A_IW_SLC__1SDV_20160201T173936_20160201T174003_009756_00E41D_87EF.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘7e2dce33-6006-48aa-8ced-c0bd29385583’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160201T173936_20160201T174003_009756_00E41D_87EF.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘7e2dce33-6006-48aa-8ced-c0bd29385583’)/\$value »1b77b2df-d7e1-4897-8542-4a697cd54bb7===============================================S1A_IW_SLC__1SDV_20160131T055228_20160131T055255_009734_00E382_758A.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘1b77b2df-d7e1-4897-8542-4a697cd54bb7’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160131T055228_20160131T055255_009734_00E382_758A.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘1b77b2df-d7e1-4897-8542-4a697cd54bb7′)/\$value »60cb9cfd-f21c-45e0-9331-a5ef2012fcf8===============================================S1A_IW_SLC__1SDV_20160131T055202_20160131T055230_009734_00E382_C67D.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(’60cb9cfd-f21c-45e0-9331-a5ef2012fcf8′)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160131T055202_20160131T055230_009734_00E382_C67D.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(’60cb9cfd-f21c-45e0-9331-a5ef2012fcf8’)/\$value »7b25a472-364c-4e99-8520-a0e9ffc39e4b===============================================S1A_IW_SLC__1SDV_20160130T175601_20160130T175628_009727_00E345_CAF3.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘7b25a472-364c-4e99-8520-a0e9ffc39e4b’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160130T175601_20160130T175628_009727_00E345_CAF3.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘7b25a472-364c-4e99-8520-a0e9ffc39e4b’)/\$value »eefd89f5-e5d4-4313-a783-71ebb768bb81===============================================S1A_IW_SLC__1SDV_20160130T175510_20160130T175538_009727_00E345_16AD.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘eefd89f5-e5d4-4313-a783-71ebb768bb81’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160130T175510_20160130T175538_009727_00E345_16AD.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘eefd89f5-e5d4-4313-a783-71ebb768bb81’)/\$value »f7056fa5-1974-4c3e-b15a-0f18572bce09===============================================S1A_IW_SLC__1SDV_20160130T175536_20160130T175603_009727_00E345_0F40.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘f7056fa5-1974-4c3e-b15a-0f18572bce09’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160130T175536_20160130T175603_009727_00E345_0F40.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘f7056fa5-1974-4c3e-b15a-0f18572bce09’)/\$value »8ab293b6-c3f8-4375-86e9-289c11535079===============================================S1A_IW_SLC__1SDV_20160130T175445_20160130T175512_009727_00E345_B81E.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘8ab293b6-c3f8-4375-86e9-289c11535079’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160130T175445_20160130T175512_009727_00E345_B81E.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘8ab293b6-c3f8-4375-86e9-289c11535079’)/\$value »118a47e8-4f5c-4a9c-b889-a18e1f744abb===============================================S1A_IW_SLC__1SDV_20160129T060734_20160129T060802_009705_00E2AB_819C.SAFEhttps://scihub.copernicus.eu/apihub/odata/v1/Products(‘118a47e8-4f5c-4a9c-b889-a18e1f744abb’)/\$value===============================================wget –no-check-certificate –user= »guest » –password= »guest » –continue –output-document=./S1A_IW_SLC__1SDV_20160129T060734_20160129T060802_009705_00E2AB_819C.SAFE.zip « https://scihub.copernicus.eu/apihub/odata/v1/Products(‘118a47e8-4f5c-4a9c-b889-a18e1f744abb’)/\$value »

1. Olivier Hagolle dit :

Dear Ahmed,you should also provide the command line you used to simplify the analysis.It seems that you used the -n option (no_download) which does not perform the download and just lists the products. But I see you also tried to use guest account and password which will not work. You need to use your own authentification, and you need to have an account registered before the 21st of december 2015.All of this is written in the Readme file, sometimes it is useful to read the doc (;-)) !Best regards,Olivier

Dear Olivier,thanks for the good effort :DI tried the following code:python Sentinel_download.py –lat 53.4 –lon 9.2 -a apihub.txt(using guest guest password, mine for some reason doesn’t work)and got the following error:Resolving scihub.copernicus.eu… 131.176.236.28Connecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedAuthentication selected: Basic realm= »OData service »Connecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 500 Internal Server Error2016-02-05 18:21:15 ERROR 500: Internal Server Error.Any way to get around the server error?best,Mohammad

1. Olivier Hagolle dit :

Dear Mohammad,\nif you do not use a correct authentification (obtained before december 21st up to now, it should change soon I hope), you cannot download data. Using guest account always ends up with an internal error,\nwith a message saying\n maximum of 2 downloads reached with the account "guest".

3. Omar dit :

Dear Sir, I thank you very much for the assistance. the code works well. Sir, It is logic that downloading stops once the internet connection is cut. However, I wonder whether downloading a certain file starts again from the point at which it stopped before internet is disconnected or not. In other words, if the downloads of a file stops at 30% due to internet connection problems. does it starts again from 30% once the connection is back or it is simply starts from the beginningRegards,Omar

1. Olivier Hagolle dit :

I think so !\nOlivier

2. liu yang dit :

1. Olivier Hagolle dit :

4. Omar dit :

Thank you very much for the continuous assistance

5. Omar dit :

Sir, I used the code for downloading this file of sintenel1 over the Tolouse (S1A_IW_GRDH_1SDV_20160206T174740_20160206T174805_009829_00E633_A988.SAFE). Unfortunately, the intensity and amplitude layers of VH can not be displayed using sentinel toolbox. However, once the same file is downloaded manually from DATAHUB, it works. Did you face such a problem!! if so, what do you do advice ?regards,Omar

6. Omar dit :

The error message says that the zip file is corrupted

7. Omar dit :

I did not notice any difference of the two files downloaded manually from the site and by using the script in terms of contents and size. the only difference is the name of the files. Indeed, the one downloaded by the script has the word « SAFE » directly before the extension.

1. Olivier Hagolle dit :

Dear Omar,\nhave you tried to rename it ? Maybe the Sentinel Toolbox searches for a specific name ?\nOlivier

1. Omar dit :

Dear sir, I have used the following command to download sentinel images. It works well but unfortunately the number of images I got is 10 over 2016 only. The command is supposed to download all images starting from 2014. Would you please check the command.python Sentinel_download.py –lat 31.95 –lon -3.7 -a apihub.txt -s S1A*GRDH -d 2014-05-01 -f 2016-04-20Regards,Omar

8. Jimmy dit :

Hello Sir,I have sent all the downloads i needed to cart, is their a script to download from the products.meta4 file saved.If its possible can i have that too

1. Olivier Hagolle dit :

Sorry Jimmy,\nI do not understand your question. Could you please provide more details ? Which site are you downloading from ? What exactly do you want to do ?\nOlivier

9. Omar dit :

Dear sir,I have used the following command to download sentinel images. It works well but unfortunately the number of images I got is 10 over 2016 only. The command is supposed to download all images starting from 2014. Would you please check the command.python Sentinel_download.py –lat 31.95 –lon -3.7 -a apihub.txt -s S1A*GRDH -d 2014-05-01 -f 2016-04-20Regards,Omar

1. Olivier Hagolle dit :

Dear Omar,the -r option is there to specify a maximum amount of files to download parser.add_option(« -r »,dest= »MaxRecords »,action= »store »,type= »int », \ help= »maximum number of records to download (default=100) »,default=100)But default value is 100, maybe are you using an old version ?And by the way, please comment on the github platform rather that on the blog, for other users to find information on the issues.Best regards,Olivier

2. Olivier Hagolle dit :

Dear Omar, \nsorry for replying late, please download a recent version and use the -r option, for instance -r 500 if you thing you will get less than 500 references.\nSuch comments would be better posted to the github repository.\nOlivier

10. omar dit :

11. BorisK dit :

12. BorisK dit :

Hi Olivier,I already found the problem.Tha date of the sentinel-1 data is in a different place. using;date_prod=filename.split(‘_’)[5][0:8]instead ofdate_prod=filename.split(‘_’)[7][1:9]fixed the problem

1. Olivier Hagolle dit :

Thanks a lot Boris, and sorry for that bug. I do not test much with Sentinel-1 download.\nI’ll update the repository as soon as I can.\nOlivier

1. Olivier Hagolle dit :

Updated, should work now for S1 as well as for S2

13. Andrea dit :

Hi Olivier, and thanks for your precious software – it definitely saved me a lot of work!I have a question, though: do you happen to have experience on windows 10? I’m trying to run Sentinel_download from Windows shell but I get « Impossible to establish an SSL connection » right after i’m successfully connected to scihub server. (I’m running cmd in Admin mode.) Have you ever had any similar problem?

1. Olivier Hagolle dit :

Scusi Andrea,\nI almost never use windows, and I am not able to test the software with it.\nHope you’ll manage to find a work around.\nOlivier

14. Kennedy Ochieng dit :

Hallo,How do you batch process sentinel data in SNAP? I want to subset multiple sentinel images and then carryout an aggregation of the same. Thank you in advanceKennedy

1. Olivier Hagolle dit :

Sorry, I am not a SNAP user. I would do it with python.\nFor SNAP questions, there is a dedicated forum here \nOlivier

15. Amardeep Singh dit :

Hi there,May i Use PYTHON to download S1 IW SLC data of my site. How it takes no of images to be downloaded?RegardsSingh

1. Olivier Hagolle dit :

Dear Singh,\nI am not sure I understand your question.\nYes, you should be able to download S1 IW SLC data.\nIf you have a problem, please send your command line, so that I can try\nOlivier

16. Jonas Ardö dit :

Dear Olivier HagolleThanks for a nice tool.I get similar (not identical) errors on both windows (using cygwin) and on LINUX. when trying »python Sentinel_download.py –lat 43.6 –lon 1.44 -a apihub.txt -t 31TCJ » Any suggestions?Regards/Jonas ArdöWINDOWS (using CYGWIN):$python Sentinel_download.py –lat 43.6 –lon 1.44 -a apihub.txt -t 31TCJwget –no-check-certificate –user= »jonas.ardo@nateko.lu.se » –password= »mypassword » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(43.600000,1.440000) » filename:S2*&rows=100″sh: -c: line 0: syntax error near unexpected token (‘sh: -c: line 0: wget –no-check-certificate –user= »jonas.ardo@nateko.lu.se » –password= »mypassword » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(43.600000,1.440000) » filename:S2*&rows=100″‘Traceback (most recent call last): File « Sentinel_download.py », line 230, in xml=minidom.parse(« query_results.xml ») File « /usr/lib/python2.7/xml/dom/minidom.py », line 1918, in parse return expatbuilder.parse(file) File « /usr/lib/python2.7/xml/dom/expatbuilder.py », line 922, in parse fp = open(file, ‘rb’)IOError: [Errno 2] No such file or directory: ‘query_results.xml’Jonas.Ardo@jonasardow8 /cygdrive/H/software$LINUX: [jardo@sentinel SENTINEL]$python Sentinel_download.py –lat 43.6 –lon 1.44 -a apihub.txt -t 31TCJ » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint:\ »Intersects(43.600000,1.440000)\ » filename:S2*&rows=100″–2016-07-11 08:16:48– https://scihub.copernicus.eu/apihub/search?q=footprint:%22Intersects(43.600000,1.440000)%22%20filename:S2*&rows=100Resolving scihub.copernicus.eu… 131.176.236.28Connecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedConnecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedAuthorization failed.Traceback (most recent call last): File « Sentinel_download.py », line 228, in xml=minidom.parse(« query_results.xml ») File « /usr/lib64/python2.6/xml/dom/minidom.py », line 1918, in parse return expatbuilder.parse(file) File « /usr/lib64/python2.6/xml/dom/expatbuilder.py », line 924, in parse result = builder.parseFile(fp) File « /usr/lib64/python2.6/xml/dom/expatbuilder.py », line 211, in parseFile parser.Parse(« », True)xml.parsers.expat.ExpatError: no element found: line 1, column 0[jardo@sentinel SENTINEL]$

1. Olivier Hagolle dit :

Dear Jonas,\non linux, you have an authentification problem, your account in the apihub.txt file must be wrong, or maybe you just opened it, as ESA waits for sometime before allowing users to access the apihub (the automatic part of scihub).\n\nOn windows, you are in fact using linux, since it is cygwin. This case is not handled by my tool, I do not know how to detect cygwin, and I can’t test.\nIf you have an idea, it would be useful.\n\nIf you don’t know, you still may remove the following « if », and just use the condition for linux system.\nfor instance replace : \n if sys.platform.startswith(‘linux’) or sys.platform.startswith(‘darwin’):\n value= »\$value »\n else:\n value= »$value »\n\nby value= »\$value »\n\nThis happens 4 times between lines 175 and 204.\nHope you can program in python.\nRegards,\nOlivier\n\nHope you can program in python… 17. Jonas Ardö dit : Dear OlivierOn cygwin: Using single quotes (‘) instead of double (« ) for the ‘https:… and so on …’ at least gives me a wget command that produce a query result (below). I am not a python programmer but I will see if I can change the code to produce single quotes. Jonas.Ardo@jonasardow8 /cygdrive/H/software$ wget –no-check-certificate –user= »jonas.ardo@nateko.lu.se » –password= »hul88rutt » –output-document=query_results.xml ‘https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(43.600000,1.440000) » filename:S2*&rows=100’–2016-07-11 22:07:38– https://scihub.copernicus.eu/apihub/search?q=footprint:%22Intersects(43.600000,1.440000)%22%20filename:S2*&rows=100Resolving scihub.copernicus.eu (scihub.copernicus.eu)… 131.176.236.28Connecting to scihub.copernicus.eu (scihub.copernicus.eu)|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedAuthentication selected: Basic realm= »Sentinels Scientific Data Hub Search »Connecting to scihub.copernicus.eu (scihub.copernicus.eu)|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 200 OKLength: unspecified [application/atom+xml]Saving to: ‘query_results.xml’query_results.xml [ ] 291.14K 714KB/s in 0.4s2016-07-11 22:07:39 (714 KB/s) – ‘query_results.xml’ saved [298131]Jonas.Ardo@jonasardow8 /cygdrive/H/software

18. Jonas Ardö dit :

Dear Detect CYGWIN with: import platform platform.system()’CYGWIN_NT-6.3′ ps published my password in the last post, now changed, but remove before it gets public.Regards/Jonas

19. Hannes Diedrich dit :

Dear Olivier Hagolle,thanks very much for your nice tool!I use Linux (openSUSE 13.2 (Harlequin) (x86_64)). When I apply your test command:Sentinel_download.py -s S2 –latmin 43 –latmax 46 –lonmin -1 –lonmax 2 -a apihub.txt -o 94 -m 25 -d 20151206I get the following answer:wget –no-check-certificate –user= »myself » –password= »secret » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint:\ »Intersects(POLYGON((-1.0 43.0, 2.0 43.0, 2.0 46.0, -1.0 46.0,-1.0 43.0)))\ » filename:S2*R094*&rows=100″–2016-07-28 10:45:11– https://scihub.copernicus.eu/apihub/search?q=footprint:%22Intersects(POLYGON((-1.0%2043.0,%202.0%2043.0,%202.0%2046.0,%20-1.0%2046.0,-1.0%2043.0)))%22%20filename:S2*R094*&rows=100Resolving scihub.copernicus.eu (scihub.copernicus.eu)… 131.176.236.28Connecting to scihub.copernicus.eu (scihub.copernicus.eu)|131.176.236.28|:443… connected.Unable to establish SSL connection.Traceback (most recent call last): File « Sentinel_download.py », line 235, in xml=minidom.parse(« query_results.xml ») File « /srv/fluo5/hannesd/gdal/install_py_et_al/python_GFZ/python/lib/python3.5/xml/dom/minidom.py », line 1958, in parse return expatbuilder.parse(file) File « /srv/fluo5/hannesd/gdal/install_py_et_al/python_GFZ/python/lib/python3.5/xml/dom/expatbuilder.py », line 912, in parse result = builder.parseFile(fp) File « /srv/fluo5/hannesd/gdal/install_py_et_al/python_GFZ/python/lib/python3.5/xml/dom/expatbuilder.py », line 211, in parseFile parser.Parse(«  », True)xml.parsers.expat.ExpatError: no element found: line 1, column 0Is this also an authentication problem like in the proposed case of Jonas Ardö? wget should ignore the SSL-certificate when using the keyword « –no-check-certificate », right?Thanks in advance!Hannes

1. Olivier Hagolle dit :

Dear Hannes, \nIt is probably a problem on your side, maybe on your proxy, I don’t know and can’t reproduce the issue.\nHope you’ll find,\nRegards,\nOlivier\n\nPS : you sent me your password, I changed it on the comment, I won’t use it, I swear !

20. Léo dit :

Hi Olivier,thank you very much for your work, it is a very usefull tools.I just have a litlle questions (maybe you have already answered but i don’t find it).Is it possible in one task, to request more than one tiles, like this: Sentinel_download.py –lat 43.6 –lon 1.44 -a apihub.txt -o 51 -t 31TCJ 31TCK ? RegardsLéo

1. Olivier Hagolle dit :

Hi Leo,\nSorry, this was not implemented, just run it twice, I don’t think it takes much more time.\nGiven that ESA is going to change the packaging of its products this autumn to directly deliver its products by tiles, I don’t think I will implement it.\nCheers\nOlivier

21. Jonas Ardö dit :

Occasionally I receive « Internal Server Error »using identical syntax (python Sentinel_download.py –lat 66.00 –lon 78.55 -a apihub.txt –dhus -d 20150623 -f 20161015 -t 34WDA -w /mnt/SDATA1/S2a/34WDA/) that normally works. Is this to be interpreted as a error on the server side or is there anything to be done about it?Regards/Jonas ArdöError message received:Reusing existing connection to scihub.copernicus.eu:443.HTTP request sent, awaiting response… 500 Internal Server Error2016-10-16 12:24:54 ERROR 500: Internal Server Error.

1. Olivier Hagolle dit :

Hi, It might be due to the fact that Sentinel-2 now distributes data per tiles and not any more by swath. I haven’t had time to adapt the software. I tried this week-end but the scihub server was down…Olivier

22. Jonas Ardö dit :

Script starts OK and download some files (about 23 Mb) but the ./GRANULE/S2A_OPER_MSI…/IMG_DATA directory is not created but stored as a file (see listing below). And then is no more data retrieved.Regards/Jonas[] ls -alRtotal 156drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 .drwxr-xr-x. 26 jardo users 4096 Nov 17 10:22 ..drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 AUX_DATAdrwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 DATASTRIPdrwxr-xr-x. 3 jardo users 4096 Nov 17 10:22 GRANULEdrwxr-xr-x. 2 jardo users 4096 Nov 17 10:22 HTML-rw-r–r–. 1 jardo users 18652 Nov 17 10:22 INSPIRE.xml-rw-r–r–. 1 jardo users 0 Nov 17 10:31 lits.txt-rw-r–r–. 1 jardo users 60488 Nov 17 10:22 manifest.safedrwxr-xr-x. 2 jardo users 4096 Nov 17 10:22 rep_info-rw-r–r–. 1 jardo users 45177 Nov 17 10:22 S2A_OPER_MTD_SAFL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.xml./AUX_DATA:total 8drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 …/DATASTRIP:total 12drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 ..drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 S2A_OPER_MSI_L1C_DS_SGS__20161112T134018_S20161112T083553_N02.04./DATASTRIP/S2A_OPER_MSI_L1C_DS_SGS__20161112T134018_S20161112T083553_N02.04:total 22660drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 ..drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 QI_DATA-rw-r–r–. 1 jardo users 23187933 Nov 17 10:23 S2A_OPER_MTD_L1C_DS_SGS__20161112T134018_S20161112T083553.xml./DATASTRIP/S2A_OPER_MSI_L1C_DS_SGS__20161112T134018_S20161112T083553_N02.04/QI_DATA:total 8drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 …/GRANULE:total 12drwxr-xr-x. 3 jardo users 4096 Nov 17 10:22 .drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 ..drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04./GRANULE/S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04:total 12drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 3 jardo users 4096 Nov 17 10:22 ..drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 AUX_DATA-rw-r–r–. 1 jardo users 0 Nov 17 10:23 IMG_DATA./GRANULE/S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04/AUX_DATA:total 12drwxr-xr-x. 2 jardo users 4096 Nov 17 10:23 .drwxr-xr-x. 3 jardo users 4096 Nov 17 10:23 ..-rw-r–r–. 1 jardo users 810 Nov 17 10:23 S2A_OPER_AUX_ECMWFT_SGS__20161112T134018_V20161112T060000_20161112T180000./HTML:total 180drwxr-xr-x. 2 jardo users 4096 Nov 17 10:22 .drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 ..-rw-r–r–. 1 jardo users 42377 Nov 17 10:22 banner_1.png-rw-r–r–. 1 jardo users 58643 Nov 17 10:22 banner_2.png-rw-r–r–. 1 jardo users 44797 Nov 17 10:22 banner_3.png-rw-r–r–. 1 jardo users 1890 Nov 17 10:23 star_bg.jpg-rw-r–r–. 1 jardo users 6255 Nov 17 10:22 UserProduct_index.html-rw-r–r–. 1 jardo users 10331 Nov 17 10:22 UserProduct_index.xsl./rep_info:total 12drwxr-xr-x. 2 jardo users 4096 Nov 17 10:22 .drwxr-xr-x. 7 jardo users 4096 Nov 17 10:31 ..-rw-r–r–. 1 jardo users 1022 Nov 17 10:22 S2_User_Product_Level-1C_Metadata.xsd–2016-11-17 10:34:57– https://scihub.copernicus.eu/apihub/odata/v1/Products('a71ef6ff-7dab-407f-8a28-07ad4ad5335e‘)/Nodes(‘S2A_OPER_PRD_MSIL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.SAFE’)/Nodes(‘GRANULE’)/Nodes(‘S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04’)/Nodes(‘IMG_DATA’)/$valueResolving scihub.copernicus.eu… 131.176.236.28Connecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedReusing existing connection to scihub.copernicus.eu:443.HTTP request sent, awaiting response… 200 OKLength: 0 [application/octet-stream]Saving to: “/jumbo/jardo/SENTINEL/35PRQ//S2A_OPER_PRD_MSIL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04/IMG_DATA” [ ] 0 –.-K/s in 0sLast-modified header invalid — time-stamp ignored.2016-11-17 10:34:57 (0.00 B/s) – “/jumbo/jardo/SENTINEL/35PRQ//S2A_OPER_PRD_MSIL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04/IMG_DATA” saved [0/0]–2016-11-17 10:34:57– https://scihub.copernicus.eu/apihub/odata/v1/Products('a71ef6ff-7dab-407f-8a28-07ad4ad5335e‘)/Nodes(‘S2A_OPER_PRD_MSIL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.SAFE’)/Nodes(‘GRANULE’)/Nodes(‘S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04’)/Nodes(‘IMG_DATA’)/$valueResolving scihub.copernicus.eu… 131.176.236.28Connecting to scihub.copernicus.eu|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedReusing existing connection to scihub.copernicus.eu:443.HTTP request sent, awaiting response… 200 OKLength: 0 [application/octet-stream]Saving to: “/jumbo/jardo/SENTINEL/35PRQ//S2A_OPER_PRD_MSIL1C_PDMC_20161112T155051_R121_V20161112T082202_20161112T082202.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_SGS__20161112T134018_A007268_T35PRQ_N02.04/IMG_DATA” [ ] 0 –.-K/s in 0s

1. Tristan Harmel dit :

Dear all,I have had the very same problem since November.Any news to solve this issue?Thanks,Tristan

23. Andre Lima dit :

Dear Oliver, I really appreciate your kindness to share your code, it has made my life easier in the last two months. However since last week the code is not working and is giving me the follow message:  » File « Sentinel_download.py », line 281, in date_prod=filename.split(‘_’)[7][1:9]IndexError: list index out of rangeI used your « Toulose » example and had the same answer. Any chance you know the stupid thing I am doing?Thank a lot.Best,Andre

1. Olivier Hagolle dit :

24. smyle gf dit :

Dear OliverThank you for very useful tools. But I do got error that I have no clue why.python Sentinel_download.py –lat 0 –lon 114 -a apihub.txt -d 20160901 -s S1A*GRDwget –no-check-certificate –user= »xxx » –password= »xxx » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(0.000000,114.000000) » filename:S1A*GRD*&rows=100″–2016-12-29 15:32:23– https://scihub.copernicus.eu/apihub/search?q=footprint:Intersects(0.000000,114.000000)%20filename:S1A*GRD*&rows=100Resolving scihub.copernicus.eu (scihub.copernicus.eu)… 131.176.236.28Connecting to scihub.copernicus.eu (scihub.copernicus.eu)|131.176.236.28|:443… connected.HTTP request sent, awaiting response… 401 UnauthorizedAuthentication selected: Basic realm= »Sentinels Scientific Data Hub Search »Reusing existing connection to scihub.copernicus.eu:443.HTTP request sent, awaiting response… 500 Internal Server Error2016-12-29 15:32:24 ERROR 500: Internal Server Error.It seems like that my account is unauthorized, and that confuse me. I made my account last year, so it is not a new one. But yea, I didn’t really use it for a long time because the server is not stable (I download from ASF server instead).And I have tried again to use my account trough copernicus webgis server and it work, but now I need the automation for downloading. Is it now possible to execute the script using new registered account? Then I should probbaly make new email as well.thank you

25. GeckoTokay dit :

Hello, I want to download Sentinel 1 (GRDH, IW) data of a region from 2014 to 2017 so it will be easier for me to use Olivier’s code.However, I’m not very good at programming with Python. I’m currently working on Windows 10 and I need some help. Can someone (who works also on Windows) share his code so I can see what I should change or not ? It would help me a lot ! Plus, I read on the « readme » that I need to install « Aria2 ». Is it a module for python or something else ? How do I install it ?Thank a lot,GeckoTokay

1. Olivier Hagolle dit :

Sorry, I do not know how to install aria2 on window, as I am not a Windows user.\naria2 is a program, A research on the web gave me for instance that URL toio download it\nhttp://www.softpedia.com/get/Internet/File-Sharing/aria2.shtml\n\nBut once again, Windows is not my system…\nOlivier

26. Marcela dit :

Dear Oliver,I downloaded the last version from github platform and I trying run the code to download only one tile but I have a problem. I retrieval this message: »File « Sentinel_download.py », line 389, in url_header=url_header.replace(« eu/odata », »eu/apihub/odata »)NameError: name ‘url_header’ is not defined »Excuse me but I don’t work with python. Could you say me what’s the trouble?Thank youMarcela

27. Hajar dit :

1. Olivier Hagolle dit :

You’re right, as the Scihub interface does not allow to select by acquisition date, but only by production date (or maybe I missed something ?).\nSo my tool selects the right dates a posteriori by scanning the query_results.xml\n\nBest regards,\nOlivier

28. alejandro vergara dit :

Hello,I am trying to download sentinel product in windows but i have this error C:\Users\alejandro vergara\Desktop\Sentinel>python Sentinel_download.py –latmin 51.75 –latmax 52.25 –lonmin -23.00 –lonmax 23.75 -a apihub.txt -s S1A*GRDH -w /home/mateuszk/Testy -d 20160508wget –no-check-certificate –user= »xxxx » –password= »xxxx » –output-document=query_results.xml « https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(POLYGON((-23.0 51.75, 23.75 51.75, 23.75 52.25, -23.0 52.25,-23.0 51.75))) » filename:S1A*GRDH*&rows=100″wget: invalid option — 2Usage: wget [OPTION]… [URL]…Try wget –help’ for more options.Traceback (most recent call last): File « Sentinel_download.py », line 280, in xml=minidom.parse(« query_results.xml ») File « C:\Python27\lib\xml\dom\minidom.py », line 1918, in parse return expatbuilder.parse(file) File « C:\Python27\lib\xml\dom\expatbuilder.py », line 922, in parse fp = open(file, ‘rb’)IOError: [Errno 2] No such file or directory: ‘query_results.xml’

1. Olivier Hagolle dit :

Maybe something wrong in your password.\nThe clue should be in this message : wget: invalid option — 2

31. Olivier Hagolle dit :

Dear Christian,I am not good with windows, having no computer with windows installed. My guess would be that the quotes in the footprint expression should be protected, replacing  » by \ ». But I can’t test it.The best would be to ask questions in the github platform as other users who succeeded with windows could answer.Best regards,Olivier

32. Kristof Van Tricht dit :

Dear Olivier,thanks for the nice tool. I couldn’t get it to work on Windows, so I switched to a Linux machine. I was interested in using it for downloading Sentinel-2 L2A data. For some reason, the script still wouldn’t run. I started digging into your code, and found that this line was causing the error:if names[i].find(‘SAFL1C’)>0 or names[i].find(‘MSIL1C’)>0:I had to add the L2A, and now it works fine:if names[i].find(‘SAFL1C’)>0 or names[i].find(‘MSIL1C’)>0 or names[i].find(‘MSIL2A’)>0:

1. Olivier Hagolle dit :

33. Kristof Van Tricht dit :

Another issue is that – at least if you download a specific tile – the file « MTD_MSIL2A.xml » does not get downloaded, while you need it to open the tile in SNAP. You could consider fixing that as well 🙂

34. David dit :

Salut,J’ai trouvé un minibug dans le code.La version que j’ai date du 2 mai de cette année.Il plante sur :./Sentinel_download.py –latmin 43 –latmax 46 –lonmin -1 –lonmax 2 -a apihub.txt -o 94 -m 23 -d 2015-12-06 -n -s S2Le correctif : —————————————————-avant : if options.sentinel.find(« S2 ») >=0 : for node in prod.getElementsByTagName(« double »): (name,field)=node.attributes.items()[0] if field== »cloudcoverpercentage »: cloud=float((node.toxml()).split(‘>’)[1].split(‘=0 : for node in prod.getElementsByTagName(« double »): (name,field)=node.attributes.items()[0] if field== »cloudcoverpercentage »: cloud=float((node.toxml()).split(‘>’)[1].split(‘<')[0]) else: continue print "cloud percentage = %5.2f %%"%cloud else: cloud=0… rajouté un else: continue car le champ recherché n'est pas en première position.Merci pour ce boulot 🙂

1. David dit :

Oups, désolé, je viens de télécharger la dernière version, le bug n’existe plus.

35. Agustin Lobo dit :

I think I have a mismatch between the requested period and the actual returned dates. My command:python Sentinel_download.py –lat 12.44966 –lon -87.05445 -a apihub.txt -d 2017-07-01 -f 2017-08-01 -n -s S2but then I get the following (i keep the relevant info only):S2A_MSIL1C_20170721T161351_N0205_R140_T16PDU_20170721T162051.SAFES2A_MSIL1C_20170323T161341_N0204_R140_T16PDU_20170323T162615.SAFES2A_MSIL1C_20170701T161341_N0205_R140_T16PDU_20170701T162605.SAFEWhy do I get an image for 20170323 if I requested July only?Thanks

36. Geordie Hobart dit :

Problem solved please delete all my posts. Thanks

1. Olivier Hagolle dit :

My pleasure !

37. Lubomir dit :

Hello,I tried to use the script to download Sentinel-2 data using the code from examples. Script is running well, however the query_results.xml is empty. Not totally empty but it seems like the script hadn’t found any data according to my selection.At first I thought that there is not data available. I had a look at XML created by script and I also manually opened XML how it should have looked like.The script produced this URL: https://scihub.copernicus.eu/apihub/search?q=footprint:Intersects(43.600000,1.440000) filename:S2*R051* producttype:S2MSI1CHowever, It should look like this:https://scihub.copernicus.eu/apihub/search?q=footprint: »Intersects(43.600000,1.440000) » filename:S2*R051* producttype:S2MSI1CWhen I put the second link into a browser, XML shows 122 results, XML created by script contains 0 results. Any help ?

1. Olivier Hagolle dit :

Hi,\nthanks for the bug report. Il will have a look, even if I would rather recommend using my other tool, peps_download : https://github.com/olivierhagolle/peps_download\nPlease use the github repository to raise issues, it will be much better handled that in the blog comments.\nAnd to reproduce this issue, I would need the command line you used, and to know if you were working on linux and windows.\nBest regards,\nOlivier

38. paul karwinski dit :

Hi Olivier,I’ve been trying to use your script using python Sentinel_download.py –lat 43.6 –lon 1.44 -a apihub.txt -o 51 -n -s S2 but the query_results.xml contains no scenes listed , the last line in file is tried manual search, which does produce sceneshttps://[username]:[password]@scihub.copernicus.eu:443/apihub/search?q=footprint: »Intersects(43.6,1.44) » filename:S2*tried on both a windows PC with and without proxy requirementsany ideas?

1. Olivier Hagolle dit :

Sorry for that. As said in the documentation, I have no windows computer (and do not want to have one ;)) . As a result, I cannot test whether it works or not on that platform. My guess is that some special characters need to be protected when the url is passed to wget. At least, it is the case on linux\n\nI recommend you to try with the wget command itself until you find how to pass the URL, and then report the necessary modifications within the code.\nbest regards,\nOlivier

39. dorbodwolf dit :

1. Olivier Hagolle dit :

Hi,\nThis kind of question should be asked by raising issues on github, other users might reply there. \nI do not use windows, so I am not able to solve this. The issue comes from the presence of whitespace in the requests sent by wget. There should be a way to protect these whitespaces, but I do not know the Windows way.\nOlivier

40. Jinlong dit :

Dear Olivier,I tried to use Sentinel_download.py to download sentinel 2 data. It worked but I got only query_results.xml file and not the real data. What happened?Best regards,Jinlong

1. Olivier Hagolle dit :

Hi Jinlong, \nplease open an issue on the github website, with the command line and detailed logs. Or better use my peps_download.py tool, https://github.com/olivierhagolle/peps_download \nIt downloads data from the French PEPS platform, whic is a global mirror of Copernicus data. It is the code I use and maintain.\nOlivier

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.