A python module for batch downloads of LANDSAT data.

=>

The Python routine, provided via the link at the end of this post, enables batch downloads of LANDSAT data, on USGS earth explorer site.

 

It works for LANDSAT 8 and LANDSAT 7 (and could work for LANDSAT 5), it just requires that the data are available on line. It is the case for all LANDSAT 8 data, but for LANDSAT 5&7, it may be necessary to order the data first on http://earthexplorer.usgs.gov. The routine of course requires that you have an account and password on earth explorer, and you will have to configure your accounts and directories within the routine.

 

This routine may be used in two ways :

  • You select a LANDSAT scene defined by its WRS-2 coordinates (for instance, (198,030) pour Toulouse). The -d option requires that you provide a day of year for which the scene was observed (1 overpass every 16 days)
    • example :
    • python  download_landsat_scene.py -o scene -t LC8 -a 2013 -d 113 -f 365 -s 199030
  • You provide a list of products to download, with a site name for each product.
    • Example :
      python download_landsat_scene.py -o list -l landsat8_list.txt
    • landsat8_list.txt is as follows : of course, you need to get the references on Earth Explorer.
    • Tunisia LC81910352013160LGN00
      Tunisia LC81910362013160LGN00

 

The routine is available here : Download_landsat_scene.py

 

Once you have downloaded the data, you will probably want to convert them to reflectances or temperatures for the thermal bands. One of our colleagues at CESBIO provides a Python module to do the conversion (The post is in French, but Python is a universal language...).

Posted under: Code, In English, Landsat

11 comments

  • Christian Schiller on 29/01/2014 at 11:59 said:

    Dear Mr. Hagolle

    you are mentioning that (at http://www.cesbio.ups-tlse.fr/multitemp/?p=3121#respond):

    ... colleagues at CESBIO provides python modulea to do the conversion (The post is in French, but Python is a universal language...).

    Unfortunately, the final link provided on your colleagues page (-> http://130.120.117.103/Sie/?p=1120) (which should be pointing to the actual routine -> cnToTOA.py)(-> http://www.cesbio.ups-tlse.fr/SIE_blog/?attachment_id=1158) is not freely accessible and therefore the routine cannot be accessed.

    I would really be interested to test this interesting code.

    greetings
    Christian

    • Olivier Hagolle on 29/01/2014 at 12:39 said:

      Thanks for the comment, I asked my colleague to update this link (which points to an older server adress).
      He usually reacts quickly.
      Olivier

  • Bang on 08/06/2014 at 13:27 said:

    Hi, your script look good but I don't know some error. I used your example but this script not download anything but echo "/to/be/changed/....". And what is user='CNESNET\login', passwd='secret',proxy_info = {..}. I don't have it, how can I have a account proxy?

    F:\>python download_landsat_scene.py -o scene -a 2014 -d 60 -f 100 -s 198024
    /to/be/changed//SCENES/198_024/GZ

    • Olivier Hagolle on 10/06/2014 at 07:42 said:

      Dear Bang,
      this tool is meant for programmers who know some python. The /to/be/changed obviously need to be customized with your own Path to where you want to store data. And the part about CNES proxy is just an example, and if you do not have a proxy, then it is even simpler for you.
      Good Luck,
      Olivier

  • Jinkai on 30/06/2015 at 20:31 said:

    For some reason, this package did not work since yesterday. I got some error similar to the following:
    File "C:\Python27\ArcGISx6410.1\lib\urllib2.py", line 521, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 404: Not Found.

    what is the problem?

  • Jinkai on 30/06/2015 at 20:34 said:

    here is the command line i used:
    python download_landsat_scene.py -z unzip -o scene -u U:\gis_jinkai\landsat_auto_download\usgs.txt -b LC8 -d 20150628 -f 20150630 --output U:\gis_jinkai\landsat_down_temp\29-Jun-15 -s 040025

  • Bart on 19/05/2016 at 07:38 said:

    Hi Olivier,

    I'm having difficulty working with the list option and was wondering if you could help. The first option works fine for me. The error I get is as follows:
    "URL Error: no host given http://ers.cr.usgs.gov/download/4923/LC81130802016119LGN00/STANDARD/EE"
    I have tried your worked example with the same result. I am working with a download of the script from the Github site and I know the list of scenes are available on USGS.

    Thanks
    Bart

  • Muhammad on 06/02/2017 at 13:43 said:

    Hi Oliver

    I am using this script for the past few months. I have noticed two things

    1) Some times the Julian date is calculated incorrectly. I can see an image on a specific date in EE but the script skips that date.

    2) There is some issue with option -c (cloud filter) as I tried to download some images with -c 10 but all the images re above 10% cloud cover.

    Thanks for your help and this script.

    Muhammad

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>