Geographic regridding (odsl-swot-regrid, tutorial 5) maps
swaths onto lat/lon or Cartesian grids. This tutorial covers the swath-aligned
OI products used for KaRIn noise work: a full-pass 1 km grid, and 30 km tiles
at 250 m after an FFT low-pass.
Coordinates stay in the swath frame (x = cross-track metres, y = along-track
geodesic metres). There is no rotation to geographic north. Output NetCDFs
still carry latitude / longitude on the new grid.
Prerequisites: tutorial 1. Science cycle 3 pass 1 is a good first example.
1. Uniform 1 km coordinate grids (once per pass)
odsl-swot-build-1km-grid builds merged left+right 1 km grids from Expert
nadir tracks. Science and cal/val orbits are separate. Cycle 005 is the
preferred Expert source (all 584 science passes); empty nadir tracks fall
back to other cycles.
python swot/build_uniform_grid.py --spacing 1000 --workers 16
Output (already built on Spray, ~24 GB, 612 passes):
/spray/swot/regrid_1km/science/pass_NNN_grid_1km.nc
/spray/swot/regrid_1km/calval/pass_NNN_grid_1km.nc
Each file has latitude, longitude, cross_track_distance,
along_track_distance. Cross-track spans about −65 km to +65 km (131 pixels);
along-track is ~19 731 lines. The nadir gap is kept as NaN.
2. Regrid one Unsmoothed pass to 1 km
odsl-swot-regrid-1km --cycle 3 --pass 1
# or
python swot/regrid_unsmoothed_to_1km.py --cycle 3 --pass 1 --workers 8
Default parameter sets (Gaussian half-decay: weight = 0.5 at that distance):
| Label | Search radius | Half-decay |
|---|---|---|
r1000_l500 |
1 km | 500 m |
r2000_l1000 |
2 km | 1 km |
Custom pair: --search-radius 1500 --half-decay-scale 800.
Writes /spray/swot/regrid_1km/cycle_CCC/pass_PPP_regridded_1km.nc.
Default (two parameter sets) stores ssha and uncert with a n_param
dimension plus search_radius_m, half_decay_scale_m, and
parameter_labels. A single custom pair writes 2-D ssha / uncert.
QC applied to Unsmoothed pixels (in order)
ssha = ssha_karin_2 + height_cor_xover(additive)ssha_karin_2_qual == 0ancillary_surface_classification_flag == 0(open ocean)|ssha| ≤ 3 m
OI then drops a target if more than 70% of raw pixels in the search radius
are non-ocean, if fewer than min_obs valid observations remain, or if the
estimate is outside the clip range. Rejected points are NaN in both ssha
and uncert.
Lon in Unsmoothed files may be [0, 360) — normalize before geographic
subsetting.
A ~19 min full pass is typical (param set 1 ~2.5 min, set 2 ~16 min).
python swot/plot_regridded_segment.py \
--cycle 3 --pass 1 --start-lat 15 --end-lat 32
3. 30 km / 250 m FFT + OI tiles (noise catalog)
swot/unsmoothed_fft_oi.py turns each Unsmoothed left/right swath into 30 km
tiles at 250 m after a 4 km FFT2 low-pass. Resume-safe: existing .h5 files
are skipped.
python swot/unsmoothed_fft_oi.py --cycle 6 --pass 350
python swot/unsmoothed_fft_oi.py --workers 8 # mass job
Output:
/spray/swot/statistics/oi_250m_fft4km/cycle_XXX/pass_YYY_{left,right}.h5
HDF5 groups seg_NNNN hold ssha_native, ssha_fft, ssha_oi plus lat/lon.
Sidecar CSV has seg_index, start_line, swh_m, noise_m, valid_frac.
Locked algorithm (do not “improve” without being asked):
- Middle 150 of 240 cross-track pixels; no latitude gate (ice is Expert-flagged).
- Pixel QC: SSHA / σ0 / xover qual == 0 and open-ocean class.
- Expert line QC:
rain_flag==0,dynamic_ice_flag==0,ice_conc<0.5%,rain_rate<0.5 mm/h, ocean class ≥ 95%. - 150×150 segments, stride 100. Keep if
valid_frac≥0.995, SWH < 2 m, 8×MAD outlier fraction ≤ 0.002, σ_DD/2 ≤ 8 cm. - FFT2 Gaussian low-pass, k0 = 1/4 km⁻¹. Keep k=0 and l=0. Restore mean.
- Local Gaussian remap, L = 1 km, R = 2 km, k-NN = 48.
Progress: tail -f /spray/swot/statistics/oi_250m_fft4km/logs/process.log
4. Related tile-noise tools
40×40 Unsmoothed tiles for the KaRIn noise catalog (not the 250 m OI product):
python swot/extract_unsmoothed_tiles.py --workers 8
Tiles land under /spray/swot/statistics/raw_tiles/. Per-tile statistics
(double-difference noise, Expert SWH/wind join) are in
/spray/swot/statistics/diagnostics/. Single-tile OI lives in
swot/oi_regrid_tile.py.
Next: Tutorial 6 — PIXC or the /spray path reference.