| S2-RUT Algorithm Specification | ![]() |
This function defines the product reading, the setup of the uncertainty product output and the global parameters extraction. Specific tasks:
source_product) and
verified as a valid Sentinel-2 product.product_meta, datastrip_meta and
granule_meta. It also identifies the
spacecraft for either S2A or S2B units.toa_band_names) and
verifies that it is not emptyu_sun),reflectance quantification
(quant) and sun zenith angle
(source_sza). The later contains the per-pixel sun
zenith angle for 10, 20 and 60m spatial resolutions.k)
and uncertainty contributors flags (unc_select).scene_width, scene_height and
geolocation: rut_product =
snappy.Product(self.source_product.getName() + '_rut', 'S2_RUT',
scene_width, scene_height)unc_toa_band)
in the uncertainty product with the correct name and Nodata
value.This function selects the specific band in a tile, extracts the required parameters and sets the uncertainty samples after calling the S2RutAlgo operator. Specific tasks:
source_band and
toa_band_id.source_sza, cloudmask and
cirrusmask according to the spatial resolution of the
band.a), sun irradiance
(e_sun), noise model coefficients (alpha
and beta), and estimated diffuser degradation
(u_diff_temp).toa_samplesunc =
self.rut_algo.unc_calculation(np.array(toa_samples,
dtype=np.uint16), toa_band_id)unc.tileThis step converts the L1C reflectance in L1B CN counts.
cn = (self.a * self.e_sun * self.u_sun *
math.cos(math.radians(self.tecta)) / ( math.pi * self.quant)) *
band_data.
This step evaluates the impact of the uncertainty propagation through the resampling process.
RUTv1 does not include this step. This is to be implemented in next versions of the RUT
NOTE: Each the following uncertainty contributors are
pre-checked and included if unc_select == True
Noise in % units
u_noise = 100 * np.sqrt(self.alpha ** 2 + self.beta * cn) /
cnOut-of field straylight - systematic in radiance units
u_stray_sys = 0.3 * rad_conf.Lref[band_id] / 100Out-of field straylight - random in % units
u_stray_rand = rad_conf.u_stray_rand_all[band_id]Crosstalk in radiance units
u_xtalk = rad_conf.u_xtalk_all[band_id]Instrument quantisation. Defined in _init_
function.
self.u_ADC = 0.5Predefined DS stability in LSB units
u_DS = rad_conf.u_DS_all[band_id]Predefined relative gains residual in % units
u_gamma = 0.4
Pre-flight diffuser reflectance knowledge in % units
u_diff_abs = rad_conf.u_diff_absarray[band_id]u_diff_temp calculated in computeTile
function(see above)
Cosine diffuser knowledge. Defined in _init_
function.
self.u_diff_cos = 0.4Diffuser straylight residual correction. Defined in
_init_ function.
self.u_diff_k = 0.3Impact of the reflectance factor digitisation in % units
u_ref_quant = 100 * (0.5 / math.sqrt(3)) / band_data
Calculation of the terms u'DS and u'ADC
u_adc = (100 * self.u_ADC / math.sqrt(3)) / cn ;
u_ds = (100 * u_DS) / cnCalculation of the straylight term and conversion of the crosstalk into % units
u_stray = np.sqrt(u_stray_rand ** 2 + ((100 * self.a *
u_xtalk) / cn) ** 2)Calculation of the diffuser uncertainty
u_diff = math.sqrt(u_diff_abs ** 2 + self.u_diff_cos ** 2 +
self.u_diff_k ** 2)Calculation of the standard uncertainty
u_1sigma = np.sqrt(u_ref_quant ** 2 + u_gamma ** 2 + u_stray
** 2 + u_diff ** 2 + u_noise ** 2 + u_adc ** 2 + u_ds **
2)Calculation of the expanded uncertainty in % units. Conversion of the Out-of-Field Straylight - systematic in % units. Resulting uncertainty values multiplied by 10
u_expand = 10 * (self.u_diff_temp + ((100 * self.a *
u_stray_sys) / cn) + self.k * u_1sigma)Clipping all the values to range [0,250] for uncertainty image UINT8 type
u_ref = np.uint8(np.clip(u_expand, 0, 250))