Basic usage

Notebook setup

[1]:
%matplotlib inline
%load_ext autoreload
%autoreload 2
[2]:
import sys
sys.path.append('../..')
[3]:
import numpy as np
import matplotlib.pyplot as plt
[4]:
import s1etad
from s1etad import Sentinel1Etad, ECorrectionType

Sentinel1Etad product

[5]:
filename = '../../sample-products/S1B_IW_ETA__AXDV_20190805T162509_20190805T162536_017453_020D3A_____.SAFE'
[6]:
eta = Sentinel1Etad(filename)
[7]:
eta
[7]:
Sentinel1Etad("../../sample-products/S1B_IW_ETA__AXDV_20190805T162509_20190805T162536_017453_020D3A_____.SAFE")  # 0x7ffcab673950
Sentinel-1 products list:
  S1B_IW_SLC__1ADV_20190805T162509_20190805T162536_017453_020D3A_A857.SAFE
Number of swaths: 3
Swath list: IW1, IW2, IW3
Grid sampling:
  x: 8.081406101630269e-07
  y: 0.028777788199999974
  unit: s
Grid spacing:
  x: 200.0
  y: 200.0
  unit: m
Processing settings:
  troposphericDelayCorrection: True
  ionosphericDelayCorrection: True
  solidEarthTideCorrection: True
  bistaticAzimuthCorrection: True
  dopplerShiftRangeCorrection: True
  FMMismatchAzimuthCorrection: True

Check which corrections have been enabled

[8]:
eta.processing_setting()
[8]:
{'troposphericDelayCorrection': True,
 'ionosphericDelayCorrection': True,
 'solidEarthTideCorrection': True,
 'bistaticAzimuthCorrection': True,
 'dopplerShiftRangeCorrection': True,
 'FMMismatchAzimuthCorrection': True}

The burst catalogue

It is a pandas dataframe to allow easy filtering.

See also use cases in the “Use case 1: Selecting the bursts” section for a more complete explaination on the burst catalogue and the query mechanism.

[9]:
eta.burst_catalogue.head()
[9]:
bIndex pIndex sIndex productID swathID azimuthTimeMin azimuthTimeMax
0 1 1 1 S1B_IW_SLC__1ADV_20190805T162509_20190805T1625... IW1 2019-08-05 16:25:09.836779 2019-08-05 16:25:13.002336
1 4 1 1 S1B_IW_SLC__1ADV_20190805T162509_20190805T1625... IW1 2019-08-05 16:25:12.570669 2019-08-05 16:25:15.736226
2 7 1 1 S1B_IW_SLC__1ADV_20190805T162509_20190805T1625... IW1 2019-08-05 16:25:15.333337 2019-08-05 16:25:18.498893
3 10 1 1 S1B_IW_SLC__1ADV_20190805T162509_20190805T1625... IW1 2019-08-05 16:25:18.096004 2019-08-05 16:25:21.261561
4 13 1 1 S1B_IW_SLC__1ADV_20190805T162509_20190805T1625... IW1 2019-08-05 16:25:20.858672 2019-08-05 16:25:24.024229

Tip: the total number of bursts in a product can be retrieved as follows:

[10]:
print('Total number of bursts:', len(eta.burst_catalogue))
Total number of bursts: 27

Swath objects

How many swaths are stored in a product?

[11]:
print('Number of swaths:', eta.number_of_swath)
print('Swath list:', eta.swath_list)
Number of swaths: 3
Swath list: ['IW1', 'IW2', 'IW3']

How to retieve a Sentinel1EtadSwath object

[12]:
swath = eta['IW2']
[13]:
swath
[13]:
Sentinel1EtadSwath("/IW2")  0x7ffcab79c090
Swaths ID: IW2
Number of bursts: 9
Burst list: [2, 5, 8, 11, 14, 17, 20, 23, 26]
Sampling start:
  x: 0.0003095178536924219
  y: 0.9208892223996372
  units: s
Sampling:
  x: 8.081406101630269e-07
  y: 0.028777788199999974
  units: s

Burst objects

[14]:
burst = swath[2]
[15]:
burst
[15]:
Sentinel1EtadBurst("/IW2/Burst0002")  0x7ffcab79cd50
Swaths ID: IW2
Burst index: 2
Shape: (112, 523)
Sampling start:
  x: 0.0003095178536924219
  y: 0.9208892223996372
  units: s
Sampling:
  x: 8.081406101630269e-07
  y: 0.028777788199999974
  units: s

NOTE: one can only get bursts whose index is present in the “burst list” of the swath

[16]:
swath.burst_list
[16]:
[2, 5, 8, 11, 14, 17, 20, 23, 26]
[17]:
try:
    swath[1]
except IndexError as exc:
    print('ERROR: Ops someting went wrong:', repr(exc))
ERROR: Ops someting went wrong: IndexError('Burst0001 not found in /IW2')

String representation

Please note that the string representation of Sentinel1Etad object is a “one-line” string providing only basic information:

[18]:
print('Product:', str(eta))
print('Swath:', str(swath))
print('Burst:', str(burst))
Product: Sentinel1Etad("S1B_IW_ETA__AXDV_20190805T162509_20190805T162536_017453_020D3A_____.SAFE")
Swath: Sentinel1EtadSwath("/IW2")  0x7ffcab79c090
Burst: Sentinel1EtadBurst("/IW2/Burst0002")  0x7ffcab79cd50

Anyway in Jupyer environments a richer representation is also available:

[19]:
eta
[19]:
Sentinel1Etad("../../sample-products/S1B_IW_ETA__AXDV_20190805T162509_20190805T162536_017453_020D3A_____.SAFE")  # 0x7ffcab673950
Sentinel-1 products list:
  S1B_IW_SLC__1ADV_20190805T162509_20190805T162536_017453_020D3A_A857.SAFE
Number of swaths: 3
Swath list: IW1, IW2, IW3
Grid sampling:
  x: 8.081406101630269e-07
  y: 0.028777788199999974
  unit: s
Grid spacing:
  x: 200.0
  y: 200.0
  unit: m
Processing settings:
  troposphericDelayCorrection: True
  ionosphericDelayCorrection: True
  solidEarthTideCorrection: True
  bistaticAzimuthCorrection: True
  dopplerShiftRangeCorrection: True
  FMMismatchAzimuthCorrection: True

Iteration

It is possible to iterate over products and swats in the same way one does it with any ather python container.

[20]:
for swath in eta:
    print(swath)
    for burst in swath:
        print(burst.burst_index, burst.swath_id, burst)
    print()
Sentinel1EtadSwath("/IW1")  0x7ffcab7add10
1 IW1 Sentinel1EtadBurst("/IW1/Burst0001")  0x7ffcab7aded0
4 IW1 Sentinel1EtadBurst("/IW1/Burst0004")  0x7ffcab7b2390
7 IW1 Sentinel1EtadBurst("/IW1/Burst0007")  0x7ffcab7b2790
10 IW1 Sentinel1EtadBurst("/IW1/Burst0010")  0x7ffcab7b2b90
13 IW1 Sentinel1EtadBurst("/IW1/Burst0013")  0x7ffcab7a74d0
16 IW1 Sentinel1EtadBurst("/IW1/Burst0016")  0x7ffcab7a4190
19 IW1 Sentinel1EtadBurst("/IW1/Burst0019")  0x7ffcab7a47d0
22 IW1 Sentinel1EtadBurst("/IW1/Burst0022")  0x7ffcab7a3d10
25 IW1 Sentinel1EtadBurst("/IW1/Burst0025")  0x7ffcab7a4ed0

Sentinel1EtadSwath("/IW2")  0x7ffcab79c090
2 IW2 Sentinel1EtadBurst("/IW2/Burst0002")  0x7ffcab79cd50
5 IW2 Sentinel1EtadBurst("/IW2/Burst0005")  0x7ffcab7a4fd0
8 IW2 Sentinel1EtadBurst("/IW2/Burst0008")  0x7ffcab7a3f50
11 IW2 Sentinel1EtadBurst("/IW2/Burst0011")  0x7ffcab7a3410
14 IW2 Sentinel1EtadBurst("/IW2/Burst0014")  0x7ffcab7a4090
17 IW2 Sentinel1EtadBurst("/IW2/Burst0017")  0x7ffcab7a7f50
20 IW2 Sentinel1EtadBurst("/IW2/Burst0020")  0x7ffcab7a30d0
23 IW2 Sentinel1EtadBurst("/IW2/Burst0023")  0x7ffcab7a34d0
26 IW2 Sentinel1EtadBurst("/IW2/Burst0026")  0x7ffcab7a3050

Sentinel1EtadSwath("/IW3")  0x7ffcab79cc50
3 IW3 Sentinel1EtadBurst("/IW3/Burst0003")  0x7ffcab7a3350
6 IW3 Sentinel1EtadBurst("/IW3/Burst0006")  0x7ffcab7a4b90
9 IW3 Sentinel1EtadBurst("/IW3/Burst0009")  0x7ffcab79c910
12 IW3 Sentinel1EtadBurst("/IW3/Burst0012")  0x7ffcab79cdd0
15 IW3 Sentinel1EtadBurst("/IW3/Burst0015")  0x7ffcab79cb50
18 IW3 Sentinel1EtadBurst("/IW3/Burst0018")  0x7ffcab79c650
21 IW3 Sentinel1EtadBurst("/IW3/Burst0021")  0x7ffcab79c810
24 IW3 Sentinel1EtadBurst("/IW3/Burst0024")  0x7ffcab79c510
27 IW3 Sentinel1EtadBurst("/IW3/Burst0027")  0x7ffcab79c310

How to iterate only on selected items

It is also possible to iterate on a sub-set of the products swaths (or a sub-set of the swath bursts):

[21]:
for swath in eta.iter_swaths(['IW1', 'IW2']):  # no 'IW3'
    # list of bursts
    odd_bursts = [idx for idx in swath.burst_list if idx % 2 != 0]
    for burst in swath.iter_bursts(odd_bursts):
        print(f'{burst.burst_index:2} {burst.swath_id} {burst}')
 1 IW1 Sentinel1EtadBurst("/IW1/Burst0001")  0x7ffcab7aded0
 7 IW1 Sentinel1EtadBurst("/IW1/Burst0007")  0x7ffcab7b2790
13 IW1 Sentinel1EtadBurst("/IW1/Burst0013")  0x7ffcab7a74d0
19 IW1 Sentinel1EtadBurst("/IW1/Burst0019")  0x7ffcab7a47d0
25 IW1 Sentinel1EtadBurst("/IW1/Burst0025")  0x7ffcab7a4ed0
 5 IW2 Sentinel1EtadBurst("/IW2/Burst0005")  0x7ffcab7a4fd0
11 IW2 Sentinel1EtadBurst("/IW2/Burst0011")  0x7ffcab7a3410
17 IW2 Sentinel1EtadBurst("/IW2/Burst0017")  0x7ffcab7a7f50
23 IW2 Sentinel1EtadBurst("/IW2/Burst0023")  0x7ffcab7a34d0

How to iterate on query results

The query mechanism is explained extensively in the following.

Queries can be performed using the Sentinel1Etad.query_burst method.

A simple example is a query for a specific swath:

[22]:
query_result = eta.query_burst(swath='IW3')

for swath in eta.iter_swaths(query_result):
    for burst in swath.iter_bursts(query_result):
        print(burst)
Sentinel1EtadBurst("/IW3/Burst0003")  0x7ffcab7a3350
Sentinel1EtadBurst("/IW3/Burst0006")  0x7ffcab7a4b90
Sentinel1EtadBurst("/IW3/Burst0009")  0x7ffcab79c910
Sentinel1EtadBurst("/IW3/Burst0012")  0x7ffcab79cdd0
Sentinel1EtadBurst("/IW3/Burst0015")  0x7ffcab79cb50
Sentinel1EtadBurst("/IW3/Burst0018")  0x7ffcab79c650
Sentinel1EtadBurst("/IW3/Burst0021")  0x7ffcab79c810
Sentinel1EtadBurst("/IW3/Burst0024")  0x7ffcab79c510
Sentinel1EtadBurst("/IW3/Burst0027")  0x7ffcab79c310