NA-SAR / README.md
Ehzoahis's picture
Use final RTC channel normalization constants
264984d verified
---
viewer: false
pretty_name: "NA-SAR"
tags:
- geospatial
- remote-sensing
- sar
- earth-observation
- self-supervised-learning
- pretraining
- webdataset
- pytorch
size_categories:
- 1M<n<10M
task_categories:
- image-feature-extraction
---
# NA-SAR
NA-SAR is a North America synthetic aperture radar pretraining dataset built
from the NASA OPERA archive. It is intended for self-supervised and masked-image
pretraining of SAR foundation models.
This release is an unsplit pretraining corpus. There are no train/validation/test
partitions because the dataset is not intended to define an evaluation protocol.
Downstream evaluations should define their own geographically and temporally
appropriate splits.
## Dataset Contents
- Samples: 1,099,604
- Patch size: 128 x 128 pixels
- RTC views: two spatial views per sample
- Temporal RTC acquisitions: prime and secondary
- RTC channels: co-pol and cross-pol, with missing polarization zero padded
- Incidence angle: one channel per spatial view
- InSAR phase: stored as cos(phi), sin(phi)
- Coherence: one channel per spatial view
Each tensor sample contains:
| Key | Shape | Description |
| --- | --- | --- |
| `prime_rtc_view_0` | `(2, 128, 128)` | Prime RTC view 0, co-pol/cross-pol |
| `secondary_rtc_view_0` | `(2, 128, 128)` | Secondary RTC view 0, co-pol/cross-pol |
| `prime_rtc_view_1` | `(2, 128, 128)` | Prime RTC view 1, co-pol/cross-pol |
| `secondary_rtc_view_1` | `(2, 128, 128)` | Secondary RTC view 1, co-pol/cross-pol |
| `inc_angle_view_0` | `(1, 128, 128)` | Incidence angle for view 0 |
| `inc_angle_view_1` | `(1, 128, 128)` | Incidence angle for view 1 |
| `ifg_view_0` | `(2, 128, 128)` | InSAR phase for view 0 as cos/sin |
| `coh_view_0` | `(1, 128, 128)` | Coherence for view 0 |
| `ifg_view_1` | `(2, 128, 128)` | InSAR phase for view 1 as cos/sin |
| `coh_view_1` | `(1, 128, 128)` | Coherence for view 1 |
## Metadata
`metadata_hf.parquet` is the publishable metadata table for the sharded release.
It includes OPERA provenance, patch geometry, quality score, polarization
availability, and the following sharding columns:
- `sample_key`: sample key inside the WebDataset shard
- `shard_path`: relative path to the tar shard
- `shard_index`: integer shard id
- `sample_index_in_shard`: row order within that shard
The metadata is filtered to samples with `quality_score > 0.53`.
## Loading With Hugging Face Datasets
The sharded release can be streamed with the WebDataset loader:
```python
from io import BytesIO
import numpy as np
from datasets import load_dataset
ds = load_dataset(
"webdataset",
data_files={"train": "data/nasar-train-*.tar"},
split="train",
streaming=True,
)
sample = next(iter(ds))
arrays = np.load(BytesIO(sample["npz"]))
print(arrays.files)
```
## Loading With PyTorch
The repository includes a lightweight PyTorch helper:
```python
from nasar_dataset import NASARRTCDataset, NASARInSARDataset
rtc_ds = NASARRTCDataset("/path/to/NA-SAR")
insar_ds = NASARInSARDataset("/path/to/NA-SAR")
```
For streaming at scale, use the WebDataset tar shards under `data/`.
Each tar member is a compressed `.npz` tensor file named `{sample_key}.npz`.
## Preprocessing Notes
RTC arrays are stored as raw linear backscatter with invalid, non-finite, and
negative values set to zero. The helper loader applies the pretraining-time RTC
transform by default:
```python
x = log1p(20.0 * x)
co_pol = clip_and_rescale(co_pol, p1=0.15, p99=2.39)
cross_pol = clip_and_rescale(cross_pol, p1=0.01, p99=1.09)
```
The co-pol and cross-pol RTC channels use separate normalization ranges because
cross-pol backscatter is substantially darker. Fully missing polarizations remain
zero-padded after preprocessing.
InSAR phase is stored as cosine and sine channels instead of wrapped phase
radians to avoid phase discontinuities at the wrap boundary.
## Source and Scope
The source data comes from OPERA SAR products over North America. Users should
follow the applicable terms and citation guidance for OPERA source products.
## Intended Use
This dataset is intended for SAR and InSAR representation learning, especially
self-supervised pretraining. It is not an evaluation benchmark by itself.
## Limitations
- Coverage is geographically focused on North America.
- Quality filtering removes lower-quality samples and can bias the corpus toward
easier or cleaner acquisitions.
- Missing RTC polarizations are represented by zero-padded channels. The
metadata includes polarization availability flags so users can distinguish
true zeros from missing channels.