File size: 14,228 Bytes
f459e18
 
873a821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f459e18
873a821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83bba05
 
 
ab6b7f1
83bba05
ab6b7f1
83bba05
7c93c6a
 
 
 
 
 
 
 
 
 
 
 
 
 
ab6b7f1
83bba05
ab6b7f1
83bba05
ab6b7f1
83bba05
ab6b7f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83bba05
 
 
873a821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9fc4a1d
873a821
 
 
 
 
 
 
 
 
 
 
 
 
9fc4a1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873a821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
---
license: apache-2.0
pretty_name: Event-SAR
viewer: false
size_categories:
- n<1K
tags:
- geospatial
- remote-sensing
- sar
- insar
- earthquake
- volcano
- webdataset
- pytorch
task_categories:
- image-feature-extraction
configs:
- config_name: default
  data_files:
  - split: train
    path: data/event-sar-train-*.tar
dataset_info:
  features:
  - name: npz.bin
    dtype: binary
  - name: json
    struct:
    - name: sample_key
      dtype: string
    - name: event_type
      dtype: string
    - name: event_id
      dtype: string
    - name: patch_id
      dtype: string
    - name: shared_valid_ratio
      dtype: float64
    - name: shared_valid_dem_vh_ratio
      dtype: float64
    - name: shared_valid_all_ratio
      dtype: float64
    - name: metadata_json
      dtype: string
  - name: __key__
    dtype: string
  - name: __url__
    dtype: string
---

# Event-SAR

