Because a pass number always covers the same footprint, stacking one pass across many cycles gives you a time series of 2-D swath snapshots over your region — a cube with dimensions (n_cycle, n_lines, n_pixels). This is the natural unit for studying how eddies and fronts in a region evolve from one 21-day repeat to the next.

What you'll learn

  • Building an Expert SSHA cube with odsl-swot-subset.
  • What corrections are applied on the way in (and how to turn them off).
  • The Unsmoothed variant (native resolution, left/right swath sides).
  • Plotting the cube, one panel per cycle, with odsl-swot-plot-cube.

Prerequisites: tutorial 1; a pass number over your region (tutorial 3). Example: pass 13 over the Gulf of America, cycles 20–30.


1. Build an Expert cube

odsl-swot-subset --cycle-start 20 --cycle-end 30 --pass 13 \
    --lat-range 18 31 \
    --output ~/swot/pass_013_cycle_020-030.nc

Required arguments: the cycle range, the pass (--pass or --pass-number), and --lat-range MIN MAX — since a pass is a north–south ribbon, a latitude band is the regional subset; no longitude bounds are needed.

For each cycle the tool finds the pass granule under --base-folder (default /spray/swot/versionD), trims it to the latitude band, and stacks everything along a new n_cycle dimension into one compressed NetCDF. Cycles whose granule is missing are reported and skipped. If you omit --output, the file lands under the data root's subsets/ folder with an auto-generated name (prefer an explicit path in your own space on the lab server). An existing output is never clobbered unless you pass --overwrite.

By default all variables are kept. For lean files, list what you need (latitude/longitude are always included):

odsl-swot-subset --cycle-start 20 --cycle-end 30 --pass 13 \
    --lat-range 18 31 \
    --variables ssha_karin_2 ssha_karin_2_qual \
    --output ~/swot/pass_013_ssha.nc

Corrections applied on the way in

When the SSHA variables (ssha_karin, ssha_karin_2) are subset, two standard corrections are added by default where available:

Correction Source variable Disable with
Crossover calibration height_cor_xover (applied when present)
Internal-tide (HRET) internal_tide_hret --no-internal-tide-correction

So the SSHA in your cube is already the corrected field. Keep this in mind if you later compare against raw granules.

Quicklook

Add --plot to get a multi-panel Cartopy map straight away:

odsl-swot-subset --cycle-start 20 --cycle-end 30 --pass 13 \
    --lat-range 18 31 --output ~/swot/pass_013_ssha.nc \
    --plot --plot-variable ssha_karin_2

The PNG lands next to the NetCDF (override with --plot-output).

2. The Unsmoothed variant

The native-resolution product stores the two swath sides in separate NetCDF groups, so it has its own subsetter, reached through the unified CLI:

odsl-swot-swath subset --product unsmoothed \
    --cycle-start 20 --cycle-end 30 --pass 13 \
    --lat-range 18 31 --side both \
    --output ~/swot/unsmoothed_pass_013.nc

--side is left, right, or both (default both; sides are concatenated along a swath_side dimension). The other arguments match the Expert subsetter; there are no plot options here — use the tools below.

3. Look inside

A cube is a plain NetCDF, so xarray reads it directly:

import xarray as xr

ds = xr.open_dataset("~/swot/pass_013_ssha.nc")
print(ds)                      # dims: n_cycle, n_lines, n_pixels
print(ds.cycle.values)         # which cycles made it in

ssha = ds.ssha_karin_2.where(ds.ssha_karin_2_qual == 0)   # good pixels only
print(float(ssha.std()))

4. Plot the cube: odsl-swot-plot-cube

One panel per cycle, either as fast imshow panels (swath coordinates) or on Cartopy maps with --map:

odsl-swot-plot-cube ~/swot/pass_013_ssha.nc \
    --variable ssha_karin_2 --map --bbox -98 18 -80 31 \
    --max-panels 12 --cmap RdBu_r \
    --output ~/plots/pass013_panels.png

Notes:

  • Only pixels whose quality flag equals 0 are drawn (flag variable defaults to ssha_karin_2_qual; change with --quality-variable).
  • Select cycles either by coordinate value (--cycles 20 22 24) or by position in the cube (--cycle-indices 0 1 2); by default the first --max-panels (12) cycles are shown.
  • Colour limits come from the 1st–99th percentile of the plotted data; tune with --vmin-percentile / --vmax-percentile.
  • For an Unsmoothed cube, pick the swath side with --side left.
  • Default output is <input stem>_<variable>_panels.png next to the input; --show opens an interactive window instead.

Troubleshooting

  • "Output exists" — pass --overwrite, or point --output somewhere new.
  • Many cycles reported missing — the granules aren't downloaded for those cycles (tutorial 2), or your cycle range strays into the cal/val numbering (tutorial 1).
  • Cube looks striped/noisy near the swath edges — that's real: KaRIn noise grows toward the inner and outer edges. The quality mask removes the worst of it; regridding with a Gaussian kernel (tutorial 5) smooths the rest.

Next: Tutorial 5 — Regridding swaths onto regular grids.