How to download NASA Global Precipitation Measurement(GPM) DATASET

1Prepare an account of and make sure have the “NASA GESDISC DATA ARCHIVE” apps in your approved applications list. Here’s the guidance:

2Search and choose gpm data you need in: . Click [Get Data] and set refining options, then press [Get Data] to get the download links list.

3The urls in download list file is not accessible directly, you need your account registed before. The downloading requires authentication but the HTTPAuth will failed(redirection reason or others), which means you have to get the authorized cookies before you multiply request the urls. For pythoner, you can use web browser to open a download link and login first and then you can get the authorized cookies from the request headers.

And code will be like this:

r = requests.get(url, cookies={'nasa_gesdisc_data_archive':'xxxxxx'}) 
f = open(filepath, 'wb')

4But the download speed of python ‘requests’ module is comparable with a turtle. So below gives a ‘wget’ method which is quite faster(for Mac/Linux).

  1. Create a .netrc file in your home directory to save the login message for wget.
    • echo “machine login <username> password <password>” >> .netrc
    • chmod 0600 .netrc #(to be safe)
  2. Create a cookie file to record cookies and persist sessions across wget.(This can be any where in case refer a correct path in wget command.
    • touch .urs_cookies
  3. Download multiple data files using wget -i:
    • wget –load-cookies .urs_cookies –save-cookies .urs_cookies –auth-no-challenge=on –keep-session-cookies –content-disposition -i <list.txt> #(list txt contains urls for download files).