#!/usr/bin/env python3
"""Experiment X1: how deep can Sentinel-1's radar see into dry sand?

    python3 pipeline/experiments/radar-depth.py

Uses only figures Lost Under the Sand already cites:
  - McCauley and colleagues (Science, 1982): Shuttle Imaging Radar SIR-A, wavelength 24 cm, calculated
    skin depth about 5 m in dry Selima Sand Sheet sand.
  - Schaber and colleagues: maximum imaging depth 1.5 m for the sediment blanket, a quarter of that 5 m.
  - Ghoneim and colleagues (2024): Sentinel-1 C-band radar at 5.405 GHz.
Physics: for a low-loss material the skin depth is about wavelength x sqrt(e') / (2 pi e''), so in the
same sand (same e' and e'') it scales in proportion to the wavelength. That is the one assumption, and it
is stated beside the result. Wavelength = c / f.
Writes experiments/radar-depth.json.
"""
import json, os
C = 299_792_458.0
sir_a_wavelength_m = 0.24
sir_a_calc_depth_m, sir_a_field_depth_m = 5.0, 1.5
s1_freq_hz = 5.405e9
s1_wavelength_m = C / s1_freq_hz
ratio = s1_wavelength_m / sir_a_wavelength_m
res = dict(
    inputs=dict(sir_a_wavelength_m=sir_a_wavelength_m, sir_a_calculated_skin_depth_m=sir_a_calc_depth_m,
                sir_a_imaging_depth_m_schaber=sir_a_field_depth_m, sentinel1_frequency_ghz=5.405),
    sentinel1_wavelength_cm=round(s1_wavelength_m * 100, 2),
    wavelength_ratio=round(ratio, 3),
    sentinel1_calculated_skin_depth_m=round(sir_a_calc_depth_m * ratio, 2),
    sentinel1_imaging_depth_scaled_m=round(sir_a_field_depth_m * ratio, 2),
    assumption='skin depth in the same dry sand scales in proportion to wavelength (low-loss approximation)',
    sources='McCauley et al., Science, 1982 (SIR-A, Selima Sand Sheet); Schaber et al. (imaging depth 1.5 m); Ghoneim et al., Communications Earth & Environment 5, 233, 2024 (Sentinel-1 at 5.405 GHz)')
json.dump(res, open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'radar-depth.json'), 'w'), indent=1)
print(json.dumps(res, indent=1))
