Download this notebook from github.


SAR Sentinel-1 cross spectrum computation from large image Interferometric Wide-swath SLC

[1]:
import os
import xsarslc.get_test_files
import logging
import xsar
from importlib import reload
reload(logging)
logging.basicConfig(level=logging.INFO)
logging.info('start notebook')
import xsarslc.processing.xspectra as proc
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
warnings.filterwarnings("ignore")
INFO:root:start notebook

get datatree with digital numbers and annotations from IW SLC product

[2]:

import xsarslc import xsar import os #one_tiff = '/home/datawork-cersat-public/cache/project/mpc-sentinel1/data/esa/sentinel-1a/L1/IW/S1A_IW_SLC__1S/2022/127/S1A_IW_SLC__1SDV_20220507T162411_20220507T162439_043107_0525DE_734D.SAFE/measurement/s1a-iw1-slc-vv-20220507t162411-20220507t162439-043107-0525de-004.tiff' #tmp = xsar.get_test_file('S1A_IW_SLC__1SDV_20170907T103019_20170907T103047_018268_01EB76_5F55.SAFE') fullpathsafeSLC = xsar.get_test_file('S1A_IW_SLC__1SDV_20181008T134439_20181008T134506_024045_02A0A6_65C8.SAFE') # only one subswath IW1 zipped #fullpathsafeSLC = os.path.dirname(os.path.dirname(one_tiff)) #imagette_number = os.path.basename(one_tiff).split('-')[1].replace('iw','') imagette_number = 1 str_gdal = 'SENTINEL1_DS:%s:IW%s'%(fullpathsafeSLC,imagette_number) print('str_gdal',str_gdal) xsarobj = xsar.Sentinel1Dataset(str_gdal) #,resolution='30m' dt = xsarobj.datatree dt.load() dt
str_gdal SENTINEL1_DS:/home1/scratch/agrouaze/xsardatasync/xsardata/S1A_IW_SLC__1SDV_20181008T134439_20181008T134506_024045_02A0A6_65C8.SAFE:IW1
[2]:
<xarray.DatasetView> Size: 0B
Dimensions:  ()
Data variables:
    *empty*
Attributes: (12/15)
    name:              SENTINEL1_DS:/home1/scratch/agrouaze/xsardatasync/xsar...
    short_name:        SENTINEL1_DS:S1A_IW_SLC__1SDV_20181008T134439_20181008...
    product:           SLC
    safe:              S1A_IW_SLC__1SDV_20181008T134439_20181008T134506_02404...
    swath:             IW
    multidataset:      False
    ...                ...
    start_date:        2018-10-08 13:44:40.984312
    stop_date:         2018-10-08 13:45:06.117599
    footprint:         POLYGON ((-114.6305305568416 32.60521729566573, -115.5...
    coverage:          171km * 88km (line * sample )
    orbit_pass:        Descending
    platform_heading:  -167.2011573025802

cross spectrum in inter bursts parts of the IW product

[3]:
inter_xs = proc.compute_IW_subswath_interburst_xspectra(dt,
                                        tile_width={'sample': 20.e3, 'line': 20.e3},
                                        tile_overlap={'sample': 0, 'line': 0},
                                        periodo_width = {'sample': 2000, 'line': 1200},
                                        periodo_overlap = {'sample': 1000, 'line': 600},
                                        dev=True,polarization='VV')
inter_xs
INFO:root:reduce number of burst -> 1
interbursts: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00,  6.50s/it]
[3]:
<xarray.Dataset> Size: 2MB
Dimensions:                   (tile_sample: 4, tile_line: 1, bt_thresh: 5,
                               freq_line: 86, freq_sample: 226, c_sample: 2,
                               c_line: 2, k_gp: 4, phi_hf: 5,
                               lambda_range_max_macs: 11)
Coordinates:
    pol                       <U2 8B 'VV'
  * bt_thresh                 (bt_thresh) int64 40B 5 50 100 150 200
    k_rg                      (tile_sample, freq_sample) float64 7kB 0.0 ... ...
    k_az                      (freq_line) float64 688B -0.2248 ... 0.2196
    line                      (tile_line) int64 8B 1418
    sample                    (tile_line, tile_sample) int64 32B 3204 ... 17483
    longitude                 (tile_line, tile_sample) float64 32B -114.8 ......
    latitude                  (tile_line, tile_sample) float64 32B 32.45 ... ...
  * k_gp                      (k_gp) int64 32B 1 2 3 4
  * phi_hf                    (phi_hf) int64 40B 1 2 3 4 5
  * lambda_range_max_macs     (lambda_range_max_macs) float64 88B 25.0 ... 275.0
Dimensions without coordinates: tile_sample, tile_line, freq_line, freq_sample,
                                c_sample, c_line
Data variables: (12/26)
    incidence                 (tile_line, tile_sample) float64 32B 31.65 ... ...
    ground_heading            (tile_line, tile_sample) float64 32B -169.1 ......
    sensing_time              (tile_line, tile_sample) datetime64[ns] 32B 201...
    tile_width_sample         (tile_line, tile_sample) int64 32B 20004 ... 20007
    tile_width_line           (tile_line, tile_sample) int64 32B 1649 ... 1649
    sigma0                    (tile_line, tile_sample) float64 32B 0.1547 ......
    ...                        ...
    overlap_corner_longitude  (tile_line, c_sample, c_line) float64 32B -114....
    overlap_corner_latitude   (tile_line, c_sample, c_line) float64 32B 32.44...
    cwave_params              (tile_line, tile_sample, k_gp, phi_hf) float64 640B ...
    macs                      (tile_line, tile_sample, lambda_range_max_macs) complex128 704B ...
    azimuth_cutoff            (tile_line, tile_sample) float64 32B 177.8 ... ...
    azimuth_cutoff_error      (tile_line, tile_sample) float64 32B 0.07511 .....
Attributes: (12/22)
    name:                          SENTINEL1_DS:/home1/scratch/agrouaze/xsard...
    short_name:                    SENTINEL1_DS:S1A_IW_SLC__1SDV_20181008T134...
    product:                       SLC
    safe:                          S1A_IW_SLC__1SDV_20181008T134439_20181008T...
    swath:                         IW
    multidataset:                  False
    ...                            ...
    mean_incidence:                33.82803016331659
    azimuth_time_interval:         0.002055556299999998
    required_tile_width_sample:    20000.0
    required_tile_width_line:      20000.0
    required_tile_overlap_sample:  0
    required_tile_overlap_line:    0
[4]:
xsarobj = xsar.Sentinel1Dataset(str_gdal)
dt = xsarobj.datatree
dt.load()

[4]:
<xarray.DatasetView> Size: 0B
Dimensions:  ()
Data variables:
    *empty*
Attributes: (12/15)
    name:              SENTINEL1_DS:/home1/scratch/agrouaze/xsardatasync/xsar...
    short_name:        SENTINEL1_DS:S1A_IW_SLC__1SDV_20181008T134439_20181008...
    product:           SLC
    safe:              S1A_IW_SLC__1SDV_20181008T134439_20181008T134506_02404...
    swath:             IW
    multidataset:      False
    ...                ...
    start_date:        2018-10-08 13:44:40.984312
    stop_date:         2018-10-08 13:45:06.117599
    footprint:         POLYGON ((-114.6305305568416 32.60521729566573, -115.5...
    coverage:          171km * 88km (line * sample )
    orbit_pass:        Descending
    platform_heading:  -167.2011573025802

cross spectrum in intra bursts parts of the IW product

[5]:
intra_xs = proc.compute_IW_subswath_intraburst_xspectra(dt,
                                         tile_width={'sample': 20.e3, 'line': 20.e3},
                                        tile_overlap={'sample': 0, 'line': 0},
                                        periodo_width = {'sample': 4000, 'line': 4000},
                                        periodo_overlap = {'sample': 2000, 'line': 2000},
                                        polarization='VV',dev=True)
intra_xs

INFO:root:reduce number of burst -> 1
intrabursts:   0%|                                                                                                                                                                       | 0/1 [00:00<?, ?it/s]INFO:root:nbtiles : 4
intrabursts: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:08<00:00, 68.86s/it]
[5]:
<xarray.Dataset> Size: 15MB
Dimensions:                   (tile_sample: 4, tile_line: 1, bt_thresh: 5,
                               0tau: 3, freq_line: 57, freq_sample: 451,
                               1tau: 2, 2tau: 1, c_sample: 2, c_line: 2,
                               k_gp: 4, phi_hf: 5, lambda_range_max_macs: 11)
Coordinates:
    pol                       <U2 8B 'VV'
  * bt_thresh                 (bt_thresh) int64 40B 5 50 100 150 200
    k_rg                      (tile_sample, freq_sample) float64 14kB 0.0 ......
    k_az                      (freq_line) float64 456B -0.04417 ... 0.04417
    line                      (tile_line) int64 8B 747
    sample                    (tile_line, tile_sample) int64 32B 3205 ... 17483
    longitude                 (tile_line, tile_sample) float64 32B -114.8 ......
    latitude                  (tile_line, tile_sample) float64 32B 32.54 ... ...
  * k_gp                      (k_gp) int64 32B 1 2 3 4
  * phi_hf                    (phi_hf) int64 40B 1 2 3 4 5
  * lambda_range_max_macs     (lambda_range_max_macs) float64 88B 25.0 ... 275.0
Dimensions without coordinates: tile_sample, tile_line, 0tau, freq_line,
                                freq_sample, 1tau, 2tau, c_sample, c_line
Data variables: (12/30)
    incidence                 (tile_line, tile_sample) float64 32B 31.65 ... ...
    ground_heading            (tile_line, tile_sample) float64 32B -169.1 ......
    sensing_time              (tile_line, tile_sample) datetime64[ns] 32B 201...
    tile_width_sample         (tile_line, tile_sample) int64 32B 20005 ... 20004
    tile_width_line           (tile_line, tile_sample) int64 32B 19998 ... 19998
    sigma0                    (tile_line, tile_sample) float64 32B 0.1125 ......
    ...                        ...
    burst_corner_longitude    (tile_line, c_sample, c_line) float64 32B -114....
    burst_corner_latitude     (tile_line, c_sample, c_line) float64 32B 32.61...
    cwave_params              (tile_line, tile_sample, k_gp, phi_hf) float64 640B ...
    macs                      (tile_line, tile_sample, lambda_range_max_macs) complex128 704B ...
    azimuth_cutoff            (tile_line, tile_sample) float64 32B 730.4 ... ...
    azimuth_cutoff_error      (tile_line, tile_sample) float64 32B 0.09116 .....
Attributes: (12/24)
    name:                          SENTINEL1_DS:/home1/scratch/agrouaze/xsard...
    short_name:                    SENTINEL1_DS:S1A_IW_SLC__1SDV_20181008T134...
    product:                       SLC
    safe:                          S1A_IW_SLC__1SDV_20181008T134439_20181008T...
    swath:                         IW
    multidataset:                  False
    ...                            ...
    radar_frequency:               5405000454.33435
    azimuth_time_interval:         0.002055556299999998
    required_tile_width_sample:    20000.0
    required_tile_width_line:      20000.0
    required_tile_overlap_sample:  0
    required_tile_overlap_line:    0