From 7ffc93dcad66e62e7cbff7a9d6bb73ea603b253d Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Wed, 9 Apr 2025 22:53:03 +0200 Subject: [PATCH] simplify getting IDS_list --- matlab/IMAS/ids2database.m | 17 +++++------------ matlab/TCV_IMAS/tcv2ids2database.m | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/matlab/IMAS/ids2database.m b/matlab/IMAS/ids2database.m index 75ccc26f..deecfcb2 100644 --- a/matlab/IMAS/ids2database.m +++ b/matlab/IMAS/ids2database.m @@ -5,9 +5,9 @@ function [ids_put_status] = ids2database(shot,run,occurence,ids2put,tree_user,tr % open/create shot,run and put the ids from ids2put.idsnames (names from fieldnames(ids2put) && within IDS_list) % from new ..._env routines, now user/public database name, tokamak name and major UAL version (3 or 4 at this stage) need to be specified % tree_name: getenv('USER') by default, can be 'public' -% tree_tokamak: '' no default, typically tcv, TCV, ITER, etc (case will appear in folder name) +% tree_tokamak: 'tcv' by default, typically tcv, TCV, ITER, etc (case will appear in folder name) % tree_majorversion: '3' by default -% imas_backend: "MDSplus" or "HDF5" or 12 or 13 +% imas_backend: 'MDSplus' or 'HDF5' or 12 or 13 % % varargin{1}: tbd % @@ -15,7 +15,7 @@ function [ids_put_status] = ids2database(shot,run,occurence,ids2put,tree_user,tr ids_put_status = 0; tree_user_default = getenv('USER'); -tree_tokamak_default = ''; +tree_tokamak_default = 'tcv'; tree_majorversion_default = '3'; imas_backend_default = 'HDF5'; @@ -86,15 +86,8 @@ end params_ids2database = params; % check ids_names ids_names=fieldnames(ids2put); -[dummy1]=which('IDS_list'); -if isempty(dummy1) - ids_full_list = eval([lower(tree_tokamak) '_available_ids']); - warning(['IDS_list not available, quick fix introducing list of ids available for TCV: ' fprintf('%s ',ids_full_list{:}) char(10)]); -else - % get effective function between ids_list and IDS_list (which or exist not sufficient) - [dummy2,ids_list_eff]=fileparts(dummy1); - ids_full_list = feval(ids_list_eff); -end +aa=gdat([],'ids'); +ids_full_list = aa.gdat_params.sources_available; ids_names_notok = setdiff(ids_names,ids_full_list); if ~isempty(ids_names_notok) disp(['these subfields are not ids names, so not used: ' sprintf('%s ',ids_names_notok{:})]) diff --git a/matlab/TCV_IMAS/tcv2ids2database.m b/matlab/TCV_IMAS/tcv2ids2database.m index fd9b711a..916ec438 100644 --- a/matlab/TCV_IMAS/tcv2ids2database.m +++ b/matlab/TCV_IMAS/tcv2ids2database.m @@ -10,7 +10,7 @@ function [ids_from_tcv,varargout] = tcv2ids2database(shot,run_out,varargin); % varargin: 'occurence': occurence value % varargin: 'ids_names': cell, ids to load, by default all defined so far (if empty or empty string or not given) % see tcv_available_ids for the list of IDSs available for TCV -% varargin: 'imas_backend': "MDSplus" or "HDF5" +% varargin: 'imas_backend': 'MDSplus' or 'HDF5' % varargin: 'error_bar': type (string) % 'delta' or empty (default): meaning difference in upper is set (standard error_bar % 'added': errorbar is added: upper=data+delta and lower=data-delta -- GitLab