load_externaldata_HL2A

PURPOSE ^

SYNOPSIS ^

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

DESCRIPTION ^

 This function loads data from HL-2A 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_HL2A(external_in,opt_gui)%(workdir,shotnum,shotime,t1,t2,opt_gui,dummy)
0002 %
0003 % This function loads data from HL-2A 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 = 'HL2A';
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,5-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,'profiles_',shotnum,'.',shotime,'.mat'];
0093 %
0094 if exist(filename,'file'),
0095     external.equil.prof = load([workdir,'profiles_',shotnum,'.',shotime,'.mat']);
0096 else
0097     error(['The file profiles_',shotnum,'.',shotime,'.mat is missing in the directory ',workdir]);
0098 end
0099 %
0100 filename = [workdir,'species_',shotnum,'.',shotime,'.mat'];
0101 %
0102 if exist(filename,'file'),
0103     external.equil.prof.species = load([workdir,'species_',shotnum,'.',shotime,'.mat']);
0104 else
0105     error(['The file species_',shotnum,'.',shotime,'.mat is missing in the directory ',workdir]);
0106 end
0107 %
0108 filename = [workdir,'LH_antenna_3p70Ghz_',shotnum,'.',shotime,'.mat'];
0109 %
0110 if exist(filename,'file'),
0111     external.wave.LH.antenna_3p70Ghz = load([workdir,'LH_antenna_3p70Ghz_',shotnum,'.',shotime,'.mat']);
0112 else
0113     disp(['--> WARNING: The file LH_antenna_3p70Ghz_',shotnum,'.',shotime,'.mat does not exist in the directory ',workdir]);
0114 end
0115 %
0116 filename = [workdir,'aloha_',shotnum,'.',shotime,'.mat'];
0117 if exist(filename,'file'),
0118     aloha = load([workdir,'aloha_',shotnum,'.',shotime,'.mat']);
0119     external.wave.antenna.aloha.results = aloha.scenario.results;
0120     external.wave.antenna.aloha.plasma = aloha.scenario.plasma;
0121     external.wave.antenna.aloha.options = aloha.scenario.options;
0122 else
0123     disp(['--> WARNING: The file aloha_',shotnum,'.',shotime,'.mat does not exist in the directory ',workdir]);
0124 end
0125 %
0126 filename = [workdir,'EC_mirror_68Ghz_',shotnum,'.',shotime,'.mat'];
0127 %
0128 if exist(filename,'file'),
0129     external.wave.EC.mirror_68Ghz = load([workdir,'EC_mirror_68Ghz_',shotnum,'.',shotime,'.mat']);
0130 else
0131     disp(['--> WARNING: The file EC_mirror_68Ghz_',shotnum,'.',shotime,'.mat does not exist in the directory ',workdir]);
0132 end
0133 %
0134 filename = [workdir,'EC_mirror_140Ghz_',shotnum,'.',shotime,'.mat'];
0135 %
0136 if exist(filename,'file'),
0137     external.wave.EC.mirror_140Ghz = load([workdir,'EC_mirror_140Ghz_',shotnum,'.',shotime,'.mat']);
0138 else
0139     disp(['--> WARNING: The file EC_mirror_140Ghz_',shotnum,'.',shotime,'.mat does not exist in the directory ',workdir]);
0140 end
0141 %
0142 filename = [workdir,'vloop_',shotnum,'.',shotime,'.mat'];
0143 %
0144 if exist(filename,'file'),
0145     external.ohm = load([workdir,'vloop_',shotnum,'.',shotime,'.mat']);
0146 else
0147     disp(['--> WARNING: The file vloop_',shotnum,'.',shotime,'.mat does not exist in the directory ',workdir]);
0148 end
0149 %
0150 external.id = [basestr,'_',shotnum,'_',shotime]; 
0151 %
0152 if isnan_jd(external,0),
0153     disp('Warning : NaNs were found in the structure ''external'' : ')
0154     isnan_jd(external,1),
0155 end
0156 %

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