Skip to content
Snippets Groups Projects
Commit 4884521d authored by Olivier Sauter's avatar Olivier Sauter
Browse files

add Liuqe2 and 3 option and fix problems if data empty (for loadTCVdata onl;y)

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1826 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 240fd772
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
% 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{4}!) % 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{4}!)
% 'MPX' = soft x-ray from wire chambers % 'MPX' = soft x-ray from wire chambers
% %
% 'xx_2 or xx_3' for Liuqe2 or 3: same as above for xx related to equilibrium
%
% INPUT: % INPUT:
% shot: shot number % shot: shot number
% data_type: type of the required data % data_type: type of the required data
...@@ -44,6 +46,15 @@ ...@@ -44,6 +46,15 @@
% %
varargout{1}=cell(1,1); varargout{1}=cell(1,1);
error=1;
% some defaults
% nodes which have _2 and _3 equivalence
liuqe23=[{'\results::i_p'} {'\results::z_axis'} {'\results::r_axis'} {'\results::q_psi'} ...
{'\results::beta_tor'} {'\results::q_95'} {'\results::l_i'} {'\results::delta_95'} ...
{'\results::kappa_95'} {'\results::r_contour'} {'\results::z_contour'} {'\results::psi_axis'} ...
{'\results::thomson:psiscatvol'} {'\results::thomson:psi_max'} {'\results::psitbx:vol'}];
% all keywords and corresponding case to run below % all keywords and corresponding case to run below
TCVkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'sxr'} {'sxR'} {'ece'}]; TCVkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'sxr'} {'sxR'} {'ece'}];
...@@ -74,9 +85,13 @@ TCVsiglocation(TCVsig.irmag)={'\results::r_axis'}; ...@@ -74,9 +85,13 @@ TCVsiglocation(TCVsig.irmag)={'\results::r_axis'};
TCVsigtimeindx=ones(size(TCVkeywrdall)); TCVsigtimeindx=ones(size(TCVkeywrdall));
% find index of signal called upon % find index of signal called upon
i_23=0;
if strcmp(data_type(end-1:end),'_2') | strcmp(data_type(end-1:end),'_3')
i_23=2;
end
if strcmp(data_type(1:1),'\') if strcmp(data_type(1:1),'\')
% in case full node name was given % in case full node name was given
index=strmatch(data_type,TCVsiglocation,'exact'); index=strmatch(data_type(1:end-i_23),TCVsiglocation,'exact');
if isempty(index) if isempty(index)
disp('********************') disp('********************')
disp('trace not yet registered.') disp('trace not yet registered.')
...@@ -87,7 +102,7 @@ if strcmp(data_type(1:1),'\') ...@@ -87,7 +102,7 @@ if strcmp(data_type(1:1),'\')
index=length(TCVkeywrdall)+1; index=length(TCVkeywrdall)+1;
TCVkeywrdall(end+1)={'new'}; TCVkeywrdall(end+1)={'new'};
TCVkeywrdcase(end+1)={'simpletdi'}; TCVkeywrdcase(end+1)={'simpletdi'};
TCVsiglocation(end+1)={data_type}; TCVsiglocation(end+1)={data_type(1:end-i_23)};
TCVsigtimeindx(end+1)=0; TCVsigtimeindx(end+1)=0;
elseif ~strcmp(TCVkeywrdcase{index},'simpletdi') elseif ~strcmp(TCVkeywrdcase{index},'simpletdi')
msgbox(['Problem in loadTCVdata with data_type = ' data_type ... msgbox(['Problem in loadTCVdata with data_type = ' data_type ...
...@@ -95,10 +110,30 @@ if strcmp(data_type(1:1),'\') ...@@ -95,10 +110,30 @@ if strcmp(data_type(1:1),'\')
error('in loadTCVdata') error('in loadTCVdata')
end end
else else
index=strmatch(data_type,TCVkeywrdall,'exact'); index=strmatch(data_type(1:end-i_23),TCVkeywrdall,'exact');
if isempty(index)
disp(' ')
disp('********************')
disp(['no such keyword: ' data_type(1:end-i_23)])
disp(' ')
disp('Available keywords:')
TCVkeywrdall(:)
disp('********************')
trace.data=[];
trace.t=[];
trace.x=[];
return
end
end end
disp(['loading' ' ' data_type ' from TCV shot #' num2str(shot)]); disp(['loading' ' ' data_type ' from TCV shot #' num2str(shot)]);
disp(['case ' TCVkeywrdcase{index}]) disp(['case ' TCVkeywrdcase{index}])
if i_23==2 & isempty(strmatch(TCVsiglocation(index),liuqe23,'exact'))
disp('********')
disp('Warning asks for liuqe 2 or 3 of a signal, but not in liuqe23 list in loadTCVdata')
eval(['!mail -s ''' data_type ' ' num2str(shot) ' ' getenv('USER') ' TCV: not in liuqe23 list'' olivier.sauter@epfl.ch < /dev/null'])
disp('********')
end
status=ones(1,100); status=ones(1,100);
zmag=cell(0,0); zmag=cell(0,0);
nargineff=nargin; nargineff=nargin;
...@@ -127,8 +162,34 @@ switch TCVkeywrdcase{index} ...@@ -127,8 +162,34 @@ switch TCVkeywrdcase{index}
% load TCV other data % load TCV other data
mdsopen(shot); mdsopen(shot);
tracetdi=tdi(TCVsiglocation{index}); nodenameeff=TCVsiglocation{index};
if i_23==2
nodenameeff=[nodenameeff data_type(end-1:end)]
end
% test if node exists
error=1;
if eval(['~mdsdata(''node_exists("\' nodenameeff '")'')'])
disp(['node ' nodenameeff ' does not exist for shot = ' num2str(shot)])
trace.data=[];
trace.t=[];
trace.x=[];
return
elseif eval(['mdsdata(''getnci("\' nodenameeff ':foo","length")'')==0'])
disp(['no data for node ' nodenameeff ' for shot = ' num2str(shot)])
trace.data=[];
trace.t=[];
trace.x=[];
return
end
tracetdi=tdi(nodenameeff);
mdsclose(shot) mdsclose(shot)
if isempty(tracetdi.data) | isnan(tracetdi.data)
disp(['node ' nodenameeff ' is empty for shot = ' num2str(shot)])
trace.data=[];
trace.t=[];
trace.x=[];
return
end
trace.data=tracetdi.data; trace.data=tracetdi.data;
trace.t=tracetdi.dim{max(1,TCVsigtimeindx(index))}; trace.t=tracetdi.dim{max(1,TCVsigtimeindx(index))};
if length(tracetdi.dim)==2 if length(tracetdi.dim)==2
......
...@@ -12,7 +12,9 @@ function [trace,error,varargout] = gdat(shot,data_type,varargin) ...@@ -12,7 +12,9 @@ function [trace,error,varargout] = gdat(shot,data_type,varargin)
% %
% specific to TCV (see help loadTCVdata for more information) % specific to TCV (see help loadTCVdata for more information)
% 'MPX' = wire chambers with varargout{1} option (requires varargin{5}!) % 'MPX' = wire chambers with varargout{1} option (requires varargin{5}!)
% 'xx_2 or xx_3' for Liuqe2 or 3: same as above for xx related to equilibrium
% %
% JET
% Special case compatible with old gdat.m allows (JET related): gdat(51994,'ppf','efit/xip',1) % Special case compatible with old gdat.m allows (JET related): gdat(51994,'ppf','efit/xip',1)
% %
% INPUT: % INPUT:
...@@ -102,7 +104,7 @@ if doplot==1 ...@@ -102,7 +104,7 @@ if doplot==1
elseif doplot==-1 elseif doplot==-1
hold on hold on
if length(size(trace.data))<=2 if length(size(trace.data))<=2
plot(trace.t,trace.data); plot(trace.t,trace.data,'r');
else else
plot(trace.t,trace.data(:,:,1),'--'); plot(trace.t,trace.data(:,:,1),'--');
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment