From bcbe091bc6dad566ee8c7cd1bd1b766cdc1f2422 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Thu, 31 Jan 2019 16:25:50 +0000
Subject: [PATCH] add ids request in gdat

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11384 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/gdat_tcv.m             | 25 +++++++++++++++++++++++++
 crpptbx/TCV/tcv_requests_mapping.m |  4 ++++
 2 files changed, 29 insertions(+)

diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m
index 7725d0be..03feb1f9 100644
--- a/crpptbx/TCV/gdat_tcv.m
+++ b/crpptbx/TCV/gdat_tcv.m
@@ -1077,6 +1077,31 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     end
     % '\base::pd:pd_001';
 
+    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+   case {'ids'}
+    params_eff = gdat_data.gdat_params;
+    if isfield(params_eff,'source') && ~isempty(params_eff.source)
+      ids_top_name = params_eff.source;
+    else
+      disp('need an ids name in ''source'' parameter')
+      return
+    end
+    try
+      equil_empty=ids_gen(ids_top_name);
+    catch
+      warning(['cannot create empty ids: ids_gen(''' ids_top_name ''')']);
+      return
+    end
+    try
+      eval(['[ids_top,ids_top_description]=tcv_get_ids_' ids_top_name '(shot,equil_empty);'])
+      gdat_data.(ids_top_name) = ids_top;
+      gdat_data.([ids_top_name '_description']) = ids_top_description;
+    catch 
+      disp(['check if function: tcv_get_ids_' ids_top_name ' exists in your path'])
+      gdat_data.(ids_top_name) = struct([]);
+      gdat_data.([ids_top_name '_description']) = struct([]);
+    end
+    
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    case {'icds'}
     % note: same time array for all at main.data level, then individual at .ec, .nbi levels
diff --git a/crpptbx/TCV/tcv_requests_mapping.m b/crpptbx/TCV/tcv_requests_mapping.m
index 033c0ca6..bb49d28a 100644
--- a/crpptbx/TCV/tcv_requests_mapping.m
+++ b/crpptbx/TCV/tcv_requests_mapping.m
@@ -135,6 +135,10 @@ switch lower(data_request)
   mapping.timedim = 1;
   mapping.label = 'various driven current';
   mapping.method = 'switchcase';
+ case 'ids'
+  mapping.timedim = 1;
+  mapping.label = 'ids ala imas';
+  mapping.method = 'switchcase';
  case 'ioh'
   mapping.timedim = 1;
   mapping.label = 'I ohmic transformer';
-- 
GitLab