Event-SAR contains **416 reviewed, coordinate-aligned SAR patches** around earthquake
and volcanic events: **314 earthquake patches from 53 events** and **102 volcano
patches from 102 events**. It complements [NA-SAR](https://huggingface.co/datasets/GFM-Bench/NA-SAR)
using the same WebDataset tar/NumPy packaging approach.

All 416 accepted patches are retained, including patches with partial coverage.
The latest final-pass GUI decisions are not used to remove samples. Original review
scores (3–5), event information, source provenance, geospatial grids, and exact valid
fractions are preserved. Additional matching acquisitions were processed with ASF
HyP3 to recover available missing coverage. Missing observations remain missing.

`train` is a storage split containing the entire corpus, **not** a prescribed
training/evaluation split. Multiple patches can belong to the same event and overlap;
use event-aware, spatially and temporally appropriate splits for evaluation.

<!-- EVENT-SAR-PREVIEWS -->
## Browse samples online

**[Open the six-example gallery](https://huggingface.co/datasets/GFM-Bench/Event-SAR/blob/main/previews/README.md)** — no dataset download or Python required. Three earthquake and three volcano examples, with Fair, Good, and Excellent review labels. Each shows all five stages and available orbits.

Fair, Good, and Excellent describe the existing review ratings; coverage is a separate measure. These are downsampled display previews, not training arrays. Checkerboards indicate missing data. The gallery explains scales and sample selection.

### Review rating distribution

Counts cover the full released dataset, not just the six examples. Review ratings and valid coverage are separate measures.

![Patch counts by review rating for earthquakes and volcanoes](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/review_counts.png)

| Event type | Fair | Good | Excellent | Total |
|---|---:|---:|---:|---:|
| Earthquake | 97 | 82 | 135 | 314 |
| Volcano | 23 | 52 | 27 | 102 |

[Download SVG](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/review_counts.svg) · [Counts CSV](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/review_counts.csv)


### Earthquake · Fair · us2000bqsn

![earthquake sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000186.jpg)

### Earthquake · Good · us7000irp8

![earthquake sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000296.jpg)

### Earthquake · Excellent · us20003k7w

![earthquake sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000124.jpg)

### Volcano · Fair · gvp_312030_22129

![volcano sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000392.jpg)

### Volcano · Good · gvp_273010_22151

![volcano sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000357.jpg)

### Volcano · Excellent · gvp_252120_22319

![volcano sample](https://huggingface.co/datasets/GFM-Bench/Event-SAR/resolve/main/previews/images/000000000320.jpg)

<!-- /EVENT-SAR-PREVIEWS -->

## Contents

- One WebDataset sample per accepted spatial patch, with `<sample_key>.npz.bin` and
  `<sample_key>.json` members in a tar shard.
- Five ordered stages: `pre0`, `pre1`, `event`, `post0`, `post1`.
- 218 patches have one orbit; 198 patches have two orbits. Orbit IDs and their
  acquisition times/directions are in the sample metadata. Views are sorted by orbit
  ID; `view_0` does **not** always mean ascending. No missing view is synthesized.
- Earthquake patches: 314 at 1024×1024 pixels.
- Volcano patches: 49 at 512×512, 47 at 1024×1024, and 6 at 2048×2048 pixels.
- All products within each patch share exactly the same CRS, affine transform,
  bounds, and dimensions. Alignment does not imply complete valid coverage.
- 23,570 source rasters, retained losslessly as arrays. Original wrapped phase is
  kept in addition to the derived cosine/sine representation.

For each available view `v`, with `T=5` and the patch's original `H,W`:

| Array key | Shape | Meaning |
|---|---|---|
| `prime_rtc_view_v` | `(T,2,H,W)` | Reference RTC channels `[VV,VH]`, raw linear backscatter |
| `secondary_rtc_view_v` | `(T,2,H,W)` | Secondary RTC channels `[VV,VH]` |
| `inc_angle_view_v` | `(T,1,H,W)` | Incidence from local vertical, radians |
| `ifg_view_v` | `(T,2,H,W)` | Derived `[cos(phase),sin(phase)]` |
| `wrapped_phase_view_v` | `(T,1,H,W)` | Original wrapped phase, radians |
| `coh_view_v` | `(T,1,H,W)` | Coherence |
| `dem` | `(1,H,W)` | Original DEM elevation values, meters |
| `slope_deg` | `(1,H,W)` | Original terrain slope, degrees |
| `common_valid` | `(1,H,W)` | Joint reference/secondary VV + coherence + phase mask |
| `common_valid_dem_vh` | `(1,H,W)` | Joint mask also requiring DEM and reference/secondary VH |
| `common_valid_all` | `(1,H,W)` | Joint mask also requiring incidence and slope |

All joint masks intersect **every saved orbit and stage**. They contain uint8 0/1;
scientific arrays retain float32 values and NaNs. A completely unavailable VH
acquisition remains NaN and can make the extended/all-product shared ratio zero.
DEM source vertical-reference information is preserved; no datum conversion is
applied. Incidence is **not** terrain-local incidence.

### Relationship to NA-SAR

The view-key families, RTC channel order, cosine/sine phase channels, raw DEM,
slope, tar shards, Parquet index, and shard manifest follow NA-SAR's conventions.
Event-SAR adds a leading stage dimension, variable patch sizes and orbit counts,
original wrapped phase, validity masks, and rich event metadata. Unlike NA-SAR's
zero-padding policy, Event-SAR preserves nodata as NaN for exact coverage filtering.
The NPZ payload uses the `.npz.bin` suffix so Hugging Face keeps it as binary
bytes instead of automatically expanding large arrays into nested Python lists.
It is an ordinary NumPy NPZ archive, readable with `numpy.load`. Rich metadata
is held in a JSON string to avoid automatic schema inference altering variable
source fields. Use the included Event-SAR loader rather than assuming NA-SAR's fixed-shape loader
can consume these samples unchanged. No normalization, resizing, cropping, or
coverage-based exclusion is applied during export.

## Metadata and coverage filtering

`metadata.parquet` has one row per patch, including:

- `sample_key`, `shard_path`, `shard_index`, `sample_index_in_shard`;
- event type/ID, patch ID, original score, stages, orbit IDs, dimensions;
- CRS, affine transform, projected/geographic bounds, event metadata JSON;
- `shared_valid_ratio`, `shared_valid_dem_vh_ratio`, `shared_valid_all_ratio`;
- NPZ/JSON checksums and the original metadata checksum.

`file_metadata.parquet` has one row per source raster, with its exact `valid_ratio`,
original GeoTIFF checksum, product/stage/orbit, and corresponding array key,
stage index, and channel index inside the NPZ.

Each sample's JSON has a fixed outer schema with identity and coverage fields. Its
`metadata_json` string preserves the complete patch/event/acquisition metadata and adds
`hf_export`: the view-to-orbit mapping, array shapes, source-to-array mapping,
and GeoTIFF units, scales, offsets, descriptions, and tags. Machine-specific path
prefixes are replaced by `source/diskN/` and `repository/`; these are provenance
identifiers, not URLs. The local original GeoTIFF release remains separate.

All ratios are exact fractions in `[0,1]`, not rounded percentages:

| Shared VV + InSAR coverage | Patches |
|---|---:|
| Exactly 100% | 49 |
| At least 99% | 347 |
| Above 95% | 385 |
| At or below 95% | 31 |

```python
import pandas as pd
from huggingface_hub import hf_hub_download

path = hf_hub_download('GFM-Bench/Event-SAR', 'metadata.parquet', repo_type='dataset')
metadata = pd.read_parquet(path)
selected = metadata[metadata.shared_valid_ratio > 0.95]  # 385 patches
```

## Streaming with Hugging Face Datasets

```python
from io import BytesIO
import numpy as np
from datasets import load_dataset

stream = load_dataset('GFM-Bench/Event-SAR', split='train', streaming=True)
sample = next(iter(stream))
with np.load(BytesIO(sample['npz.bin']), allow_pickle=False) as archive:
    rtc = archive['prime_rtc_view_0']   # (5,2,H,W)
    mask = archive['common_valid']     # (1,H,W)
import json
metadata = json.loads(sample['json']['metadata_json'])
print(metadata['event_id'], metadata['common_valid_fraction'])
```

The explicit equivalent is `load_dataset('webdataset',
data_files={'train':'hf://datasets/GFM-Bench/Event-SAR/data/event-sar-train-*.tar'},
split='train', streaming=True)`. Each large sample contains all of its stages;
streaming does not decompress the entire dataset in advance.

## Local PyTorch loading

Download the published folder with `huggingface_hub.snapshot_download`, or use an
existing local export. Import the included `event_sar_dataset.py`:

```python
from torch.utils.data import DataLoader
from event_sar_dataset import EventSARWebDataset

ds = EventSARWebDataset('/path/to/Event-SAR-HF', min_shared_valid_ratio=0.95)
# Threshold applies inclusively to the cropped common_valid mask.
loader = DataLoader(ds, batch_size=None, num_workers=2)
sample = next(iter(loader))
rtc = sample['arrays']['prime_rtc_view_0']

# To select one stage and remove its leading dimension:
event_only = EventSARWebDataset('/path/to/Event-SAR-HF', stage='event')
# event_only yields prime_rtc_view_0 with shape (2,H,W).
```

Variable sizes and orbit counts require an appropriate batching/collation policy.
The loader preserves raw values; models should handle NaNs using the supplied
masks and apply their own normalization.

The loader supports aligned crops and product selection:

```python
from event_sar_dataset import EventSARDataset, event_sar_collate

ds = EventSARDataset(
    '/path/to/Event-SAR-HF',
    event_type=['earthquake', 'volcano'],
    mode='all',                         # rtc, insar, or all (default)
    stages=['event'],
    crop_size=512,
    crop_mode='all',                    # random, central, or all
    min_shared_valid_ratio=0.95,
)
loader = DataLoader(ds, batch_size=4, collate_fn=event_sar_collate)
```

`rtc` returns reference/secondary VV/VH; `insar` returns cos/sin phase, wrapped
phase and coherence. `all` includes both plus DEM, slope and incidence. Explicit
`include_dem`, `include_slope`, `include_inc_angle` flags override auxiliary
defaults (off for rtc/insar, on for all). Unselected arrays are not decompressed.

Filtering uses only the cropped `common_valid` mask, intersecting VV/InSAR across
all original stages/views regardless of mode or selected stages. This mask does
not require valid VH or auxiliary products. No channel-specific thresholds are
used. A failing crop is skipped, with no random retries. The output
`shared_valid_ratio` reports actual crop coverage. Scores and score filters are
not exposed: the historical 3–5 review ratings are not final decisions. They
remain in raw source metadata solely as provenance.

`all` crop mode produces separate nonoverlapping tiles (1024 -> four 512 tiles);
dimensions must divide exactly. `random` produces one repeatable crop per sample
and epoch. Call `set_epoch(epoch)` before iteration; recreate persistent workers
after changing epochs. `central` selects the image center. `event_ids` and
`sample_keys` support custom selections. Raw values and NaNs remain unchanged.

Outputs include event date, center coordinates, magnitude/type (Mw or VEI),
stages, crop window and adjusted grid. Original patch coordinates are saved in
Parquet (`transform`, CRS, bounds, dimensions) and JSON (`grid`). Earthquake JSON
also preserves `reviewed_box` row/column offsets; volcano grids are event-centered.
Loader-created `crop_window` coordinates are relative to the native exported
patch and are generated at runtime, not stored on HF.

The collator returns a list to accommodate variable orbit counts. When filtering,
length is unknown until iteration; `num_candidate_crops` is an upper bound.
Shards are partitioned across workers/ranks; training must handle uneven counts.

## Provenance and integrity

SAR observations are Sentinel-1 products processed with ASF HyP3. Exact source
acquisitions, orbit groups, stage assignments, event catalog attributes, processing
parameters, and terrain provenance are recorded per sample. Original provider
attribution and source-product terms remain applicable.

`webdataset_summary.json` summarizes the export and verification.
`shard_manifest.jsonl` records each tar shard's sample count, size, and SHA256.
`SHA256SUMS` covers the published release files. Every source raster checksum/grid
was checked, every raw exported array was round-trip verified, and the joint masks
were reconstructed and compared before packaging. Cosine/sine phase is derived;
the original phase array is retained for exact reconstruction.

Remaining nodata, partial footprints, variable acquisition intervals, and absent VH
are part of this release. A high valid ratio measures data availability, not event
visibility or coherence quality. Event labels do not constitute pixel-level damage
or deformation annotations.