Contents

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

At this stage, you need to do the following to test it:

addpath ~sauter/matlab/gdat_develop/crpptbx_new

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 = 

    'b0'
    'betan'
    'betap'
    'cxrs'
    'delta'
    'delta_bot'
    'delta_top'
    'ece'
    'eqdsk'
    'halpha'
    'ioh'
    'ip'
    'kappa'
    'mhd'
    'ne'
    'neint'
    'nel'
    'nerho'
    'neterho'
    'ni'
    'powers'
    'q0'
    'q95'
    'qedge'
    'qrho'
    'rgeom'
    'rhovol'
    'rmag'
    'sxr'
    'te'
    'terho'
    'ti'
    'transp'
    'vloop'
    'vol'
    'zeff'
    'zgeom'
    'zmag'


ans = 

    data_request: ''
         machine: 'tcv'
          doplot: 0


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 = 

    'b0'
    'betan'
    'betap'
    'cxrs'
    'delta'
    'delta_bot'
    'delta_top'
    'ece'
    'eqdsk'
    'halpha'
    'ioh'
    'ip'
    'kappa'
    'mhd'
    'ne'
    'neint'
    'nel'
    'nerho'
    'neterho'
    'ni'
    'powers'
    'q0'
    'q95'
    'qedge'
    'qrho'
    'rgeom'
    'rhovol'
    'rmag'
    'sxr'
    'te'
    'terho'
    'ti'
    'transp'
    'vloop'
    'vol'
    'zeff'
    'zgeom'
    'zmag'
    'equil'

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'
              label: 'Te'
          error_bar: [23x49 double]
    mapping_for_tcv: [1x1 struct]
          gdat_call: 'gdat(48836,'te'); % nargout = 1'

Explanation of basic parameters fields of gdat_params

gdat_data = gdat(48836,'te');
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});
ans = 

    data_request: 'te'
         machine: 'tcv'
          doplot: 0