function gdatpaths(remove)
%
% add paths for gdat directory
%
% assumes gdat already available
%
if nargin < 1
  remove = false;
end

a=which('gdat');
if isempty(a), error('gdat is not in the MATLAB path'); end
a = fileparts(a);

% machines=[{'JET'} {'TCV'} {'AUG'} {'D3D'}];
% machines=[{'JET'} {'TCV'} {'AUG'} {'KSTAR'}];
machines=[{'JET'} {'TCV'} {'AUG'} {'D3D'} {'KSTAR'} {'TCV_IMAS'} {'AUG_IMAS'}];

add_paths = cell(1,length(machines));
for i=1:length(machines)
  add_paths{i}=fullfile(a,machines{i});
end
if ~remove
  addpath(add_paths{:});
else
  rmpath(add_paths{:});
end
