From 239919e8e1778b328f1942001d44deabf76834eb 2020-01-10 17:58:48 From: Alexis Jeandet Date: 2020-01-10 17:58:48 Subject: [PATCH] Improved AMDA tree, uses node names instead of xml:id which is more human friendly Signed-off-by: Alexis Jeandet --- diff --git a/.gitignore b/.gitignore index e4760f6..91d73c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +_build/ CMakeLists.txt.user /.project core/src/Version.cpp diff --git a/app/PySide2-bindings/plugins/SPWC-Amda.py b/app/PySide2-bindings/plugins/SPWC-Amda.py index 1c3fe3d..e6837d9 100644 --- a/app/PySide2-bindings/plugins/SPWC-Amda.py +++ b/app/PySide2-bindings/plugins/SPWC-Amda.py @@ -81,7 +81,13 @@ class AmdaProvider(PyDataProvider): products = [] for key, parameter in parameters.items(): - path = f"/AMDA/{parameter['mission']}/{parameter.get('observatory','')}/{parameter['instrument']}/{parameter['dataset']}/{parameter['name']}" + mission_name = amda.mission[parameter['mission']]['name'] + observatory_name = parameter.get('observatory','') + if observatory_name != '': + observatory_name = amda.observatory[observatory_name]['name'] + instrument_name = amda.instrument[parameter['instrument']]['name'] + dataset_name = amda.dataset[parameter['dataset']]['name'] + path = f"/AMDA/{mission_name}/{observatory_name}/{instrument_name}/{dataset_name}/{parameter['name']}" components = [component['name'] for component in parameter.get('components',[])] metadata = {key: item for key, item in parameter.items() if key is not 'components'} n_components = parameter.get('size', 0) @@ -95,8 +101,9 @@ class AmdaProvider(PyDataProvider): metadata["type"] = "scalar" products.append(Product(path, components, metadata)) self.register_products(products) - for mission in amda.mission: - self.set_icon(f'/AMDA/{mission}','satellite') + for _,mission in amda.mission.items(): + if ('target' in mission) and (mission['xml:id'] != 'Ephemerides') and (mission['target'] != 'Earth'): + self.set_icon(f'/AMDA/{mission["name"]}','satellite') def get_data(self, metadata, start, stop): ts_type = amda_make_scalar