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:
- User Services
- Posts: 132
- Joined: Fri Apr 23, 2021 9:14 am America/New_York
- Has thanked: 12 times
- Been thanked: 6 times
Thank you for reaching the Forum.
Is there a specific question you had regarding the python code?
If you are trying to download one single file, you can also just click on the link of the file, and will directly download it into your machine. Or you can also use the Earthdata Search link to choose your granules.
https://asdc.larc.nasa.gov/project/DSCO ... 2_CLOUD_03
Please let us know,