API reference

processing

xsarslc.processing.xspectra.compute_subswath_xspectra(dt, polarization, tile_width_intra, tile_width_inter, tile_overlap_intra, tile_overlap_inter, periodo_width_intra, periodo_width_inter, periodo_overlap_intra, periodo_overlap_inter, **kwargs)

Main function to compute IW inter and intra burst spectra. It has to be modified to be able to change Xspectra options

Parameters:
  • dt (xarray.Datatree) – datatree contraining subswath information

  • tile_width_intra (dict, optional) – approximate sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)} for intra burst.

  • tile_width_inter (dict, optional) – approximate sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)} for inter burst.

  • tile_overlap_intra (dict, optional) – approximate sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} for intra burst.

  • tile_overlap_inter (dict, optional) – approximate sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} for inter burst.

  • periodo_width_intra (dict) – approximate sizes of periodogram in meters. Dict of shape {dim_name (str): width of tile [m](float)} for intra burst.

  • periodo_width_inter (dict) – approximate sizes of periodogram in meters. Dict of shape {dim_name (str): width of tile [m](float)} for inter burst.

  • periodo_overlap_intra (dict) – approximate sizes of periodogram overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} for intra burst.

  • periodo_overlap_inter (dict) – approximate sizes of periodogram overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} for inter burst.

  • polarization (str, optional) – polarization to be selected for xspectra computation

Keyword Arguments:

kwargs (dict) – keyword arguments passed to called functions. landmask, IR_path …

xsarslc.processing.xspectra.compute_IW_subswath_intraburst_xspectra(dt, polarization, periodo_width={'line': 2000, 'sample': 2000}, periodo_overlap={'line': 1000, 'sample': 1000}, tile_width={'line': 20000.0, 'sample': 20000.0}, tile_overlap={'line': 10000.0, 'sample': 10000.0}, landmask=None, IR_path=None, **kwargs)

Compute IW subswath intra-burst xspectra per tile Note: If requested tile is larger than the size of availabe data. tile will be set to maximum available size

Parameters:
  • dt (xarray.Datatree) – datatree contraining subswath information

  • polarization (str, optional) – polarization to be selected for xspectra computation

  • tile_width (dict) – approximative sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • tile_overlap (dict) – approximative sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • polarization – polarization to be selected for xspectra computation

  • periodo_width (dict) – approximate sizes of periodogram in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • periodo_overlap (dict) – approximate sizes of periodogram overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • landmask (cartopy, optional) – a landmask to be used for land discrimination

  • IR_path (str, optional) – a path to the Impulse Response file

Keyword Arguments:

kwargs (dict) – optional keyword arguments : burst_list (list), dev (bool) are valid entries

Returns:

xspectra.

Return type:

(xarray)

xsarslc.processing.xspectra.compute_IW_subswath_interburst_xspectra(dt, polarization, periodo_width={'line': 1200, 'sample': 2000}, periodo_overlap={'line': 600, 'sample': 1000}, tile_width={'line': 1500.0, 'sample': 20000.0}, tile_overlap={'line': 750.0, 'sample': 10000.0}, landmask=None, IR_path=None, **kwargs)

Compute IW subswath inter-burst xspectra. No deramping is applied since only magnitude is used.

Note: If requested tile is larger than the size of availabe data. tile will be set to maximum available size Note: The overlap is short in azimuth (line) direction. Keeping nperseg = {‘line’:None} in Xspectra computation keeps maximum number of point in azimuth but is not ensuring the same number of overlapping point for all burst

Parameters:
  • dt (xarray.Datatree) – datatree containing sub-swath information

  • polarization (str, optional) – polarization to be selected for xspectra computation

  • tile_width (dict) – approximate sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • tile_overlap (dict) – approximate sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • polarization – polarization to be selected for xspectra computation

  • periodo_width (dict) – approximate sizes of periodogram in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • periodo_overlap (dict) – approximate sizes of periodogram overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • landmask (cartopy, optional) – a landmask to be used for land discrimination

  • IR_path (str, optional) – a path to the Impulse Response file

Keyword Arguments:

kwargs (dict) – optional keyword arguments : burst_list (list), dev (bool) are valid entries

Returns:

xspectra.

Return type:

(xarray)

xsarslc.processing.xspectra.compute_modulation(ds, lowpass_width, spacing)

Compute modulation map (sig0/low_pass_filtered_sig0)

Parameters:
  • ds (xarray) – array of (deramped) digital number

  • lowpass_width (dict) – form {name of dimension (str): width in [m] (float)}. width for low pass filtering [m]

  • spacing (dict) – form {name of dimension (str): spacing in [m] (float)}. spacing for each filtered dimension

xsarslc.processing.xspectra.compute_azimuth_cutoff(spectrum, definition='drfab')

compute azimuth cutoff :param spectrum: Xspectrum with coordinates k_rg and k_az :type spectrum: xarray :param definition: ipf (covariance is averaged over range) or drfab (covariance taken at range = 0) :type definition: str, optional

