pysiral.retracker.samosa

Attributes

SAMOSA_OK

SAMOSA_DEBUG_MODE

Classes

SAMOSAConstants

Physical constants used for the SAMOSA+ Waveform model

SAMOSAFittingOptions

Settings for the waveform model fitting (scipy.optimize)

SAMOSALookUpTables

Links to the lookup-table filenames in the samosa package

SAMOSARadarSpecs

Radar altimeter specifications needed for the SAMOSA(+) Retracker

SAMOSAFitResult

Container for output of the SAMOSA+ retracker

SAMOSAGeoVariables

SAMOSAConfiguration

Configuration settings for the SAMOSA+ retracker

SAMOSAPlus

Interface to the SAMOSA+ retracker by CLS.

Functions

fit_samosa_waveform_model(index, samlib, l1b, wfm, ...)

Fitting procedure for one waveform as function

get_look_angles(→ numpy.typing.NDArray)

Compute the lookangles based on l1b stack information

Module Contents

pysiral.retracker.samosa.SAMOSA_OK = True
pysiral.retracker.samosa.SAMOSA_DEBUG_MODE = False
class pysiral.retracker.samosa.SAMOSAConstants

Physical constants used for the SAMOSA+ Waveform model

c0: float = 299792458.0
R_e: float = 6378137.0
f_e: float = 0.0033528106647474805
gamma_3_4: float = 1.2254167024651779
class pysiral.retracker.samosa.SAMOSAFittingOptions

Settings for the waveform model fitting (scipy.optimize)

method: str = 'trf'
ftol: float = 0.01
gtol: float = 0.01
xtol: float = 0.002
diff_step: Any = None
max_nfev: Any = None
loss: str = 'linear'
class pysiral.retracker.samosa.SAMOSALookUpTables

Links to the lookup-table filenames in the samosa package

F0: str = 'LUT_F0.txt'
F1: str = 'LUT_F1.txt'
alphap_noweight: str = 'alphap_table_DX3000_ZP20_SWH20_10_Sept_2019(CS2_NOHAMMING).txt'
alphap_weight: str = 'alphap_table_DX3000_ZP20_SWH20_10_Sept_2019(CS2_HAMMING).txt'
alphapower_noweight: str = 'alphaPower_table_CONSTANT_SWH20_10_Feb_2020(CS2_NOHAMMING).txt'
alphapower_weight: str = 'alphaPower_table_CONSTANT_SWH20_10_Feb_2020(CS2_NOHAMMING).txt'
class pysiral.retracker.samosa.SAMOSARadarSpecs(Np_burst: int = None, Npulse: int = None, PRF_SAR: float = None, BRI: float = None, f_0: float = None, Bs: float = None, theta_3x: float = None, theta_3y: float = None, G_0: float = None, bias_sigma0: float = None)

Radar altimeter specifications needed for the SAMOSA(+) Retracker

Np_burst = None
Npulse = None
PRF_SAR = None
BRI = None
f_0 = None
Bs = None
theta_3x = None
theta_3y = None
G_0 = None
bias_sigma0 = None
classmethod from_preset(preset: str) SAMOSARadarSpecs

Sets the radar altimeter specifications for the given presets

Parameters:

preset – The name of the preset of type {platform}_{sensor}_{mode}

Raises:

ValueError – Invalid preset

Returns:

Initialized SAMOSARadarSpecs instance

class pysiral.retracker.samosa.SAMOSAFitResult

Container for output of the SAMOSA+ retracker

tau: numpy.ndarray
wf: numpy.ndarray
wf_model: numpy.ndarray
epoch_sec: float
rng: float
nu: float
swh: float
Pu: float
misfit: float
oceanlike_flag: bool
sigma0: float
pval: float
cval: float
rval: float
kval: float
debug_plot()
class pysiral.retracker.samosa.SAMOSAGeoVariables(lat: float, lon: float, height: float, vs: float, hrate: float, pitch: float, roll: float, nu: float, track_sign: int, thn: float)

Bases: object

LAT
LON
Height
Vs
Hrate
Pitch
Roll
nu
track_sign
ThN
classmethod from_l1(l1b, vel, hrate, ThNEcho, index) SAMOSAGeoVariables
Parameters:
  • l1b

  • vel

  • ThNEcho

  • index

Returns:

class pysiral.retracker.samosa.SAMOSAConfiguration(cst: SAMOSAConstants, rdb: SAMOSARadarSpecs, flag_slope: bool = False, beamsamp_factor: int = 1, wf_weighted: bool = True, N_Look_min: int = -90, N_Look_max: int = 90, guess_swh: float = 2.0, guess_pu: float = 1.0, guess_nu: float = 2.0, lb_epoch: float = None, lb_swh: float = -0.5, lb_pu: float = 0.2, lb_nu: float = 0.0, ub_epoch: float = None, ub_swh: float = 30.0, ub_pu: float = 1.5, ub_nu: float = 1000000000.0, rtk_type: str = 'samosa+', wght_factor: float = 1.4705)

Bases: object

Configuration settings for the SAMOSA+ retracker

