Downloading CO2 data from NASA GES DISC
-
- Posts: 284
- Joined: Thu Jul 11, 2019 4:32 pm America/New_York
Downloading CO2 data from NASA GES DISC
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."
"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."
Filters:
-
- Posts: 354
- Joined: Mon Sep 30, 2019 1:57 pm America/New_York
- Has thanked: 2 times
- Been thanked: 9 times
Re: Downloading CO2 data from NASA GES DISC
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
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
-
- Posts: 2
- Joined: Mon Feb 26, 2024 8:22 am America/New_York
Re: Downloading CO2 data from NASA GES DISC
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
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
-
- Subject Matter Expert
- Posts: 22
- Joined: Wed Feb 16, 2022 4:38 pm America/New_York
- Has thanked: 1 time
Re: Downloading CO2 data from NASA GES DISC
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)
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)
-
- Posts: 2
- Joined: Mon Feb 26, 2024 8:22 am America/New_York