Download ASDC Data from DSCOVR/EPIC
Posted: Tue Jan 11, 2022 3:14 pm America/New_York
Hello there, I have been trying to write a script that can download single files from this folder `https://asdc.larc.nasa.gov/data/DSCOVR/ ... 3/2015/06/`. I have been using a script I found in one of the questions. Below is the code I have been using:
from getpass import getpass
from pathlib import Path
from requests import Session
import netCDF4 as nc
username = "omitting this part"
password = "omitting this part"
# Replace this URL with the URL you want to download
url = "https://asdc.larc.nasa.gov/data/DSCOVR/ ... 3/2015/06/"
# This code downloads the file to your current working directory (where you ran python from)
file_name = Path(url).name
session = Session()
_redirect = session.get(url)
_response = session.get(_redirect.url, auth=(username, password))
with open(file_name, 'wb') as file:
file.write(_response._content)
# print(_response._content)
from getpass import getpass
from pathlib import Path
from requests import Session
import netCDF4 as nc
username = "omitting this part"
password = "omitting this part"
# Replace this URL with the URL you want to download
url = "https://asdc.larc.nasa.gov/data/DSCOVR/ ... 3/2015/06/"
# This code downloads the file to your current working directory (where you ran python from)
file_name = Path(url).name
session = Session()
_redirect = session.get(url)
_response = session.get(_redirect.url, auth=(username, password))
with open(file_name, 'wb') as file:
file.write(_response._content)
# print(_response._content)