odsl-swot-download queries NASA Earthdata (CMR) for SWOT L2 LR SSH granules,
writes per-cycle manifests, and downloads whatever is missing. It is fully
idempotent: files already on disk are skipped, so re-running it simply
tops up the archive with newly released passes.
What you'll learn
- Checking what is already on
/spraybefore downloading anything. - Setting up NASA Earthdata credentials (
~/.netrc). - Downloading a cycle range of the Expert product.
- Grabbing the link for a single granule with
odsl-swot-granule-link.
Prerequisites: tutorial 1 (environment activated).
1. First, check what's already there
On the lab server most of the archive is already maintained. Before downloading, look:
ls /spray/swot/versionD # which cycles exist
ls /spray/swot/versionD/cycle_020 | wc -l # how many passes in cycle 20
A complete science-phase cycle has up to 584 pass files (some are always
missing — not every pass produces a granule). The per-cycle manifests in the
repo's database/ folder record what the archive should contain:
ls database/expert_cycle_020*
database/expert_cycle_020.csv # selected file per pass
database/expert_cycle_020_download_links.csv # every link CMR returned
If the cycles you need are present, skip straight to tutorial 3.
2. Earthdata credentials (~/.netrc)
Downloading (not reading!) requires a free NASA Earthdata account
(https://urs.earthdata.nasa.gov). Store the credentials in ~/.netrc:
machine urs.earthdata.nasa.gov login <username> password <password>
chmod 600 ~/.netrc
All ODSL downloaders authenticate through this file via earthaccess — you
never type a password into a script.
3. Download a cycle range
Download the Expert product for science cycles 20–30 into the default
/spray/swot/versionD root:
odsl-swot-download --cycle-start 20 --cycle-end 30 --product-type Expert
For each cycle the tool:
- queries CMR for all granule links and writes
database/expert_cycle_###_download_links.csv; - picks the best available version of each pass (newer processing versions
win) and writes
database/expert_cycle_###.csv; - downloads the files that are missing from
cycle_###/under the data root.
Existing per-cycle link lists are reused, except the last cycle in the
range, which is always re-queried — that is how an ongoing cycle picks up
newly released passes. Progress is appended to swot/swot_downloader.log.
--product-type accepts Basic, Expert, Unsmoothed, or WindWave
(case-insensitive); Expert is the default.
Downloading to your own directory
Off the lab server (or for a private copy), redirect both the data root and the manifest directory:
odsl-swot-download --cycle-start 1 --cycle-end 5 \
--data-root /scratch/$USER/swot \
--database-dir /scratch/$USER/swot/database
Paranoid mode
Two optional integrity flags:
odsl-swot-download --cycle-start 20 --cycle-end 30 \
--validate-urls # HEAD-check each URL before downloading
--verify-downloads # verify each fresh file against remote metadata
Both slow things down; use them when a previous run was interrupted or you suspect truncated files.
4. One granule at a time
When you just want a link — to wget on another machine, to share, or to
check what version is current — use odsl-swot-granule-link with a cycle and
pass number:
odsl-swot-granule-link 20 13
https://archive.podaac.earthdata.nasa.gov/.../SWOT_L2_LR_SSH_Expert_020_013_..._PGC0_01.nc
It prints the preferred link (highest processing version). --all prints
every matching link instead, and --product-prefix switches product
(default SWOT_L2_LR_SSH_Expert):
odsl-swot-granule-link 20 13 --all
odsl-swot-granule-link 20 13 --product-prefix SWOT_L2_LR_SSH_Unsmoothed
Troubleshooting
- Authentication errors — check
~/.netrcspelling (machine urs.earthdata.nasa.gov), permissions (chmod 600), and that your Earthdata password contains no characters your shell mangled when you created the file. - A cycle returns zero links — the cycle probably hasn't been flown or released yet (science cycles appear roughly every 21 days), or you asked for a cal/val-range cycle number that doesn't exist for this product. Remember the cycle-numbering gotcha.
- A run was interrupted — just re-run the same command; existing files are
skipped. Add
--verify-downloadsif you suspect a partial file.