diff --git a/crpptbx/AUG/aug_requests_mapping.m b/crpptbx/AUG/aug_requests_mapping.m index b3f424b29f81c5aa1a88d4db4308d976a36e98d9..d094a08d72deab83ffcc4a6304c9b5bc7295b200 100644 --- a/crpptbx/AUG/aug_requests_mapping.m +++ b/crpptbx/AUG/aug_requests_mapping.m @@ -110,7 +110,7 @@ switch lower(data_request) mapping.method = 'switchcase'; % could use function make_eqdsk directly? mapping.expression = ''; case 'equil' - mapping.timedim = 3; + mapping.gdat_timedim = 2; mapping.method = 'switchcase'; % could use function make_eqdsk directly? mapping.expression = ''; case 'halpha' @@ -129,7 +129,7 @@ switch lower(data_request) mapping.method = 'signal'; mapping.expression = [{'MAG'},{'Ipa'}]; case 'kappa' - mapping.timedim = 1; + mapping.timedim = 2; mapping.label = '\kappa'; mapping.method = 'signal'; mapping.expression = [{'FPG'},{'k'}]; @@ -157,9 +157,11 @@ switch lower(data_request) 'tmp_data=interp1(gdat_tmp2.t,gdat_tmp2.data,gdat_tmp.t,[],NaN);' ... 'gdat_tmp.data = gdat_tmp.data./(tmp_data+1e-5);']; case 'ne_rho' + mapping.timedim = 2; mapping.label = 'ne'; mapping.method = 'switchcase'; - case 'neterho' + case 'nete_rho' + mapping.timedim = 2; mapping.label = 'ne and Te'; mapping.method = 'switchcase'; case 'ni' @@ -185,6 +187,8 @@ switch lower(data_request) mapping.expression = [{'FPG'},{'q95'},{'AUGD'}]; mapping.expression = []; case 'q_rho' + mapping.timedim = 2; + mapping.gdat_timedim = 2; mapping.label = 'q'; mapping.method = 'switchcase'; case 'rgeom' @@ -216,7 +220,7 @@ switch lower(data_request) mapping.method = 'signal'; mapping.expression = [{'FPG'},{'Rmag'},{'AUGD'}]; case 'sxr' - mapping.timedim = 2; + mapping.timedim = 1; mapping.gdat_timedim = 2; mapping.method = 'switchcase'; case 'te' diff --git a/crpptbx/AUG/gdat_aug.m b/crpptbx/AUG/gdat_aug.m index ccdbe90314f78e247082e1956b7cb838813033a0..c9ab6b69f3f615361a7674e9fad725f241cbc157 100644 --- a/crpptbx/AUG/gdat_aug.m +++ b/crpptbx/AUG/gdat_aug.m @@ -74,7 +74,6 @@ gdat_params.nverbose = 1; % construct list of keywords from global set of keywords and specific AUG set % get data_request names from centralized table data_request_names = get_data_request_names; - % add AUG specific to all: if ~isempty(data_request_names.aug) aug_names = fieldnames(data_request_names.aug); @@ -84,12 +83,6 @@ if ~isempty(data_request_names.aug) end data_request_names_all = fieldnames(data_request_names.all); -% $$$ data_request_names_all= [{'ip'} {'b0'} {'zmag'} {'rmag'} {'rcont'} {'zcont'} {'vol'} {'rhovol'} {'qrho'} {'q95'} {'kappa'} ... -% $$$ {'delta'} {'deltatop'} {'deltabot'} {'neint'} {'nel'} ... -% $$$ {'ne'} {'te'} {'nerho'} {'terho'} {'ne_edge'} {'te_edge'} {'nerho_edge'} {'terho_edge'} {'nerhozshift'} {'terhozshift'} {'profnerho'} {'profterho'} ... -% $$$ {'neft'} {'teft'} {'neftav'} {'teftav'} {'neft:trial'} {'teft:trial'} {'neftav:trial'} {'teftav:trial'} ... -% $$$ {'sxr'} {'sxr'} {'ece'} {'mpx'} {'ioh'} {'vloop'} {'pgyro'} {'jtor'} {'vi_tor'} {'vi_torfit'} {'vi_pol'} {'vi_polfit'} {'ti'} {'tifit'} {'ni'} {'nifit'} {'zeffcxrs'} {'zeffcxrsfit'}]; - % construct default output structure gdat_data.data = []; gdat_data.units = []; @@ -123,9 +116,7 @@ do_mdsopen_mdsclose = 1; if nargin>=1 if isempty(shot) % means mdsopen(shot) already performed -% $$$ shot = mdsipmex(2,'$SHOT'); -% $$$ gdat_data.shot = shot; - shot=0; + shot=-999; % means not defined do_mdsopen_mdsclose = 0; elseif isnumeric(shot) gdat_data.shot = shot; @@ -166,7 +157,6 @@ if nargin>=2 && ivarargin_first_char~=1 end end end - if ~isstruct(data_request) gdat_params.data_request = data_request_eff; end @@ -214,8 +204,6 @@ if length(data_request_eff)==1 else ij=[]; end -gdat_data.gdat_request = data_request_eff; - if ~isempty(ij); gdat_data.gdat_request = data_request_names_all{ij}; if isfield(data_request_names.all.(data_request_names_all{ij}),'description') && ~isempty(data_request_names.all.(data_request_names_all{ij}).description) @@ -230,9 +218,10 @@ if isfield(gdat_params,'shot') gdat_data.shot = gdat_params.shot; gdat_params=rmfield(gdat_params,'shot'); end + if ~isfield(gdat_params,'data_request') || isempty(gdat_params.data_request) % warning('input for ''data_request'' missing from input arguments') % might be correct, asking for list of requests - error_status=5; + error_status=5 return end gdat_data.gdat_params = gdat_params; @@ -248,6 +237,11 @@ error_status = 6; % at least reached this level mapping_for_aug = aug_requests_mapping(data_request_eff); gdat_data.label = mapping_for_aug.label; +% fill again at end to have full case, but here to have present status in case of early return +gdat_data.gdat_params.help = aug_help_parameters(fieldnames(gdat_data.gdat_params)); +gdat_data.mapping_for.aug = mapping_for_aug; +gdat_params = gdat_data.gdat_params; + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1st treat the simplest method: "signal" if strcmp(mapping_for_aug.method,'signal') @@ -288,7 +282,7 @@ if strcmp(mapping_for_aug.method,'signal') mapping_for_aug.timedim = find(size(aatmp.data)==length(aatmp.t)); if length(mapping_for_aug.timedim); mapping_for_aug.timedim = mapping_for_aug.timedim(1); end end - mapping_for_aug.gdat_timedim = mapping_for_aug.timedim + mapping_for_aug.gdat_timedim = mapping_for_aug.timedim; end if length(size(aatmp.data))==1 | (length(size(aatmp.data))==2 & size(aatmp.data,2)==1) gdat_data.dim=[{aatmp.t}]; diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m index 1ad7e662b7bcb4d3d269edd6dd3d009392838423..b4fc6be14b5e073a8ffe6ba835465f2406e157a6 100644 --- a/crpptbx/TCV/gdat_tcv.m +++ b/crpptbx/TCV/gdat_tcv.m @@ -82,12 +82,6 @@ if ~isempty(data_request_names.tcv) end data_request_names_all = fieldnames(data_request_names.all); -% $$$ data_request_names_all= [{'ip'} {'b0'} {'zmag'} {'rmag'} {'rcont'} {'zcont'} {'vol'} {'rhovol'} {'qrho'} {'q95'} {'kappa'} ... -% $$$ {'delta'} {'deltatop'} {'deltabot'} {'neint'} {'nel'} ... -% $$$ {'ne'} {'te'} {'nerho'} {'terho'} {'ne_edge'} {'te_edge'} {'nerho_edge'} {'terho_edge'} {'nerhozshift'} {'terhozshift'} {'profnerho'} {'profterho'} ... -% $$$ {'neft'} {'teft'} {'neftav'} {'teftav'} {'neft:trial'} {'teft:trial'} {'neftav:trial'} {'teftav:trial'} ... -% $$$ {'sxr'} {'sxr'} {'ece'} {'mpx'} {'ioh'} {'vloop'} {'pgyro'} {'jtor'} {'vi_tor'} {'vi_torfit'} {'vi_pol'} {'vi_polfit'} {'ti'} {'tifit'} {'ni'} {'nifit'} {'zeffcxrs'} {'zeffcxrsfit'}]; - % construct default output structure gdat_data.data = []; gdat_data.units = []; @@ -218,7 +212,11 @@ end data_request_eff = gdat_params.data_request; % in case was defined in pairs % if it is a request_keyword copy it: -ij=strmatch(data_request_eff,data_request_names_all,'exact'); +if length(data_request_eff)==1 + ij=strmatch(data_request_eff,data_request_names_all,'exact'); +else + ij=[]; +end if ~isempty(ij); gdat_data.gdat_request = data_request_names_all{ij}; if isfield(data_request_names.all.(data_request_names_all{ij}),'description') && ~isempty(data_request_names.all.(data_request_names_all{ij}).description) @@ -233,6 +231,7 @@ if isfield(gdat_params,'shot') gdat_data.shot = gdat_params.shot; gdat_params=rmfield(gdat_params,'shot'); end + if ~isfield(gdat_params,'data_request') || isempty(gdat_params.data_request) % warning('input for ''data_request'' missing from input arguments') % might be correct, asking for list of requests error_status=5; diff --git a/crpptbx/gdat.m b/crpptbx/gdat.m index 64692c2fe94fbbcc95f69bafc50c02cb4994f7ce..7291d3ce9c55d90ef24de14dc5c51755ed7fb378 100644 --- a/crpptbx/gdat.m +++ b/crpptbx/gdat.m @@ -94,7 +94,7 @@ machine_eff = default_machine; % do not treat inputs here but in subsequent gdat_machine.m function, however, need to extract machine name if provided: if nargin>=2 % need at least 2 inputs to have 'machine','aug' as arguments (to ask specific list of requests) % in case start directly with pairs of options - if ischar(shot) && ischar(data_request) + if ischar(shot) && strcmp(lower(shot),'machine') && ischar(data_request) machine_eff = data_request; elseif isstruct(shot) && isfield(shot,'machine') machine_eff = shot.machine; @@ -163,22 +163,37 @@ try else eval(['[gdat_data,gdat_params,error_status,varargout] = gdat_' lower(machine_eff) '(shot,data_request,varargin_eff{:});']); end -catch +catch ME_gdat warning(['problems calling gdat_' lower(machine_eff)]); if ~exist('gdat_data'); gdat_data.data = []; end if ~isfield(gdat_data,'dim'); gdat_data.dim=[]; end if ~exist('gdat_params'); gdat_params.plot = []; end if ~exist('error_status'); error_status = 998; end + if exist('ME_gdat') + rethrow(ME_gdat) + end return end gdat_data.gdat_call = gdat_call; if gdat_data.gdat_params.doplot - % plot gdat_data versus 1st dim by default, if nb_dims<=2, otherwise do not plot - if length(varargout)==0 || isempty(varargout{1}) - varargout{1} = gdat_plot(gdat_data); % return handle to figure - else - varargout{end+1} = gdat_plot(gdat_data); % return handle to figure + try + % plot gdat_data versus 1st dim by default, if nb_dims<=2, otherwise do not plot + hhh = gdat_plot(gdat_data); % return handle to figure + catch ME_gdat_plot + hhh = []; end +5 + if nargout >=3 + if length(varargout)==0 || isempty(varargout{1}) + varargout{1} = hhh; + else + varargout{end+1} = hhh; + end + end +end + +if exist('ME_gdat_plot') + rethrow(ME_gdat_plot) end