Returns:

azimuth cutoff [m]

Return type:

(float)

xsarslc.processing.intraburst.tile_burst_to_xspectra(burst, geolocation_annotation, orbit, calibration, noise_range, noise_azimuth, tile_width, tile_overlap, lowpass_width={'line': 4750.0, 'sample': 4750.0}, periodo_width={'line': 4000.0, 'sample': 4000.0}, periodo_overlap={'line': 2000.0, 'sample': 2000.0}, landmask=None, IR_path=None, **kwargs)

Divide burst in tiles and compute intra-burst cross-spectra using compute_intraburst_xspectrum() function.

Parameters:
  • burst (xarray.Dataset) – dataset with deramped digital number variable

  • geolocation_annotation (xarray.Dataset) – dataset of geolocation annotation

  • orbit (xarray.Dataset) – dataset of orbit annotation

  • tile_width (dict) – approximative sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • tile_overlap (dict) – approximative sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • periodo_width (dict) – approximative sizes of periodogram in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • periodo_overlap (dict) – approximative sizes of periodogram overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • lowpass_width (dict) – width for low pass filtering [m]. Dict of form {dim_name (str): width (float)}

  • landmask (optional) – If provided, land mask passed to is_ocean(). Otherwise xspectra are calculated by default

  • IR_path (str, optional) – a path to the Impulse Response file

Keyword Arguments:
  • landmask (optional) – If provided, land mask passed to is_ocean(). Otherwise xspectra are calculated by default

  • kwargs – keyword arguments passed to compute_intraburst_xspectrum()

xsarslc.processing.intraburst.compute_intraburst_xspectrum(slc, mean_incidence, slant_spacing, azimuth_spacing, synthetic_duration, azimuth_dim='line', nperseg={'line': 512, 'sample': 512}, noverlap={'line': 256, 'sample': 256}, IR_path=None, **kwargs)

Compute SAR cross spectrum using a 2D Welch method. Looks are centered on the mean Doppler frequency If ds contains only one cycle, spectrum wavenumbers are added as coordinates in returned DataSet, otherwise, they are passed as variables (k_range, k_azimuth).

Parameters:
  • slc (xarray) – digital numbers of Single Look Complex image.

  • mean_incidence (float) – mean incidence on slc

  • slant_spacing (float) – slant spacing

  • azimuth_spacing (float) – azimuth spacing

  • synthetic_duration (float) – synthetic aperture duration (to compute tau)

  • azimuth_dim (str) – name of azimuth dimension

  • nperseg (dict of int) – number of point per periodogram. Dict of form {dimension_name(str): number of point (int)}

  • noverlap (dict of int) – number of overlapping point per periodogram. Dict of form {dimension_name(str): number of point (int)}

Keyword Arguments:

kwargs (dict) – keyword arguments passed to compute_looks()

Returns:

SLC cross_spectra

Return type:

(xarray)

xsarslc.processing.intraburst.compute_looks(slc, azimuth_dim, synthetic_duration, nlooks=3, look_width=0.2, look_overlap=0.0, look_window=None, **kwargs)

Compute the N looks of an slc DataArray. Spatial coverage of the provided slc must be small enough to enure an almost constant ground spacing. Meaning: ground_spacing ~= slant_spacing / sin(mean_incidence)

Parameters:
  • slc (xarray.DataArray) – (bi-dimensional) array to process

  • azimuth_dim (str) – name of the azimuth dimension (dimension used to extract the look)

  • nlooks (int) – number of look

  • look_width (float) – in [0,1.] width of a look [percentage of full bandwidth] (nlooks*look_width must be < 1)

  • look_overlap (float) – in [0,1.] look overlapping [percentage of a look]

  • look_window (str or tuple) – instance that can be passed to scipy.signal.get_window()

Returns:

keys are ‘0tau’, ‘1tau’, … and values are list of corresponding computed spectra

Return type:

(dict)

xsarslc.processing.interburst.tile_bursts_overlap_to_xspectra(burst0, burst1, geolocation_annotation, calibration, noise_range, noise_azimuth, tile_width, tile_overlap, lowpass_width={'line': 4750.0, 'sample': 4750.0}, periodo_width={'line': 1200.0, 'sample': 2000.0}, periodo_overlap={'line': 600.0, 'sample': 1000.0}, landmask=None, IR_path=None, **kwargs)

Divide bursts overlaps in tiles and compute inter-burst cross-spectra using compute_interburst_xspectrum() function.

Parameters:
  • burst0 (xarray.Dataset) – first burst (in time) dataset (No need of deramped digital number variable)

  • burst1 (xarray.Dataset) – second burst (in time) dataset (No need of deramped digital number variable)

  • geolocation_annotation (xarray.Dataset) – dataset of geolocation annotation

  • tile_width (dict) – approximative sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)}

  • tile_overlap (dict) – approximative sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)}

  • lowpass_width (dict) – width for low pass filtering [m]. Dict of form {dim_name (str): width (float)}

  • landmask (optional) – If provided, land mask passed to is_ocean(). None -> xspectra are calculated by default. True -> no xspectra computed.

  • IR_path (str, optional) – a path to the Impulse Response file

