gdat tutorial: some basic calls and functionalities
gdat calls in fact the main function MACHINE/gdat_machine.m within the gdat folder gdat can be call with one of the available "data_request" keyword or with a full trace_name
The basic call is: data_out_struct = gdat(shot,data_request,'option1',option1_val,...);
But sub-cases are also valid and explained below
Contents
getting the list of available predefined data_request names
gdat_data = gdat; % % This is the simplest call and returns 3 useful information: gdat_data.gdat_request % contains the list of available data_request names gdat_data.gdat_params % contains the list of basic parameters, including : gdat_data.gdat_params.machine % the (default) machine name % % in addition gdat_data.gdat_call % always contains the string so that the same gdat call can be performed (using eval(), see below)
ans =
'a_minor'
'b0'
'beta'
'betan'
'betap'
'cxrs'
'delta'
'delta_bottom'
'delta_top'
'ece'
'eqdsk'
'halpha'
'ioh'
'ip'
'kappa'
'mhd'
'ne'
'neint'
'nel'
'ne_rho'
'nete_rho'
'psi_axis'
'psi_edge'
'powers'
'q0'
'q95'
'qedge'
'q_rho'
'rgeom'
'rhotor_edge'
'rhotor'
'rhovol'
'rmag'
'sxr'
'te'
'te_rho'
'vloop'
'volume'
'volume_rho'
'zeff'
'zgeom'
'zmag'
ans =
data_request: ''
machine: 'tcv'
doplot: 0
liuqe: 1
nverbose: 1
help: [1x1 struct]
ans =
tcv
ans =
gdat; % nargout = 1
list of data_request names for a specific machine
gdat_data = gdat('machine','aug'); gdat_data.gdat_request
ans =
''
a simple example: get plasma current
gdat_data = gdat(48836,'ip'); % shot number is for TCV (default machine if run at CRPP) gdat_data = gdat(48836,'ip','doplot',1); gdat_data = gdat(48836,'Ip'); % Note that the return data_request name is 'ip', since lower case is used throughout gdat_data.gdat_request
ans = ip
a 2D example with Te profiles
gdat_data = gdat(48836,'te'); % return thomson data, thus versus Z (vertical height) of local measurements gdat_data = gdat(48836,'te','doplot',1); % default plot is always versus time, using gdat_data.t % for more specific plots, use gdat_plot(gdat_data,...) function
Explaination of main fields
gdat_data = gdat(48836,'te'); gdat_data % The following fields are always present: % gdat_data.data % (as well as .units) providing the data % gdat_data.dim % (as well as .dimunits) providing the coordinates % gdat_data.t % corresponding to the time coordinate (copied from dim{timecoord}) % gdat_data.x % all coordinates but time (typically radial if 2D signal or channel number) % gdat_data.shot % gdat_data.gdat_request % gdat_data.gdat_params % gdat_data.data_fullpath % provides information on tracename origin within the database % gdat_data.gdat_call % string corresponding to the current call to gdat % Some extra fields might be present: % gdat_data.label % usually present, used as label in plots % gdat_data.error_bar % error_bars to be used in errorbar plot e.g: errorbar(gdat_data.x,gdat_data.data(:,20),gdat_data.error_bar(:,20),'*-') % gdat_data.mapping_for_tcv % information used to fetch the data, % contains information on the time index, useful for multi-D data %
gdat_data =
data: [23x49 double]
units: 'eV'
dim: {2x1 cell}
dimunits: {2x1 cell}
t: [49x1 double]
x: [23x1 double]
shot: 48836
gdat_request: 'te'
gdat_params: [1x1 struct]
data_fullpath: '\results::thomson:te; error_bar'
request_description: 'Electron temperature'
label: 'Te'
mapping_for: [1x1 struct]
error_bar: [23x49 double]
gdat_call: 'gdat(48836,'te'); % nargout = 1'
Explanation of basic parameters fields of gdat_params
gdat_data = gdat(48836,'te'); disp(' ');disp('after "te"');disp(' gdat_data.gdat_params:');disp(gdat_data.gdat_params) % at this stage contains few elements, will depend on specific data_request % % gdat_params should contain all the information necessary to recall gdat % and get the same information, except the shot number, thus % gdat_data2 = gdat(48836,gdat_data.gdat_params); % should return the same values. This allows to quickly load the similar data from different shot shotlist=[48836, 48837, 48839]; for ishot=1:length(shotlist) gdat_data_te{ishot} = gdat(shotlist(ishot),gdat_data.gdat_params); end gdat_plot(gdat_data_te{3}); % % In some cases we can see the various options after a first call, where % defaults are set: gdat_data = gdat(48836,'eqdsk'); disp(' ');disp('after "eqdsk"');disp(' gdat_data.gdat_params:');disp(gdat_data.gdat_params) % shows that 'time' should be given (can be an array) and 'zshift' (to shift vertically to zaxis=0 if 'zshift',1 is provided % It also show you can give the cocos out you want, for example for CHEASE type coordinates you would do: % gdat_data = gdat(48836,'eqdsk','cocos',2); % (see O. Sauter and S. Y Medvedev, Tokamak Coordinate Conventions: COCOS , Comput. Phys. Commun. 184 (2013) 293 ) % % gdat_params contains a sub-structure "help" which contains explanations % for the respective optional parameter specified in the gdat_params structure % In this case we have: disp(' ');disp('after "eqdsk"');disp(' gdat_data.gdat_params.help:');disp(gdat_data.gdat_params.help)
after "te"
gdat_data.gdat_params:
data_request: 'te'
machine: 'tcv'
doplot: 0
liuqe: 1
nverbose: 1
help: [1x1 struct]
edge: 0
Wrote /tmp/sauter/EQDSK_48836t1.0000_COCOS17
Wrote /tmp/sauter/EQDSK_48836t1.0000_COCOS17_IpB0positive
after "eqdsk"
gdat_data.gdat_params:
data_request: 'eqdsk'
machine: 'tcv'
doplot: 0
liuqe: 1
nverbose: 1
help: [1x1 struct]
time: 1
zshift: 0
cocos: 17
after "eqdsk"
gdat_data.gdat_params.help:
data_request: 'automatically filled in by gdat, name of request used i...'
machine: 'machine name like 'TCV', 'AUG', case insensitive'
doplot: '0 (default), if 1 calls gdat_plot for a new figure, -1 ...'
liuqe: 'liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. ...'
nverbose: '1 (default) displays warnings, 0: only errors, >=3: dis...'
time: 'time(s) value(s) if relevant, for example eqdsk is prov...'
zshift: 'vertical shift of equilibrium, either for eqdsk or for ...'
cocos: 'cocos value desired in output, uses eqdsk_cocos_transfo...'