load_externaldata_EAST

PURPOSE ^

SYNOPSIS ^

function external = load_externaldata_EAST(external_in,opt_gui)%(workdir,shotnum,shotime,t1,t2,opt_gui,dummy)

DESCRIPTION ^

 This function loads data from EAST database

 INPUTS : 
   - if nargin == 0, return default external_in to be modified interactively in iload_externaldata_jd

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function external = load_externaldata_EAST(external_in,opt_gui)%(workdir,shotnum,shotime,t1,t2,opt_gui,dummy)
0002 %
0003 % This function loads data from EAST database
0004 %
0005 % INPUTS :
0006 %   - if nargin == 0, return default external_in to be modified interactively in iload_externaldata_jd
0007 
0008 %   - external_in : input structure.
0009 %   - opt_gui     : option for GUI within function (interactive mode only)
0010 %
0011 %
0012 if nargin == 0,
0013     %
0014     % default values
0015     %
0016     external.workdir = '';
0017     external.shotnum = 0;
0018     external.shotime = 0;
0019     %
0020     % description & user halp
0021     %
0022     external.info.workdir = 'directory for source files';
0023     external.info.shotnum = 'Shot number';
0024     external.info.shotime = 'Shot time (s)';
0025     %
0026     % expert mode
0027     %
0028     external.expert.workdir = 0;
0029     external.expert.shotnum = 0;
0030     external.expert.shotime = 0;
0031     %
0032     % range of values
0033     %
0034     external.values.workdir = '';
0035     external.values.shotnum = [0;Inf];
0036     external.values.shotime = [0;Inf];
0037     %
0038     return
0039     %
0040 end
0041 %
0042 if nargin < 2,
0043     opt_gui = false;
0044 end
0045 %
0046 workdir = external_in.workdir;
0047 shotnum = external_in.shotnum;
0048 shotime = external_in.shotime;
0049 %
0050 % ******************************************************************
0051 %
0052 external = '';
0053 basestr = 'EAST';
0054 %
0055 if ~isempty(workdir) && workdir(end) ~= filesep,
0056     workdir = [workdir,filesep];
0057 end
0058 %
0059 shotnum = num2str(shotnum);
0060 %
0061 external.basestr = basestr;
0062 external.shotnum = shotnum;
0063 external.shotime = shotime;
0064 %
0065 if ~ischar(shotime),
0066     shotime = num2str(round(shotime));
0067 end
0068 %
0069 shotnum = [repmat('0',[1,6-length(shotnum)]),shotnum];
0070 shotime = [repmat('0',[1,6-length(shotime)]),shotime];
0071 %
0072 filename = [workdir,'jbdirections_',shotnum,'_',shotime,'.mat'];
0073 %
0074 if exist(filename,'file'),
0075     external.equil = load([workdir,'jbdirections_',shotnum,'_',shotime,'.mat']);
0076     display([' --> Ip direction is ',external.equil.jbdirections.Ip]);
0077     display([' --> Bt direction is ',external.equil.jbdirections.Bt]);
0078 else
0079     error(['The file jbdirections_',shotnum,'_',shotime,'.mat is missing in the directory ',workdir]);
0080 end
0081 %
0082 filename = [workdir,'g',shotnum,'.',shotime];
0083 %
0084 if exist(filename,'file'),
0085     external.equil.magnetic.eqdsk = fileread(filename);
0086     external.equil.shotnum = shotnum;
0087     external.equil.shotime = shotime;
0088 else
0089     error(['The EQDSK file g',shotnum,'.',shotime,' is missing in the directory ',workdir]);
0090 end
0091 %
0092 filename = [workdir,'thomson_',shotnum,'_',shotime,'.mat'];
0093 %
0094 if exist(filename,'file'),
0095     external.equil.thomson.prof = load([workdir,'thomson_',shotnum,'_',shotime,'.mat']);
0096 end
0097 %
0098 filename = [workdir,'profiles_',shotnum,'_',shotime,'.mat'];
0099 %
0100 if exist(filename,'file'),
0101     external.equil.prof = load([workdir,'profiles_',shotnum,'_',shotime,'.mat']);
0102 else
0103     error(['The file profiles_',shotnum,'_',shotime,'.mat is missing in the directory ',workdir]);
0104 end
0105 %
0106 filename = [workdir,'species_',shotnum,'_',shotime,'.mat'];
0107 %
0108 if exist(filename,'file'),
0109     external.equil.prof.species = load([workdir,'species_',shotnum,'_',shotime,'.mat']);
0110 else
0111     error(['The file species_',shotnum,'_',shotime,'.mat is missing in the directory ',workdir]);
0112 end
0113 %
0114 filename = [workdir,'LH_antenna_2p45Ghz_',shotnum,'_',shotime,'.mat'];
0115 %
0116 if exist(filename,'file'),
0117     external.wave.LH.antenna_2p45Ghz = load([workdir,'LH_antenna_2p45Ghz_',shotnum,'_',shotime,'.mat']);
0118 else
0119     disp(['--> WARNING: The file LH_antenna_2p45Ghz_',shotnum,'_',shotime,'.mat does not exist in the directory ',workdir]);
0120 end
0121 %
0122 filename = [workdir,'LH_antenna_4p60Ghz_',shotnum,'_',shotime,'.mat'];
0123 %
0124 if exist(filename,'file'),
0125     external.wave.LH.antenna_4p60Ghz = load([workdir,'LH_antenna_4p60Ghz_',shotnum,'_',shotime,'.mat']);
0126 else
0127     disp(['--> WARNING: The file LH_antenna_4p60Ghz_',shotnum,'_',shotime,'.mat does not exist in the directory ',workdir]);
0128 end
0129 %
0130 filename = [workdir,'EC_mirror_140Ghz_',shotnum,'_',shotime,'.mat'];
0131 %
0132 if exist(filename,'file'),
0133     external.wave.EC.mirror_140Ghz = load([workdir,'EC_mirror_140Ghz_',shotnum,'_',shotime,'.mat']);
0134 else
0135     disp(['--> WARNING: The file EC_mirror_140Ghz_',shotnum,'_',shotime,'.mat does not exist in the directory ',workdir]);
0136 end
0137 %
0138 filename = [workdir,'vloop_',shotnum,'_',shotime,'.mat'];
0139 %
0140 if exist(filename,'file'),
0141     external.ohm = load([workdir,'vloop_',shotnum,'_',shotime,'.mat']);
0142 else
0143     disp(['--> WARNING: The file vloop_',shotnum,'_',shotime,'.mat does not exist in the directory ',workdir]);
0144 end
0145 %
0146 external.id = [basestr,'_',shotnum,'_',shotime]; 
0147 %
0148 if isnan_jd(external,0),
0149     disp('Warning : NaNs were found in the structure ''external'' : ')
0150     isnan_jd(external,1),
0151 end
0152 %

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.