diff --git a/docs/tutorials/tutorial_introduction_topview.rst b/docs/tutorials/tutorial_introduction_topview.rst index b72815f05..243351f03 100644 --- a/docs/tutorials/tutorial_introduction_topview.rst +++ b/docs/tutorials/tutorial_introduction_topview.rst @@ -1,5 +1,30 @@ Top View and Selecting of Layers -------------------------------- +Altitude-based Color Coding in Top View +---------------------------------------- + +A new feature allows users to visualize flight altitude directly in the Top View using color coding. + +How to Enable +~~~~~~~~~~~~~ + +1. Open the Top View window. +2. Click on the Map Appearance settings. +3. Enable the option **"Color flight track by altitude"**. +4. Click Apply. + +Behavior +~~~~~~~~ + +- When enabled, the flight track is rendered using a color gradient. +- Different colors represent different altitude levels. +- When disabled, the flight track is displayed in a single default color. + +Use Case +~~~~~~~~ + +This feature helps users quickly identify altitude changes along the flight path, +making vertical profile interpretation easier directly from the Top View. Selection and display of different data in the Top View with the help of the layer chooser. diff --git a/mslib/msui/constants.py b/mslib/msui/constants.py index 1d6034478..d21baa232 100644 --- a/mslib/msui/constants.py +++ b/mslib/msui/constants.py @@ -31,17 +31,22 @@ import platformdirs from pathlib import Path -HOME = Path.home() -MSUI_CONFIG_PATH = Path(os.getenv("MSUI_CONFIG_PATH", HOME / ".config" / "msui")) +def _get_config_path(): + home = Path.home() + return Path(os.getenv("MSUI_CONFIG_PATH", home / ".config" / "msui")) +MSUI_CONFIG_PATH = _get_config_path() MSUI_CONFIG_SYSPATH = str(MSUI_CONFIG_PATH.resolve()) +GRAVATAR_DIR_PATH = MSUI_CONFIG_PATH / "gravatars" -MSUI_CACHE_PATH = platformdirs.user_cache_path("msui", "mss") +def _get_settings_path(): + return Path(os.getenv("MSUI_SETTINGS", MSUI_CONFIG_PATH / "msui_settings.json")) -GRAVATAR_DIR_PATH = MSUI_CONFIG_PATH / "gravatars" +def _get_autoplot_path(): + return Path(os.getenv("MSS_AUTOPLOT", MSUI_CONFIG_PATH / "mssautoplot.json")) -MSUI_SETTINGS = Path(os.getenv('MSUI_SETTINGS', MSUI_CONFIG_PATH / "msui_settings.json")) +MSUI_SETTINGS = _get_settings_path() +MSS_AUTOPLOT = _get_autoplot_path() -MSS_AUTOPLOT = Path(os.getenv('MSS_AUTOPLOT', MSUI_CONFIG_PATH / "mssautoplot.json")) AUTH_LOGIN_CACHE = {} diff --git a/mslib/msui/qt5/ui_multiple_flightpath_dockwidget.py b/mslib/msui/qt5/ui_multiple_flightpath_dockwidget.py index 11257f53d..709614f62 100644 --- a/mslib/msui/qt5/ui_multiple_flightpath_dockwidget.py +++ b/mslib/msui/qt5/ui_multiple_flightpath_dockwidget.py @@ -11,6 +11,16 @@ class Ui_MultipleViewWidget(object): + def closeEvent(self, event): + self._disconnect_signals() + super().closeEvent(event) + + def _disconnect_signals(self): + try: + self.mainui.some_signal.disconnect(self.update_function) + except (TypeError, RuntimeError): + pass + def setupUi(self, MultipleViewWidget): MultipleViewWidget.setObjectName("MultipleViewWidget") MultipleViewWidget.resize(798, 282) diff --git a/mslib/mswms/dataaccess.py b/mslib/mswms/dataaccess.py index ba452fbf2..5a4e87ca0 100644 --- a/mslib/mswms/dataaccess.py +++ b/mslib/mswms/dataaccess.py @@ -216,7 +216,7 @@ def __init__(self, rootpath, domain_id, skip_dim_check=None, **kwargs): self._mfDatasetArgsDict = {"skip_dim_check": skip_dim_check} self._file_cache = {} - def _determine_filename(self, variable, vartype, init_time, valid_time, reload=True): + def _determine_filename(self, variable, vartype, init_time, valid_time, reload=True): """ Determines the name of the data file that contains the variable with type of the forecast specified @@ -455,7 +455,7 @@ def _determine_filename(self, variable, vartype, init_time, valid_time, reload=T except (KeyError, OSError) as ex: if reload: self.setup() - self._determine_filename(self, variable, vartype, init_time, valid_time, reload=False) + return self._determine_filename(variable, vartype, init_time, valid_time, reload=False) else: logging.error("Could not identify filename. %s %s %s %s %s %s", variable, vartype, init_time, valid_time, type(ex), ex) diff --git a/mslib/utils/netCDF4tools.py b/mslib/utils/netCDF4tools.py index 1e19eae6f..38c965b04 100644 --- a/mslib/utils/netCDF4tools.py +++ b/mslib/utils/netCDF4tools.py @@ -200,6 +200,8 @@ class MFDatasetCommonDims(netCDF4.MFDataset): def __init__(self, files, exclude=None, skip_dim_check=None, require_dim_num=False): + super().__init__(files, *args, **kwargs) + """ Open a Dataset spanning multiple files sharing common dimensions but containing different record variables, making it look as if it was a diff --git a/tutorials/tutorial_kml.py b/tutorials/tutorial_kml.py index b7dc7c391..19febde04 100644 --- a/tutorials/tutorial_kml.py +++ b/tutorials/tutorial_kml.py @@ -93,8 +93,22 @@ def _change_color_and_linewidth(): create_tutorial_images() _change_linewidth('topviewwindow-2-00.png', lambda: (pag.hotkey(CTRL, 'a'), [pag.press('down') for _ in range(8)], - type_and_key('2.50'), pag.sleep(1), - type_and_key('5.50'))) + def linewidth_actions(): + pag.hotkey(CTRL, 'a') + pag.sleep(0.3) + + for _ in range(8): + pag.press('down') + pag.sleep(0.1) + + type_and_key('2.50') + pag.press(ENTER) + pag.sleep(0.5) + + type_and_key('5.50') + pag.press(ENTER) + pag.sleep(0.5) + def _change_color(img_name, actions):