examples

[1]:
# import dependencies
import xradarsat2
[2]:
# Specify the directory that contains the level 1 files
folder_path = "/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2020/234/RS2_OK123649_PK1086794_DK1033082_SCWA_20200821_133300_VV_VH_SGF"
[3]:
# Apply rs2_reader to load every datasets (as a datatree) from the level 1 directory and display it
dt = xradarsat2.rs2_reader(folder_path)
dt
[3]:
<xarray.DatasetView>
Dimensions:  ()
Data variables:
    *empty*
Attributes:
    product_path:           /home/datawork-cersat-public/cache/project/sarwin...
    satellite:              RADARSAT-2
    inputDatasetId:         /Fred/RSAT-2/525985P
    rawDataStartTime:       2020-08-21T13:33:00.289027
    satelliteHeight_units:  m
    satelliteHeight:        793996.3316241935
[4]:
# Example for extracting a dataset from the datatree
dt["radarParameters"].ds
[4]:
<xarray.DatasetView>
Dimensions:                         (beam: 4, pole: 2, NbOfNoiseLevelValues: 99)
Coordinates:
  * beam                            (beam) <U3 'W1' 'W2' 'W30' 'S7'
  * pole                            (pole) <U2 'VH' 'VV'
Dimensions without coordinates: NbOfNoiseLevelValues
Data variables:
    pulsesReceivedPerDwell          (beam) int64 58 58 58 58
    numberOfPulseIntervalsPerDwell  (beam) int64 65 66 65 67
    rank                            (beam) int64 7 8 7 9
    settableGain                    (beam, pole) float64 -1.0 -1.0 ... -1.0 -1.0
    pulseRepetitionFrequency        (beam) float64 1.283e+03 ... 1.295e+03
    samplesPerEchoLine              (beam) int64 6768 7920 7944 7320
    noiseLevelValues_BetaNought     (NbOfNoiseLevelValues) float64 -27.3 ... ...
    noiseLevelValues_SigmaNought    (NbOfNoiseLevelValues) float64 -28.5 ... ...
    noiseLevelValues_Gamma          (NbOfNoiseLevelValues) float64 -26.65 ......
Attributes: (12/20)
    acquisitionType:             ScanSAR Wide
    beams:                       ['W1', 'W2', 'W30', 'S7']
    polarizations:               ['VV', 'VH']
    pulses:                      11.58
    radarCenterFrequency_units:  Hz
    radarCenterFrequency:        5404999242.769673
    ...                          ...
    adcSamplingRate_units:       Hz
    adcSamplingRate:             12667968.75
    yawSteeringFlag:             YawSteeringOn
    geodeticFlag:                Off-Geocentric
    rawBitsPerSample:            4
    Description:                 Radar Parameters Data Store. Information des...
[5]:
#  Add digital numbers to the datatree and display it
dt = xradarsat2.load_digital_number(
    chunks={"line": 5000, "sample": 5000},
    dt=dt,
    resolution={"line": 50, "sample": 50},
)
dt
[5]:
<xarray.DatasetView>
Dimensions:  ()
Data variables:
    *empty*
Attributes:
    product_path:           /home/datawork-cersat-public/cache/project/sarwin...
    satellite:              RADARSAT-2
    inputDatasetId:         /Fred/RSAT-2/525985P
    rawDataStartTime:       2020-08-21T13:33:00.289027
    satelliteHeight_units:  m
    satelliteHeight:        793996.3316241935