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

no need as rdaAUG_eff.m to use, otherwise conflicts in paths

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1879 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 4edea527
No related branches found
No related tags found
No related merge requests found
function [data,x,time,hsig,error]=rda_eff(shot,pftype,tracename,varargin);
%
% gets data using RDA or mdsplus
% 1D arrays: assumes dimension is time
% 2D arrays: assumes data vs (x,time)
% 3D arrays: assumes data vs (x,time,hsig) (for mdsplus)
%
% varargin{1}: time interval or timevalue, will get data closest to that time or within that time interval
% (DOES NOT WORK YET)
%
% examples:
% [data,x,time,hsig,error]=rda_eff(51994,'ppf','efit/xip');
% [data,x,time,hsig,error]=rda_eff(52206,'ppf','equi/rmji?uid=jetthg+seq=122');
%
% set global variable: usemdsplus to decide if RDA or mdsplus is used:
% >> global usemdsplus
% >> usemdsplus=1 % means use mds to get data (default if not defined)
% >> usemdsplus=0 % means use jetreaddata routine (RDA)
% if ~exist('usemdsplus'); usemdsplus=1; end
%
global usemdsplus
if isempty(usemdsplus); usemdsplus=1; end
time_int=[];
if nargin>=4 & ~isempty(varargin{1})
time_int=varargin{1};
end
if usemdsplus
% use mdsplus
if ~unix('test -d /home/duval/mdsplus')
addpath('/home/duval/mdsplus')
end
mdsconnect('mdsplus.jet.efda.org');
% defines trace to fetch
% after '?' specific details
separator='+';
mainseparator='?';
imaintrace=findstr(mainseparator,tracename);
if isempty(imaintrace)
maintrace=tracename;
uid=[];
seq=[];
diag=[];
else
maintrace=tracename(1:imaintrace-1);
rest=tracename(imaintrace+1:end);
% gets uid if any
iuid=findstr('uid=',rest);
if isempty(iuid)
uid=[];
else
ii=findstr(separator,rest(iuid:end));
if isempty(ii)
uid=rest(iuid+4:end);
else
uid=rest(iuid+4:iuid+ii(1)-2);
end
end
% gets seq if any
iseq=findstr('seq=',rest);
if isempty(iseq)
seq=[];
else
ii=findstr(separator,rest(iseq:end));
if isempty(ii)
seq=rest(iseq+4:end);
else
seq=rest(iseq+4:iseq+ii(1)-2);
end
end
% gets diag if any
idiag=findstr('diag=',rest);
if isempty(idiag)
diag=[];
else
ii=findstr(separator,rest(idiag:end));
if isempty(ii)
diag=rest(idiag+5:end);
else
diag=rest(idiag+5:idiag+ii(1)-2);
end
end
end
% fetch value
if ~isempty(uid)
eval(['u=mdsvalue(''_sig=ppfuid("' uid '")'');'])
end
traceeff=[pftype '/' maintrace];
if ~isempty(seq)
traceeff=[traceeff '/' num2str(seq)];
end
user=getenv('USER');
eval(['[data,error]=mdsvalue(''_rdaeff' user '=jet("' traceeff '",' num2str(shot) ')'');'])
hsig=[];
ss=size(data);
nbofdim=length(ss);
if ss(end)==1; nbofdim=nbofdim-1; end
nbofdim=max(nbofdim,1);
switch nbofdim
case 1
eval(['time=mdsvalue(''dim_of(_rdaeff' user ',0)'');']);
x=[];
case 2
eval(['x=mdsvalue(''dim_of(_rdaeff' user ',0)'');']);
eval(['time=mdsvalue(''dim_of(_rdaeff' user ',1)'');']);
case 3
eval(['x=mdsvalue(''dim_of(_rdaeff' user ',0)'');']);
eval(['time=mdsvalue(''dim_of(_rdaeff' user ',1)'');']);
disp('3rd dimension in hsig!!!!!!!!!!!!!!!!!!!!!!!!!')
eval(['hsig=mdsvalue(''dim_of(_rdaeff' user ',2)'');']);
otherwise
disp([' more than 3 dimensions for ' num2str(shot) ' ; ' pftype '/' tracename])
error('in rda_eff')
end
mdsdisconnect;
if ~unix('test -d /home/duval/mdsplus')
rmpath('/home/duval/mdsplus')
end
else
% use RDA
[a,time,x,hsig,error]=jetreaddata(['http://data.jet.uk/' pftype '/' num2str(shot) '/' tracename]);
% transpose data as output in C format, reversed from Fortran and matlab standard
ss=size(a);
nbofdim=length(ss);
if ss(end)==1; nbofdim=nbofdim-1; end
nbofdim=max(nbofdim,1);
if nbofdim==1
data=a;
else
data=a';
end
end
% to prevent problems when trace empty and time become string
if ischar(time)
time=[];
end
if ischar(x)
x=[];
end
if isempty(x) & ~isempty(data) & data==0
data=[];
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