Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Mapping xOPR frames to ICESat-2 ATL06 granules

Open Polar Radar frames now carry per-item morton coverage (opr:mbox, four variable-resolution cells at order 18) in every STAC catalog that’s been reprocessed under issue #78. This notebook demonstrates how to combine that coverage with a single NASA CMR query for ICESat-2 ATL06 (land-ice elevation) granules to produce a GeoDataFrame of xOPR frames with a variable-length list of intersecting granules per row.

The workflow mirrors (and extends) the morton-indexed catalog pattern used in the magg library: hit CMR once, build a local index, then do all per-frame matching against the local index. We compare two matching backends against each other:

See issue #86 for the design discussion.

1. Configuration

Pick a season catalog and a temporal window for the CMR query.

Ways to specify the temporal window (resolve_temporal_window accepts any of these):

  • date_range=("2024-01-01", "2024-06-30") — explicit ISO dates or datetime.date objects.

  • cycle=22 — an ICESat-2 repeat cycle (91 days from launch, magg-compatible).

  • mode="exact_year" — min/max of the catalog’s opr:date. Only valid for post-2018-10-13 seasons.

  • mode="all_years" — ICESat-2 launch (2018-10-13) to today.

The ICESat-2 ATL06 product repeats on a 91-day ground track, so for pre-launch radar seasons, choosing any full cycle still gives you useful crossovers over the same lines.

2. Load the xOPR STAC catalog

source.coop serves one parquet per collection; we just read it directly. The key column for this notebook is opr:mbox — gate on it and warn if missing.

Loaded 1126 frames from 2016_Antarctica_DC8
Date range: 20161014 – 20161118
Loading...

2b. (Optional) Subset the catalog to frames near your points

If you already have a set of (lat, lon) points of interest — e.g. rift tip locations, crossover targets, grounding-line samples — you can filter the catalog down to frames whose opr:mbox covers any of them. The check uses the same morton prefix pattern as xopr.bedmap.morton_match: each point gets an order-18 morton, and any frame whose mbox has a prefix of that morton is a hit.

Set POINTS_OF_INTEREST = None to skip this step and keep every frame.

Subset by 3 points: 1126 → 1 frames

3. Derive the CMR bounding box

We only need a coarse spatial filter for the upstream CMR query — the per-frame matching below does the real geometric work. Union the bounding envelopes of every frame’s opr:mbox cells to get a tight footprint.

(CMR also accepts real polygon= queries with geodetic great-circle edges. We stick with a bbox here for simplicity; see issue #86 for the tradeoff.)

CMR bbox (lon_min, lat_min, lon_max, lat_max): (-105.99056603773585, -75.7091526879851, -103.5, -74.97216337509033)

4. Resolve the temporal window

Temporal window: 2024-01-06 → 2024-04-06

5. One CMR query, many matches

This is the only network call to NASA CMR in the whole notebook. Everything downstream runs locally. For all_years over Antarctica, expect a few thousand ATL06 granules.

CMR returned 24 granules in 12.4s

6. Match frames to granules — two backends

6a. STRtree backend

Reproject granule polygons into EPSG:3031 and build a shapely STRtree. For each frame, materialize 4 mbox cell polygons via mortie.tools.mort2polygon, reproject them, query the tree with predicate="intersects", and union the hits.

This is exact polygon-polygon intersection — the mbox cells are real polygons with great-circle/rotated shapes, not axis-aligned boxes, so we don’t collapse them to extents.

Built STRtree over 24 granule polygons in 0.00s
Matched 1 frames in 0.00s
Loading...
Loading...
[{'granule_id': 'ATL06_20240327105514_01342310_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/27/ATL06_20240327105514_01342310_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/27/ATL06_20240327105514_01342310_007_01.h5'}, {'granule_id': 'ATL06_20240125135154_05762210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/25/ATL06_20240125135154_05762210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/25/ATL06_20240125135154_05762210_007_01.h5'}, {'granule_id': 'ATL06_20240323110341_00732310_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/23/ATL06_20240323110341_00732310_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/23/ATL06_20240323110341_00732310_007_01.h5'}, {'granule_id': 'ATL06_20240219014935_09502212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/19/ATL06_20240219014935_09502212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/19/ATL06_20240219014935_09502212_007_01.h5'}, {'granule_id': 'ATL06_20240215015753_08892212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/15/ATL06_20240215015753_08892212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/15/ATL06_20240215015753_08892212_007_01.h5'}, {'granule_id': 'ATL06_20240117032156_04472212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/17/ATL06_20240117032156_04472212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/17/ATL06_20240117032156_04472212_007_01.h5'}, {'granule_id': 'ATL06_20240319002527_00052312_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/19/ATL06_20240319002527_00052312_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/19/ATL06_20240319002527_00052312_007_01.h5'}, {'granule_id': 'ATL06_20240121140015_05152210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/21/ATL06_20240121140015_05152210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/21/ATL06_20240121140015_05152210_007_01.h5'}, {'granule_id': 'ATL06_20240219123613_09572210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/19/ATL06_20240219123613_09572210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/19/ATL06_20240219123613_09572210_007_01.h5'}, {'granule_id': 'ATL06_20240117140833_04542210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/17/ATL06_20240117140833_04542210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/17/ATL06_20240117140833_04542210_007_01.h5'}, {'granule_id': 'ATL06_20240215124430_08962210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/15/ATL06_20240215124430_08962210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/15/ATL06_20240215124430_08962210_007_01.h5'}, {'granule_id': 'ATL06_20240315112020_13382210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/15/ATL06_20240315112020_13382210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/15/ATL06_20240315112020_13382210_007_01.h5'}, {'granule_id': 'ATL06_20240315003341_13312212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/15/ATL06_20240315003341_13312212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/15/ATL06_20240315003341_13312212_007_01.h5'}, {'granule_id': 'ATL06_20240319111205_00122310_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/19/ATL06_20240319111205_00122310_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/19/ATL06_20240319111205_00122310_007_01.h5'}, {'granule_id': 'ATL06_20240113033022_03862212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/13/ATL06_20240113033022_03862212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/13/ATL06_20240113033022_03862212_007_01.h5'}, {'granule_id': 'ATL06_20240211020615_08282212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/11/ATL06_20240211020615_08282212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/11/ATL06_20240211020615_08282212_007_01.h5'}, {'granule_id': 'ATL06_20240311004211_12702212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/11/ATL06_20240311004211_12702212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/11/ATL06_20240311004211_12702212_007_01.h5'}, {'granule_id': 'ATL06_20240109033842_03252212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/09/ATL06_20240109033842_03252212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/09/ATL06_20240109033842_03252212_007_01.h5'}, {'granule_id': 'ATL06_20240207021440_07672212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/07/ATL06_20240207021440_07672212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/07/ATL06_20240207021440_07672212_007_01.h5'}, {'granule_id': 'ATL06_20240227121929_10792210_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/27/ATL06_20240227121929_10792210_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/02/27/ATL06_20240227121929_10792210_007_01.h5'}, {'granule_id': 'ATL06_20240121031337_05082212_007_01.h5', 's3_url': 's3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/21/ATL06_20240121031337_05082212_007_01.h5', 'https_url': 'https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/21/ATL06_20240121031337_05082212_007_01.h5'}]

6b. Morton prefix backend

For each granule, densify the CMR-reported boundary and compute a full-order (order 18) morton for every sample. For each frame mbox cell (a variable-length prefix string), any granule whose sample morton starts with that prefix overlaps the cell. Same string-prefix pattern used by xopr.bedmap.morton_match — it generalizes from points to polygons by sampling.

Built prefix index over 24 granules in 0.01s
Matched 1 frames in 0.01s
Loading...

7. Backend comparison

7a. Timings

Loading...

7b. Per-frame hit agreement

We treat the STRtree result as ground truth (exact polygon intersection) and ask: how often does the prefix backend miss a true hit, and how often does it over-report?

Frames with any disagreement: 1/1
Mean missed by prefix: 0.00
Mean extra from prefix: 1.00
Loading...

What to expect:

  • STRtree is exact — every hit corresponds to a real polygon-polygon intersection.

  • Prefix can miss — if a frame’s mbox cell lies entirely inside a granule with none of the densified boundary samples landing in the cell. In practice rare for thin ATL06 strips at default n_per_segment=50; raise the knob if your missed count is nonzero.

  • Prefix can over-report — an opr:mbox cell overapproximates the frame’s true geometry (mortie rounds up to cell boundaries), so a granule touching the cell but not the line string still counts as a hit. This is the same overapproximation inherent to opr:mbox, not specific to the prefix backend.

For large catalogs where granules outnumber frames, STRtree is usually faster to match because polygon intersection short-circuits in log-time via the spatial index; prefix matching is O(frames × granules × samples × 4).

8. Final result: frame → granule table

We carry the STRtree result forward (exact), but the prefix result has the same schema and is drop-in compatible. Each row is an xOPR frame; atl06_granules is a variable-length list of dicts (granule_id, s3_url, https_url) so downstream code can pick the URL flavor that suits its auth context.

1 frames, 21 total frame↔granule edges
Frames with ≥1 granule: 1 (100.0%)
Median granules per frame: 21
Loading...
Frame Data_20161103_06_010 matches 21 ATL06 granules.
First three:
  ATL06_20240327105514_01342310_007_01.h5
    s3:    s3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/27/ATL06_20240327105514_01342310_007_01.h5
    https: https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/27/ATL06_20240327105514_01342310_007_01.h5
  ATL06_20240125135154_05762210_007_01.h5
    s3:    s3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/25/ATL06_20240125135154_05762210_007_01.h5
    https: https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/01/25/ATL06_20240125135154_05762210_007_01.h5
  ATL06_20240323110341_00732310_007_01.h5
    s3:    s3://nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/23/ATL06_20240323110341_00732310_007_01.h5
    https: https://data.nsidc.earthdatacloud.nasa.gov/nsidc-cumulus-prod-protected/ATLAS/ATL06/007/2024/03/23/ATL06_20240323110341_00732310_007_01.h5

9. Quick map: frames coloured by granule hit count

A matplotlib scatter in EPSG:3031 to sanity-check the spatial distribution of hits.

<Figure size 900x900 with 2 Axes>

Follow-ups

Planned (see issue #86):

  1. Read-along demo — pick a frame with hits, open a matched ATL06 granule via h5coro or icepyx, clip to a buffer around the frame LineString, and co-plot ATL06 surface elevations against the frame’s radar echogram / picked surface layer.

  2. Reverse direction — given one ATL06 ground track, find every xOPR frame across all seasons that crosses it.

  3. Persistent local catalog — mirror magg’s on-disk JSON catalog so repeated notebook runs don’t hit CMR.

  4. Unified prefix core — share one prefix-matching implementation between xopr.bedmap.morton_match and xopr.crossovers once both workflows are stable.