Page 1 of 1

Downloading CO2 data from NASA GES DISC

Posted: Wed Apr 20, 2022 1:40 pm America/New_York
by EarthdataForumContributor
User-submitted question:

"I am working on a research project. For that I need some of the CO2 data which is available on the website.
I am having difficulty in understanding how to download it. At the moment, I marked the region and also selected
the years which I needed the data for, but at the end how to download it, because it is just creating a lot of files
and it is showing the instruction for download to install the wget and windows+r function but I am not understanding it properly, can you please help me with this?

I am attaching the image so you can have a better look for what I am trying to say. I have a windows PC and I also
downloaded wget."
screenshot of CO2 data download Khalique.png
screenshot of CO2 data download Khalique.png (476.33 KiB) Not viewed yet

Re: Downloading CO2 data from NASA GES DISC

Posted: Wed Apr 20, 2022 1:47 pm America/New_York
by GES DISC - jimacker
From your post, it is clear you were able to regionally and temporally subset the data for your research. Below
are some quick commands for using wget on Windows to help download several files. These commands use the user’s Earthdata account information for downloading the datasets.

wget for Windows

Downloading one file:

wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies
--auth-no-challenge=on --keep-session-cookies --user=<your username>
--ask-password <url>

Downloading multiple files:

wget --load-cookies C:\.urs_cookies --save-cookies C:\.urs_cookies
--auth-no-challenge=on --keep-session-cookies --user=<your username>
--ask-password -i <url.txt>

More information is available at this link:
https://disc.gsfc.nasa.gov/data-access#windows_wget

Re: Downloading CO2 data from NASA GES DISC

Posted: Mon Feb 26, 2024 8:37 am America/New_York
by lukasz.borowski
Hi

Is there a code for Python (on Windows) on how to download such files? I tried to follow https://disc.gsfc.nasa.gov/information/howto?title=How%20to%20Access%20GES%20DISC%20Data%20Using%20Python but I, unfortunately, lost with the requests library.

The file is:
'https://data.gesdisc.earthdata.nasa.gov/data/OCO2_DATA/OCO2_L2_Standard.11r/2014/249/oco2_L2StdND_00964a_140906_B11006r_230325051042.h5'.

By requests.get() I may log in to "https://data.gesdisc.earthdata.nasa.gov/" (status 200) and then what I shall do next?

Lukasz

Re: Downloading CO2 data from NASA GES DISC

Posted: Wed Mar 20, 2024 12:02 pm America/New_York
by cbattisto
Hello,

You can simply pass the URL of the granule that you wish to access into the requests.get() function, but that must be stored into a variable to be written to a file, like so:

import requests

# URL of the file to be downloaded
url = "https://data.gesdisc.earthdata.nasa.gov/data/OCO2_DATA/OCO2_L2_Standard.11r/2014/249/oco2_L2StdND_00964a_140906_B11006r_230325051042.h5"

# Perform the GET request
response = requests.get(url)

filename = url.split('/')[-1] # Extracts the file name from the URL
with open(filename, 'wb') as file:
file.write(response.content)

Re: Downloading CO2 data from NASA GES DISC

Posted: Thu Mar 21, 2024 5:15 am America/New_York
by lukasz.borowski
Thank you.
ŁB