Created
July 24, 2025 20:13
-
-
Save AdrianoPereira/8d7fd75d1aee7797ce485181fc3f15b9 to your computer and use it in GitHub Desktop.
Download IMERG product, just change DOI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import earthaccess | |
| # from dotenv import load_dotenv | |
| import argparse | |
| # load_dotenv() | |
| os.environ['EARTHDATA_USERNAME'] = '<your-user-here>' | |
| os.environ['EARTHDATA_PASSWORD'] = '<your-password-here>' | |
| os.environ['OUTPUT_DIR'] = 'path/to/save' | |
| earthaccess.login() | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-s', '--start', help="Start date (yyyy-mm-dd)", required=True) | |
| parser.add_argument('-e', '--end', help="End date (yyyy-mm-dd)", required=True) | |
| args = parser.parse_args() | |
| start_datetime = f"{args.start} 00:00:00" | |
| end_datetime = f"{args.end} 23:30:00" | |
| print(start_datetime, end_datetime) | |
| # exit(0) | |
| # Get files by doi | |
| results = earthaccess.search_data( | |
| doi='10.5067/GPM/IMERG/3B-HH-E/07', | |
| bounding_box=(-180, -60, 180, 60), | |
| temporal=(start_datetime, end_datetime), | |
| # temporal=("2024-09-03 00:00:00", "2024-09-03 10:30:00"), | |
| ) | |
| earthaccess.download(results, f"{os.environ['OUTPUT_DIR']}/IMERG_Late", threads=45) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment