Examples

Basic example

Open a SAFE file sentinel 1 at full resolution

import xsar
safe_file = 'S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_992F.SAFE'
ds = xsar.open_dataset(safe_file)

ds is an array of xarray.Dataset, with very little memory footprint:

   [<xarray.Dataset>
Dimensions:         (atrack: 16778, pol: 2, xtrack: 25187)
Coordinates:
  * pol             (pol) object 'VV' 'VH'
  * atrack          (atrack) int64 0 1 2 3 4 5 ... 16773 16774 16775 16776 16777
  * xtrack          (xtrack) int64 0 1 2 3 4 5 ... 25182 25183 25184 25185 25186
Data variables:
    digital_number  (pol, atrack, xtrack) uint16 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    time            (atrack) datetime64[ns] dask.array<chunksize=(4195,), meta=np.ndarray>
    longitude       (atrack, xtrack) float32 dask.array<chunksize=(4195, 4198), meta=np.ndarray>
    latitude        (atrack, xtrack) float32 dask.array<chunksize=(4195, 4198), meta=np.ndarray>
    incidence       (atrack, xtrack) float32 dask.array<chunksize=(4195, 4198), meta=np.ndarray>
    elevation       (atrack, xtrack) float32 dask.array<chunksize=(4195, 4198), meta=np.ndarray>
    sigma0_raw      (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    nesz            (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    gamma0_raw      (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    negz            (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    sigma0          (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
    gamma0          (pol, atrack, xtrack) float64 dask.array<chunksize=(2, 4195, 4198), meta=np.ndarray>
Attributes:
    footprint:       POLYGON ((-67.84221143971432 20.72564283093837, -70.2216...
    coverage:        251km * 170km (xtrack * atrack )
    pixel_xtrack_m:  10.0
    pixel_atrack_m:  10.2
    ipf_version:     2.84
    swath_type:      IW
    polarizations:   VV VH
    product_type:    GRD
    mission:         SENTINEL-1
    satellite:       A
    start_date:      2017-09-07 10:30:20.936409
    stop_date:       2017-09-07 10:30:45.935264
    path:            /home/alevieux/Documents/Data/S1A_IW_GRDH_1SDV_20170907T...
    denoised:        {'VH': False, 'VV': False}
    subdataset:      IW
    geometry:        {'VH': {'atrack':   atracks xtracks                     ...
    Conventions:     CF-1.7]

Resolution Example

Open a SAFE file sentinel 1 at 200m resoltion. With the parameter reolution you can open the Safe file in other resolution in terms of pixel_xtrack_m and pixel_atrack_m

import xsar
safe_file = '/home/datawork-cersat-public/project/mpc-sentinel1/data/esa/sentinel-1a/L1/IW/S1A_IW_GRDH_1S/2017/250/S1A_IW_GRDH_1SDV_20170907T103020_20170907T103045_018268_01EB76_992F.SAFE'
ds = xsar.open_dataset(safe_file,resolution={'xtrack':20, 'atrack':20})

ds at 200m

   [<xarray.Dataset>
Dimensions:         (atrack: 900, pol: 2, xtrack: 1500)
Coordinates:
  * pol             (pol) object 'VV' 'VH'
  * atrack          (atrack) int64 10 30 50 70 90 ... 17930 17950 17970 17990
  * xtrack          (xtrack) int64 10 30 50 70 90 ... 29930 29950 29970 29990
Data variables:
    digital_number  (pol, atrack, xtrack) uint16 dask.array<chunksize=(2, 900, 1500), meta=np.ndarray>
    time            (atrack) datetime64[ns] 2017-09-07T10:30:20.936409 ... 20...
    longitude       (atrack, xtrack) float32 dask.array<chunksize=(900, 1500), meta=np.ndarray>
    latitude        (atrack, xtrack) float32 dask.array<chunksize=(900, 1500), meta=np.ndarray>
    incidence       (atrack, xtrack) float32 dask.array<chunksize=(900, 1500), meta=np.ndarray>
    elevation       (atrack, xtrack) float32 dask.array<chunksize=(900, 1500), meta=np.ndarray>
    sigma0_raw      (pol, atrack, xtrack) float64 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
    nesz            (pol, atrack, xtrack) float32 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
    gamma0_raw      (pol, atrack, xtrack) float64 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
    negz            (pol, atrack, xtrack) float32 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
    sigma0          (pol, atrack, xtrack) float64 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
    gamma0          (pol, atrack, xtrack) float64 dask.array<chunksize=(1, 900, 1500), meta=np.ndarray>
Attributes:
    footprint:       POLYGON ((-67.84221143971432 20.72564283093837, -70.2216...
    coverage:        251km * 170km (xtrack * atrack )
    pixel_xtrack_m:  10.0
    pixel_atrack_m:  10.2
    ipf_version:     2.84
    swath_type:      IW
    polarizations:   VV VH
    product_type:    GRD
    mission:         SENTINEL-1
    satellite:       A
    start_date:      2017-09-07 10:30:20.936409
    stop_date:       2017-09-07 10:30:45.935264
    path:            /home/datawork-cersat-public/project/mpc-sentinel1/data/...
    denoised:        {'VH': False, 'VV': False}
    subdataset:      IW
    geometry:        {'VH': {'atrack':   atracks xtracks                     ...
    Conventions:     CF-1.7]