Skip to main content

help download modis files with token and multi threading processing

Project description

1 ModisDownload

help ours down load from base url https://ladsweb.modaps.eosdis.nasa.gov/ when i use this packages , our bandwidth work in deadline with the first version we can use this download all modis file with any time in any area use like this

2 Example code

2.1 Query Productions

We can query productions which can be downloaded by our API or get from {your ModisDownload package install directory}/temp/sensor.csv

# search products which can be downloaded
from ModisDownload.Visited import search_p

if __name__ == '__main__':
    search_p()

2.2 Query Area Names

We can query productions which can be downloaded by our API or get from {your ModisDownload package install directory}/temp/country.json

# search products which can be downloaded
from ModisDownload.Visited import search_area

if __name__ == '__main__':
    search_area()

2.3 Download products

# download data main class
from ModisDownload.Visited import GetHtml

if __name__ == '__main__':
    # get your token in https://ladsweb.modaps.eosdis.nasa.gov/#generate-token
    token = "your token can be found in https://ladsweb.modaps.eosdis.nasa.gov/#generate-token"

    # init download main class
    obj = GetHtml()

    # set your product name
    product_name = "Mod04_3k"

    # set your query dates
    # query one day use 2020-01-01
    # query dates use start_time..end_time like 2021-01-01..2022-01-01
    # query multi dates like 2020-01-01,2021-01-01..2022-01-01,... and so on
    query_dates = "2020-01-01,2021-01-01..2021-02-01"

    # query area can use name of country or longitude and latitude
    # county like china or other names,you can see all names by search_area() in ModisDownload.Visited
    # area by longitude and latitude like
    # (longitude,latitude)
    # (a,b) ----------
    #       -        -
    #       -        -
    #       -        -
    #       ---------- (c,d)
    # area like xayb,xcyd
    area = "x120y40,x140y20"

    # download files save directory
    save_dir = "./download"

    # thread number default 5
    thread_num = 5

    # max try number if your net close download will be shutdown,
    # so we will retry some time to make sure download success,default max try number is 10
    max_try = 10

    # if you use proxy you should set you proxy port if port is None not use proxy default port is None
    port = None

    # chunk size is stream I/O size don't change
    chunk_size = 1 << 20

    # download main function
    obj.download_main(sensor_name=product_name, dates=query_dates, area=area, download_dir=save_dir,
                      thread_num=thread_num,
                      max_try=max_try, port=port, chunk_size=chunk_size)

    # only need download urls
    obj.download_main_url(sensor_name=product_name, dates=query_dates, area=area, download_dir=save_dir,
                          save_dir="your downloads urls save path")

2.4 Update ModisDownload

update productions names and area

# reinit package
from ModisDownload.Visited import reload

if __name__ == '__main__':
    reload()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ModisDownload-2.1.tar.gz (498.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ModisDownload-2.1-py3-none-any.whl (502.0 kB view details)

Uploaded Python 3

File details

Details for the file ModisDownload-2.1.tar.gz.

File metadata

  • Download URL: ModisDownload-2.1.tar.gz
  • Upload date:
  • Size: 498.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.8rc1

File hashes

Hashes for ModisDownload-2.1.tar.gz
Algorithm Hash digest
SHA256 7a994670d5197fa9c3bbd8d7e54da9ffcc315bb12708b745c2ffa14dc33b9dbb
MD5 394fe8516a75d08227ad790a7e399445
BLAKE2b-256 1f08cd87636937b2e67da795080f80cb5cfc5f00cefe8acfdf40f190b71f8b40

See more details on using hashes here.

File details

Details for the file ModisDownload-2.1-py3-none-any.whl.

File metadata

  • Download URL: ModisDownload-2.1-py3-none-any.whl
  • Upload date:
  • Size: 502.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.8rc1

File hashes

Hashes for ModisDownload-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faffd30661df91e7fb6f4a30de83c17a133074c02e072fb16f1f6f11987a07bf
MD5 6a6fe88aea36b9f48507b16f55503b7f
BLAKE2b-256 1541e600cc8dfddc055fc99e3d97c63c65295e31af06f0fd6b7370f6c66aeb36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page