From 9c6239cfabb652059f8d0ad3697fe515fca40426 Mon Sep 17 00:00:00 2001 From: grouazel Date: Thu, 16 May 2024 11:24:15 +0200 Subject: [PATCH] add missing history for noise_lut_range_raw --- safe_s1/reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/safe_s1/reader.py b/safe_s1/reader.py index 0f8e3af..fc41ae0 100644 --- a/safe_s1/reader.py +++ b/safe_s1/reader.py @@ -112,7 +112,7 @@ def __init__(self, name, backend_kwargs=None): assert self.dt==self.datatree else: print('multidataset') - # raise Exception() + # there is no error raised here, because we want to let the user access the metadata for multidatasets def load_digital_number(self, resolution=None, chunks=None, resampling=rasterio.enums.Resampling.rms): """ @@ -646,6 +646,7 @@ def get_noise_range_raw(self): """ tmp = [] pols = [] + history = [] for pol_code, xml_file in self.files['noise'].items(): #pol = self.files['polarization'].cat.categories[pol_code - 1] pol = os.path.basename(xml_file).split('-')[4].upper() @@ -657,8 +658,10 @@ def get_noise_range_raw(self): hihi = self.xml_parser.get_var(self.files['noise'].iloc[0], 'noise.range.%s' % varitmp, describe=True) noise_lut_range_raw_ds[vari].attrs['description'] = hihi + history.append(self.xml_parser.get_compound_var(xml_file, 'noise_lut_range_raw', describe=True)) tmp.append(noise_lut_range_raw_ds) ds = xr.concat(tmp, pd.Index(pols, name="pol")) + ds.attrs['history'] = '\n'.join(history) return ds def get_noise_azi_initial_parameters(self, pol):