Multiple File Download from PO.DAAC Drive Using Python

Re: Multiple File Download from PO.DAAC Drive Using Python

Postby rattana06 » Wed Aug 05, 2020 11:56 pm

Dear PODAAC database experts,

I have used the python program of the discussion above to download SST data from GHRSST.
I run the following command on anaconda on window 10:

"python -u Username:Password -s 20020601 -f 20200804 -x MUR-JPL-L4-GLOB-v4.1 -t wget"

Note that the username and password I used is the one derived from
"Access PO.DAAC Drive API Credentials"

After running the code I got the following errors:
Please wait while program searching for the granules ...

OK to download? [yes or no]: yes
--2020-08-06 13:30:51-- ...
Resolving (
Connecting to (||:443... connected.
ERROR: The certificate of '' is not trusted.
ERROR: The certificate of '' hasn't got a known issuer.


It warns about untrusted certificate. Can you explain about the mistakes I made here.
Thank you in advance.
Posts: 1
Joined: Wed Aug 05, 2020 11:30 pm

Re: Multiple File Download from PO.DAAC Drive Using Python

Postby yiboj » Thu Aug 06, 2020 10:11 am

Thanks for your inquiry and support.

First, you need to install the cygwin package ca-certificates via Cygwin's setup.exe to get the certificates.
Second, you need to tell wget where your certificates are, since it doesn't pick them up by default in Cygwin environment. If you can do that either with the command-line parameter --ca-directory=/usr/ssl/certs (best for shell scripts) or by adding ca_directory = /usr/ssl/certs to ~/.wgetrc file.

You can also disable checking SSL traffic by modifying the wget code in the python script:

wget --no-check-certificate

Hope this helps and please let us know.


Posts: 130
Joined: Mon Mar 30, 2015 11:22 am

Re: Multiple File Download from PO.DAAC Drive Using Python

Postby arundeep » Fri Sep 24, 2021 3:01 am

tanyapak wrote:Hi!

I don't understand where I'm supposed to add the username and password, and specify the url to datasets. Could you please give an example?


I am hoping that you had the same issues as I face recently and I did not find an answer in the forum here. Just to be clear, my scenario is as below.
I have a directly url given to a file on PO.DAAC drive on a page from NASA. If I click on Get data button, it gives me the URL.

The script here seems to be for complex scenario and did not help me.
I found a link about accessing EarthData login supported files here. There are 3 methods given.
I tried all 3 and on Pythonn 3.8 2nd approach worked for me. The one with overriding requests.Session class. As I did not need to download file. I had to modied the code a little bit.
Code: Select all
#response = session.get(url, stream=True)
response = session.get(url)

I removed the below code
Code: Select all
    with open(filename, 'wb') as fd:
        for chunk in response.iter_content(chunk_size=1024*1024):

and directly used response.text to parse into a DataFrame through io.StringIO

Code: Select all
 pd.read_table(io.StringIO(response.text), skiprows=48,delim_whitespace=True, header= None, index_col=False)

I hope it helps someone who comes to this page with less understanding of Po.DAAC structures and python like me .

EDIT: 3rd option also worked after I figured the issue.

had to change code
Code: Select all
   #session.auth = (username, password)
   #r1 = session.request('get', url)
   r = session.get(url, auth=(username, password))

NOTE: password here is the password for Web drive and not the default login password.
Posts: 1
Joined: Fri Sep 24, 2021 2:31 am


Return to Data Recipes