Keyword Arguments:

kwargs – keyword arguments passed to compute_interburst_xspectrum()

xsarslc.processing.interburst.compute_interburst_xspectrum(mod0, mod1, mean_incidence, slant_spacing, azimuth_spacing, azimuth_dim='line', nperseg={'line': None, 'sample': 512}, noverlap={'line': 0, 'sample': 256}, **kwargs)

Compute cross spectrum between mod0 and mod1 using a 2D Welch method (periodograms).

Parameters:
  • mod0 (xarray) – modulation signal from burst0

  • mod1 (xarray) – modulation signal from burst1

  • mean_incidence (float) – mean incidence on slc

  • slant_spacing (float) – slant spacing

  • azimuth_spacing (float) – azimuth spacing

  • azimuth_dim (str) – name of azimuth dimension

  • nperseg (dict of int) – number of point per periodogram. Dict of form {dimension_name(str): number of point (int)}

  • noverlap (dict of int) – number of overlapping point per periodogram. Dict of form {dimension_name(str): number of point (int)}

Returns:

concatenated cross_spectra

Return type:

(xarray)

xsarslc.burst.burst_valid_indexes(ds)

Find indexes of valid portion of a burst. Returned line index are relative to burst only !

Parameters:

ds (xarray.Dataset) – Dataset of one burst

Returns:

index of (first valid sample, last valid sample, first valid line, last valid line)

Return type:

(tuple of int)

xsarslc.burst.crop_IW_burst(ds, burst_annotation, burst_number, valid=True, merge_burst_annotation=True)

Crop IW burst from the measurement dataset

Parameters:
  • ds (xarray.Dataset) – measurement dataset

  • burst_annotation (xarray.dataset) – burst annotation dataset

  • burst_number (int) – burst number

  • valid (bool, optional) – If true: only return the valid part of the burst

  • merge_burst_annotation (bool) – If true: annotation of the burst are added to the returned dataset

Returns:

extraction of valid burst portion of provided datatree

Return type:

xarray.Dataset

xsarslc.burst.deramp_burst(burst, dt)

Deramp burst. Return deramped digital numbers

Parameters:
  • burst (xarray.dataArray or xarray.Dataset) – burst or portion of a burst

  • dt (xarray.dataTree) – datatree containing all informations of the SLC

Returns:

deramped digital numbers

Return type:

(xarray.DataArray)

xsarslc.burst.crop_WV(burst)

Crop WV data. Removes portion of WV with zero values only and removes 25 points on each side to remove windowing effect

xsarslc.processing.impulseResponse.compute_IWS_subswath_Impulse_Response(dt, burst_list=None, tile_width={'line': 20000.0, 'sample': 20000.0}, tile_overlap={'line': 10000.0, 'sample': 10000.0}, polarization='VV', **kwargs)

Compute IWS sub-swath range and azimuth Impulse Response. This function must be applied on homogeneous zone (Amazonia, …) Note: If requested tile is larger than the size of available data. tile will be set to maximum available size :param dt: datatree containing sub-swath information :type dt: xarray.Datatree :param burst_list: list of burst number to process. Default is all :type burst_list: list of int, optional :param tile_width: approximate sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)} :type tile_width: dict :param tile_overlap: approximate sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} :type tile_overlap: dict :param polarization: polarization to be selected for IR computation :type polarization: str, optional

Keyword Arguments:

kwargs (dict) – keyword arguments passed to tile_burst_to_IR(), land-mask can be added in kwargs. Can contain polarization

Returns:

xspectra.

Return type:

(xarray)

xsarslc.processing.impulseResponse.compute_WV_Impulse_Response(dt, tile_width=None, tile_overlap=None, polarization='VV', **kwargs)

Compute WV range and azimuth Impulse Response. This function must be applied on homogeneous zone (amazonia, …) Note: If requested tile is larger than the size of availabe data. tile will be set to maximum available size :param dt: datatree contraining subswath information :type dt: xarray.Datatree :param burst_list: list of burst number to process. Default is all :type burst_list: list of int, optional :param tile_width: approximative sizes of tiles in meters. Dict of shape {dim_name (str): width of tile [m](float)} :type tile_width: dict :param tile_overlap: approximative sizes of tiles overlapping in meters. Dict of shape {dim_name (str): overlap [m](float)} :type tile_overlap: dict :param polarization: polarization to be selected for IR computation :type polarization: str, optional

Keyword Arguments:

kwargs (dict) – keyword arguments passed to tile_burst_to_IR(), landmask can be added in kwargs. Can contain polarisation

Returns:

xspectra.

Return type:

(xarray)