DataDownloads API
The download module turns source/protocol TOML configuration into verified ERA5, GEOS-FP, GEOS-IT, and MERRA-2 input files. See Data sources for the configuration-oriented guide.
AtmosTransport.DataDownloads Module
DownloadsTOML-driven download pipeline for meteorological and emissions data.
Provides a unified entry point for downloading ERA5, GEOS-FP, GEOS-IT, and MERRA-2 data. All download parameters are specified in TOML config files; the pipeline dispatches on source type and access protocol.
Architecture
Two orthogonal dispatch axes:
AbstractDownloadSource — what data to download
├── ERA5Source — ECMWF ERA5 reanalysis
├── GEOSFPSource — NASA GEOS-FP forward processing
├── GEOSITSource — NASA GEOS-IT retrospective
└── MERRA2Source — NASA MERRA-2 reanalysis
AbstractDownloadProtocol — how to download it
├── CDSProtocol — CDS API (Python subprocess)
├── MARSProtocol — MARS API (Python subprocess, CDS fallback)
├── OPeNDAPProtocol — NCDatasets remote subset
├── HTTPProtocol — Direct HTTP with Content-Length verification
└── S3Protocol — AWS S3 CLIUsage
julia --project=. scripts/downloads/download_data.jl config/downloads/era5_native_monthly.toml \
[--start 2021-12-01] [--end 2021-12-31] [--dry-run] [--verify]Output paths follow the canonical Data Layout hierarchy: <data_root>/met/<source>/<grid>/<cadence>/<payload>/
sourceAtmosTransport.DataDownloads.CDSProtocol Type
CDSProtocolCopernicus Climate Data Store API (Python cdsapi subprocess). Requires ~/.cdsapirc.
sourceAtmosTransport.DataDownloads.DownloadConfig Type
DownloadConfig{S, P}Complete download configuration parsed from a recipe TOML. Parameterized on source and protocol for concrete dispatch.
sourceAtmosTransport.DataDownloads.ERA5Source Type
ERA5SourceERA5 reanalysis from ECMWF. Supports spectral GRIB, gridded model-level, and surface fields. Monthly chunking is the production default.
sourceAtmosTransport.DataDownloads.GEOSFPSource Type
GEOSFPSourceGEOS-FP forward processing from NASA GMAO. Native cubed-sphere (C720) or regridded lat-lon (0.25° × 0.3125°).
sourceAtmosTransport.DataDownloads.GEOSITSource Type
GEOSITSourceGEOS-IT retrospective from NASA GMAO. Native cubed-sphere (C180).
sourceAtmosTransport.DataDownloads.HTTPProtocol Type
HTTPProtocolDirect HTTP file download via Downloads.jl with Content-Length verification.
sourceAtmosTransport.DataDownloads.MARSProtocol Type
MARSProtocolECMWF MARS API (Python ecmwfapi subprocess). Falls back to CDS if MARS credentials are unavailable. Requires ~/.ecmwfapirc.
sourceAtmosTransport.DataDownloads.MERRA2Source Type
MERRA2SourceMERRA-2 retrospective reanalysis (1980–present). 0.5° × 0.625° lat-lon.
sourceAtmosTransport.DataDownloads.OPeNDAPProtocol Type
OPeNDAPProtocolOPeNDAP remote subset via NCDatasets.jl. No Python dependency.
sourceAtmosTransport.DataDownloads.PythonEnvironment Type
PythonEnvironmentCached Python interpreter configuration. Detected once, reused for all CDS/MARS API calls in the session.
sourceAtmosTransport.DataDownloads.S3Protocol Type
S3ProtocolAWS S3 download via aws s3 cp subprocess.
AtmosTransport.DataDownloads.detect_python_env Function
detect_python_env(python_path="python3") -> PythonEnvironmentProbe the Python installation for available packages and API credentials. Called once during module initialization.
sourceAtmosTransport.DataDownloads.download_data! Method
download_data!(cfg::Dict{String,Any}; start_date=nothing, end_date=nothing,
dry_run=false, verify_only=false)Main entry point. Parses TOML config and executes downloads.
dry_run: print what would be downloaded without executingverify_only: check existing files against expected sizes
AtmosTransport.DataDownloads.parse_download_config Method
parse_download_config(cfg::Dict{String,Any}) -> DownloadConfigParse a download recipe TOML into a fully resolved DownloadConfig.
sourceAtmosTransport.DataDownloads.verified_download Method
verified_download(url, dest; max_retries=3) -> BoolDownload url to dest with Content-Length integrity checking.
HTTP HEAD → Content-Length
If file exists with matching size → skip (verified)
If exists but wrong size → retain it until a verified replacement is ready
After download: verify local size matches Content-Length
If mismatch: delete corrupt file and retry
AtmosTransport.DataDownloads.verify_downloads Method
verify_downloads(dir, dates, file_pattern; url_builder=nothing) -> NamedTupleScan a download directory for missing or corrupt files. Returns (; ok, corrupt, missing).