flag_slope = False
beamsamp_factor = 1
wf_weighted = True
N_Look_min = -90
N_Look_max = 90
guess_swh = 2.0
guess_pu = 1.0
guess_nu = 2.0
lb_epoch = None
lb_swh = -0.5
lb_pu = 0.2
lb_nu = 0.0
ub_epoch = None
ub_swh = 30.0
ub_pu = 1.5
ub_nu = 1000000000.0
rtk_type = 'samosa+'
wght_factor = 1.4705
Lz
class pysiral.retracker.samosa.SAMOSAPlus

Bases: pysiral.retracker.BaseRetracker

Interface to the SAMOSA+ retracker by CLS. Retracker must be installed as a package into the environment for this class to be used.

_retracker_params
create_retracker_properties(n_records: int) None

Initialize retracker properties with correct arrays shapes (shape = (n_records, )). The list of parameters depends on whether the SAMOSA_DEBUG_MODE flag is set.

NOTE: The properties are set to an array, but can be accessed as self.{property_name} via the __getattr__ method.

Parameters:

n_records

l2_retrack(rng, wfm, indices, radar_mode, is_valid) None

API method for the retracker interface in the Level-2 processor.

Parameters:
  • rng – The range per waveform samples for all waveforms in the Level-1 data object

  • wfm – All waveforms in the Level-1 data object

  • indices – List of waveforms for the retracker

  • radar_mode – Flag indicating the radar mode for all waveforms

  • is_valid – Error flag for all waveforms

Returns:

None (Output is added to the instance)

_store_retracker_properties(fit_results, indices) None

Store the output of the SAMOSA+ retracker in the class.

Parameters:
  • fit_results

  • indices

Returns:

_set_range_bias(radar_mode) None

Set range bias bases on radar mode (from config file)

Parameters:

radar_mode

Returns:

_set_range_uncertainty() None

Estimate the uncertainty of the SAMOSA+ retracker result. At the moment there is no other implementation than using a fixed uncertainty value from the Level-2 processor definition file.

_register_auxiliary_variables() None

Add auxiliary variables to the L2 data object. The specific variables depend on surface type.

_samosa_plus_retracker(rng, wfm, indices, radar_mode) List[SAMOSAFitResult]

Run the SAMOSA+ retracker for a set of waveforms.

NOTE: The entire data structure will likely change.

Parameters:
  • rng

  • wfm

  • indices

  • radar_mode

Returns:

_get_samosa_dataclasses() Tuple[SAMOSAConstants, SAMOSAFittingOptions, SAMOSARadarSpecs, SAMOSAConfiguration, SAMOSALookUpTables]

Get the data classes requires for the SAMOSA retracker

Returns:

static _compute_thermal_noise(wfm: numpy.typing.NDArray, wf_zp: int, n_start_noise: int = 2, n_end_noise: int = 6) float

Compute thermal noise for all waveforms with samosa/sampy package from the early range gated in the range window.

Parameters:
  • wfm – waveform power

  • wf_zp – zero padding waveform oversampling factor

  • n_start_noise – noise range gate counting from 1, no oversampling

  • n_end_noise – noise range gate counting from 1, no oversampling

Returns:

Thermal noise as computed by the sampy package

static _get_normalized_waveform(wfm: numpy.typing.NDArray) numpy.typing.NDArray

The samosa/SAMPy package expecte waveforms with 16bit scaling. Scale any waveform to this range.

Parameters:

wfm

Returns:

_get_range_array(wfm, rdb: SAMOSARadarSpecs, cst: SAMOSAConstants) Tuple[numpy.typing.NDArray, numpy.typing.NDArray, numpy.typing.NDArray, float]
_get_altitude_velocity_from_l1() Tuple[numpy.typing.NDArray, numpy.typing.NDArray]

Get altitude (height) rate and satellite velocity from l1 data

Returns:

_samosa_debug_output() None

Write a netCDF file with debugging parameters

Returns:

_filter_results() None

Nothing here yet. :return:

__getattr__(item: str) Any

Direct attribute access to the retracker properties dictionary

Parameters:

item – parameter name

Raises:

AttributeError – item not in self._retracker_params (see self.create_retracker_properties)

Returns:

pysiral.retracker.samosa.fit_samosa_waveform_model(index, samlib, l1b, wfm, tau, window_del_20_hr_ku_deuso, vel, hrate, ThNEcho, CONF, epoch0, MaskRanges, raw_range, CST, RDB)

Fitting procedure for one waveform as function

Parameters:
  • index

  • samlib

  • wfm

  • tau

  • window_del_20_hr_ku_deuso

  • vel

  • hrate

  • ThNEcho

  • CONF

  • epoch0

  • MaskRanges

  • raw_range

  • CST

  • RDB

Returns:

pysiral.retracker.samosa.get_look_angles(l1b: pysiral.l1data.L1bdataNCFile, index: int) numpy.typing.NDArray

Compute the lookangles based on l1b stack information # TODO: This functions raises a ValueError for NaN values in the classifiers (LRM?)

Parameters:
  • l1b – The level 1 data object

  • index – Waveform index

Returns: