merradownload
A Python package for downloading, cleaning, and aggregating meteorological data from NASA's MERRA-2 database.
Adapted from Emily Laiken's merradownload, which builds on Jan Urbansky's opendap_download and the Open Power System Data notebook. Edited and maintained by Anemona.
Installation
pip install merradownload
Prerequisites: NASA Earthdata account
- Register at https://urs.earthdata.nasa.gov/
- Go to Applications → Authorized Apps → Approve More Applications
- Approve NASA GESDISC DATA ARCHIVE
Quick start
Python API
from opendap_download.multi_processing_download import DownloadManager
dm = DownloadManager(
username='your_earthdata_username',
password='your_earthdata_password',
links=['https://...'], # list of OPeNDAP query URLs
download_path='data/output', # where to save .nc4 files
)
dm.start_download(nr_of_threads=5)
CLI
merradownload \
--username YOUR_USER \
--password YOUR_PASS \
--urls-file urls.txt \
--output-dir data/output \
--threads 5
urls.txt should contain one OPeNDAP query URL per line. See examples/merra_scraping.py for how to generate these URLs for a given location, year range, and variable set.
Example script
examples/merra_scraping.py shows a complete end-to-end workflow: coordinate translation → URL generation → download → xarray/pandas processing → CSV and plot outputs.
Dependencies
| Package | Purpose |
|---|---|
requests |
HTTP downloads |
urllib3 |
Retry logic |
tqdm |
Progress bar |
pyyaml |
Optional credential file support |
Processing dependencies (used in the example script only, not required by the core package):
pip install numpy pandas xarray netCDF4 matplotlib
Features
- Parallel downloads via
ThreadPoolExecutor - Automatic retry on HTTP 5xx errors (3 retries, exponential backoff)
- Skips already-downloaded files — safe to resume interrupted runs
- Progress bar
- Credential file support (
yaml)
Release files for merradownload 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| merradownload-1.0.2.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| merradownload-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / merradownload-1.0.2.tar.gz
| Download URL | merradownload-1.0.2.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81ad02da5eb8a04a3c1b6409839f43769fcec80a86c4f91a80243ef57c53580c
|
|
BLAKE2b-256 checksum How to use checksums |
f7a0122688e69d003af2f3611b7bf44acd9ebab1a0525a64de0520fe86797d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / merradownload-1.0.2-py3-none-any.whl
| Download URL | merradownload-1.0.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72ea0aade6db103ac4a767d4cdd30e898d795989f752986b65149d4cbf91141b
|
|
BLAKE2b-256 checksum How to use checksums |
9dfc5fba4e8ce575b614274ed23fba9b0138239d6bb2beb31d913b24db781b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|