Skip to content

Commit 177daf3

Browse files
committed
Merge branch 'develop' into 'master'
version 1.2.1 See merge request eco/eo/lime_tbx!84
2 parents 5025b51 + a2f85d6 commit 177daf3

10 files changed

Lines changed: 91 additions & 65 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
[//]: # "## [unreleased] - yyyy-mm-dd"
99

10+
## [1.2.1] - 2025-07-04
11+
12+
### Added
13+
14+
- Added a disclaimer during comparison processing to inform users that,
15+
if the operation is taking too long, they can improve performance by
16+
disabling uncertainty computation.
17+
18+
19+
### Changed
20+
21+
- Optimised observation file loading on the comparison page, achieving 1.25x to 1.5x faster performance.
22+
1023
## [1.2.0] - 2025-06-20
1124

1225
### Added
@@ -85,8 +98,8 @@ calculations compared to v1.0.3. (**NFR306**)
8598

8699
Initial version that serves as the baseline for tracking changes in the change log.
87100

88-
89-
[unreleased]: https://github.com/LIME-ESA/lime_tbx/compare/v1.2.0...HEAD
101+
[unreleased]: https://github.com/LIME-ESA/lime_tbx/compare/v1.2.1...HEAD
102+
[1.2.1]: https://github.com/LIME-ESA/lime_tbx/compare/v1.2.0...1.2.1
90103
[1.2.0]: https://github.com/LIME-ESA/lime_tbx/compare/v1.1.0...v1.2.0
91104
[1.1.0]: https://github.com/LIME-ESA/lime_tbx/compare/v1.0.3...v1.1.0
92105
[1.0.3]: https://github.com/LIME-ESA/lime_tbx/releases/tag/v1.0.3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Version 1.2.0](https://img.shields.io/badge/version-1.2.0-informational?style=for-the-badge)](https://github.com/LIME-ESA/lime_tbx/tags)
1+
[![Version 1.2.1](https://img.shields.io/badge/version-1.2.1-informational?style=for-the-badge)](https://github.com/LIME-ESA/lime_tbx/tags)
22
[![License: LGPL 3.0][license-shield]][license-url]
33
[![Issues][issues-shield]][issues-url]
44
[![Stargazers][stars-shield]][stars-url]

deployment/installer/build_mac_installer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ cp -r ../../dist/LimeTBX.app mac/bundle/LimeTBX.app
55
cp -r ../../kernels mac/bundle/LimeTBX.app/Contents/Resources/kernels
66
cp -r ../../eocfi_data mac/bundle/LimeTBX.app/Contents/Resources/eocfi_data
77
cp -r ../../coeff_data mac/bundle/LimeTBX.app/Contents/Resources/coeff_data
8-
version='1.2.0'
8+
version='1.2.1'
99
pkgbuild --install-location /Applications --root mac/bundle --identifier 'int.esa.LimeTBX' --scripts mac/scripts --version $version --component-plist mac/Components.plist mac/lime.pkg

deployment/installer/debian/build_deb.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
echo "Building lime .deb package."
3-
# 1.2.0 Comment so the search for the version a.b.c appears (here it is a.b-c)
4-
version="1.2-0"
5-
# 1.2.0 Change it in the control file too!
3+
# 1.2.1 Comment so the search for the version a.b.c appears (here it is a.b-c)
4+
version="1.2-1"
5+
# 1.2.1 Change it in the control file too!
66
name="lime_"$version
77
[ -d $name ] && rm -rf $name
88
[ -f $name".deb" ] && rm -f $name".deb"

deployment/installer/debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: lime
2-
Version: 1.2-0
2+
Version: 1.2-1
33
Section: base
44
Priority: optional
55
Architecture: amd64

deployment/installer/windows/inno_installer_builder.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "LimeTBX"
5-
#define MyAppVersion "1.2.0"
5+
#define MyAppVersion "1.2.1"
66
#define MyAppPublisher "European Space Agency"
77
#define MyAppExeName "LimeTBX.exe"
88
#define MyAppDevPath "C:\repo\"

lime_tbx/application/filedata/moon.py

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -214,53 +214,51 @@ def read_moon_obs(
214214
Generated MoonObservation from the given datafile
215215
"""
216216
try:
217-
ds = xr_open_dataset(path, mask_limits={"sat_pos": False})
217+
ds = xr_open_dataset(path, mask_limits={"irr_obs": True, "__default__": False})
218218
_validate_schema_regular_moonobs(ds)
219-
n_channels = len(ds["channel_name"])
220-
ch_names = []
221-
ch_irrs = {}
222-
for i in range(n_channels):
223-
ch_name = str(ds["channel_name"][i].values, "utf-8").rstrip("\x00")
224-
ch_names.append(ch_name)
219+
ch_names = np.char.rstrip(
220+
np.char.decode(ds["channel_name"].to_numpy(), "utf-8"), "\x00"
221+
)
225222
dt = ds["date"].values[0]
226223
if np.issubdtype(dt.dtype, np.datetime64):
227-
dt = dt.astype("datetime64[us]").astype(datetime)
228-
dt = dt.replace(tzinfo=timezone.utc)
224+
dt = (
225+
dt.astype("datetime64[us]")
226+
.astype(datetime)
227+
.replace(tzinfo=timezone.utc)
228+
)
229229
else:
230230
dt = datetime.fromtimestamp(dt, tz=timezone.utc)
231-
sat_pos_ref = ds["sat_pos_ref"].values
232-
if str(sat_pos_ref.dtype.str).startswith("|S"):
233-
sat_pos_ref = str(sat_pos_ref, "utf-8")
231+
sat_pos_ref = ds["sat_pos_ref"].to_numpy()
232+
if isinstance(sat_pos_ref, np.ndarray):
233+
sat_pos_ref = sat_pos_ref.item()
234+
if isinstance(sat_pos_ref, (bytes, bytearray)):
235+
sat_pos_ref = sat_pos_ref.decode("utf-8", errors="replace")
234236
else:
235-
sat_pos_ref = sat_pos_ref[0]
236-
sat_pos_units: str = ds["sat_pos"].units
237-
d_to_m = get_length_conversion_factor(sat_pos_units, "m")
238-
to_correct_distance = False
239-
if not np.isnan(ds["sat_pos"].values).any():
240-
sat_pos = SatellitePosition(*list(ds["sat_pos"].values * d_to_m))
237+
sat_pos_ref = str(sat_pos_ref)
238+
sat_pos_vals = ds["sat_pos"].to_numpy()
239+
has_sat_pos = ~np.isnan(sat_pos_vals).any()
240+
if has_sat_pos:
241+
d_to_m = get_length_conversion_factor(ds["sat_pos"].units, "m")
242+
sat_pos = SatellitePosition(*sat_pos_vals * d_to_m)
241243
md = None
244+
corr_dist = False
242245
else:
243246
sat_pos = None
244247
md = _get_moondata_from_moon_obs(ds, dt, kernels_path, eocfi_path)
245-
if "to_correct_distance" in ds.attrs and int(ds.to_correct_distance) == 1:
246-
to_correct_distance = True
247-
irr_obs = ds["irr_obs"].values
248-
irr_obs_units: str = ds["irr_obs"].units
249-
d_to_nm = _calc_divisor_to_nm(irr_obs_units)
250-
if to_correct_distance:
251-
irr_obs = (
252-
irr_obs
253-
* ((1 / md.distance_sun_moon) ** 2)
254-
* (DIST_EARTH_MOON_KM / md.distance_observer_moon) ** 2
255-
)
256-
irr_obs = irr_obs / d_to_nm
257-
for i, ch_irr in enumerate(irr_obs):
258-
if not np.isnan(ch_irr):
259-
ch_irrs[ch_names[i]] = float(ch_irr)
260-
data_source = ds.data_source
248+
corr_dist = bool(int(ds.attrs.get("to_correct_distance", 0)))
249+
irr_obs = ds["irr_obs"].to_numpy()
250+
d_to_nm = _calc_divisor_to_nm(ds["irr_obs"].units)
251+
data_source = ds.attrs.get("data_source")
261252
ds.close()
253+
if corr_dist:
254+
irr_obs *= (1 / md.distance_sun_moon) ** 2 * (
255+
DIST_EARTH_MOON_KM / md.distance_observer_moon
256+
) ** 2
257+
irr_obs /= d_to_nm
258+
valid = ~np.isnan(irr_obs)
259+
ch_irrs = dict(zip(ch_names[valid], irr_obs[valid].astype(float)))
262260
return LunarObservation(
263-
ch_names, sat_pos_ref, ch_irrs, dt, sat_pos, data_source, md
261+
list(ch_names), sat_pos_ref, ch_irrs, dt, sat_pos, data_source, md
264262
)
265263
except SchemaError as e:
266264
raise e

lime_tbx/application/filedata/netcdfcommon.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,29 +139,33 @@ def xr_open_dataset(
139139
mask_limits: bool | Mapping[str, bool]
140140
If True, replace array values lower than `valid_min` or higher than `valid_max` with `NA`, if present.
141141
Pass a mapping, e.g. {"my_variable": False}, to toggle this feature per-variable individually.
142-
If a mapping is passed and a variable is missing, it's understood that the variable is mapped to True by default.
142+
If a mapping is passed and a variable is missing, it's understood that the variable is mapped to the default value.
143+
The default value is the one defined for the "__default__" mapping, or True if not specified.
143144
144145
Returns
145146
-------
146147
ds: xr.Dataset
147148
Dataset with the information of the netCDF file.
148149
"""
149-
ds = xr.open_dataset(filepath, mask_and_scale=mask_fillvalue)
150-
for vname in list(ds.data_vars.keys()):
151-
mask_limits_var = False
152-
if isinstance(mask_limits, bool):
153-
mask_limits_var = mask_limits
154-
else:
155-
mask_limits_var = vname not in mask_limits or mask_limits[vname]
156-
if mask_limits_var:
157-
values = ds[vname].values
158-
if hasattr(ds[vname], "valid_min"):
159-
valid_min = ds[vname].valid_min
160-
values = np.where(values >= valid_min, values, np.nan)
161-
if hasattr(ds[vname], "valid_max"):
162-
valid_max = ds[vname].valid_max
163-
values = np.where(values <= valid_max, values, np.nan)
164-
ds[vname].values = values
150+
ds = xr.open_dataset(filepath, engine="netcdf4", mask_and_scale=mask_fillvalue)
151+
if mask_limits is not False:
152+
default = True
153+
if not isinstance(mask_limits, bool):
154+
default = mask_limits.get("__default__", True)
155+
for vname, var in ds.data_vars.items():
156+
mask_limits_var = False
157+
if isinstance(mask_limits, bool):
158+
mask_limits_var = mask_limits
159+
else:
160+
mask_limits_var = mask_limits.get(vname, default)
161+
if mask_limits_var:
162+
values = var.values
163+
mask = np.ones(values.shape, dtype=bool)
164+
if hasattr(var, "valid_min"):
165+
mask &= values >= var.valid_min
166+
if hasattr(var, "valid_max"):
167+
mask &= values <= var.valid_max
168+
var.values = np.where(mask, values, np.nan)
165169
return ds
166170

167171

lime_tbx/presentation/gui/maingui.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,14 +721,19 @@ def compare(self):
721721
)
722722

723723
def compare_info(self, data: str):
724+
is_skip = self.settings_manager.is_skip_uncertainties()
724725
if (
725726
self.quant_mos_simulated < self.quant_mos - 1
726727
): # -1 So it gives time to the last message to be shown
727-
self.spinner.set_text(f"{self.quant_mos_simulated}/{self.quant_mos}")
728-
self.quant_mos_simulated += 1
728+
text = f"{self.quant_mos_simulated}/{self.quant_mos}"
729+
if not is_skip:
730+
text += (
731+
"\nIf this is too slow, try deactivating uncertainty computation"
732+
)
729733
else:
730-
self.spinner.set_text(f"Finishing comparisons\nand drawing graphs...")
731-
self.quant_mos_simulated += 1
734+
text = f"Finishing comparisons\nand drawing graphs..."
735+
self.spinner.set_text(text)
736+
self.quant_mos_simulated += 1
732737

733738
def set_show_comparison_input(self, show: bool):
734739
self.top_precomp.setVisible(show)
@@ -768,6 +773,11 @@ def clear_comparison_accepted(self):
768773

769774
def _clear_comparison_finished(self, data):
770775
self.srf = None
776+
self.comps = None
777+
self.data_source = None
778+
self.skipped_uncs = None
779+
self.mpa_comps = None
780+
self.version = None
771781
self.set_show_comparison_input(True)
772782
if not self.compare_by_field.currentText() == CompFields.COMP_DATE:
773783
self.compare_by_field.setCurrentText(CompFields.COMP_DATE)

lime_tbx/presentation/gui/spinner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def _build_layout(self):
2525
self.label_spinner = QtWidgets.QLabel()
2626
self.label_spinner.setMovie(self.movie)
2727
self.label_text = QtWidgets.QLabel()
28+
self.label_text.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
2829
self.main_layout.addWidget(QtWidgets.QLabel())
2930
self.main_layout.addWidget(self.label_spinner)
3031
self.main_layout.addWidget(self.label_text)

0 commit comments

Comments
 (0)