From 520fb4e245636392423e558f189efa68deba68b7 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Mon, 26 Jun 2017 15:41:14 +0000
Subject: [PATCH] add Prad and pellet times in requests for AUG

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@7634 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/AUG/aug_requests_mapping.m | 10 ++++++++++
 crpptbx/AUG/gdat_aug.m             | 21 ++++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/crpptbx/AUG/aug_requests_mapping.m b/crpptbx/AUG/aug_requests_mapping.m
index c0131595..92f32ef1 100644
--- a/crpptbx/AUG/aug_requests_mapping.m
+++ b/crpptbx/AUG/aug_requests_mapping.m
@@ -238,6 +238,11 @@ switch lower(data_request)
 		    'gdat_tmp.data = gdat_tmp.data./(tmp_data2+1e-5);'];
  case 'ni'
   mapping.method = 'switchcase'; % especially since might have option fit, etc
+ case 'pellet'
+  mapping.timedim = 1;
+  mapping.label = 'line integrated el. density';
+  mapping.method = 'signal';
+  mapping.expression = [{'PEL'},{'5Co'},{'AUGD'}];
  case 'pgyro'
   mapping.timedim = 1;
   mapping.label = 'EC gyros';
@@ -246,6 +251,11 @@ switch lower(data_request)
   mapping.timedim = 1;
   mapping.label = 'various powers';
   mapping.method = 'switchcase';
+ case {'prad', 'p_rad'}
+  mapping.timedim = 1;
+  mapping.label = 'P_{rad}';
+  mapping.method = 'signal';
+  mapping.expression = [{'BPD'},{'Pradtot'},{'AUGD'}];
  case 'psi_axis'
   mapping.timedim = 1;
   mapping.method = 'switchcase'; % there is psi_axis-psi_edge in FPG but otherwise complicated to get from equil, thus needs swticth case
diff --git a/crpptbx/AUG/gdat_aug.m b/crpptbx/AUG/gdat_aug.m
index 1a251077..0c3bc45a 100644
--- a/crpptbx/AUG/gdat_aug.m
+++ b/crpptbx/AUG/gdat_aug.m
@@ -1465,7 +1465,7 @@ elseif strcmp(mapping_for_aug.method,'switchcase')
 
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    case {'powers'}
-    sources_avail = {'ohm','ec','nbi','ic'}; % note should allow ech, nbh, ohmic in parameter sources
+    sources_avail = {'ohm','ec','nbi','ic','rad'}; % note should allow ech, nbh, ohmic in parameter sources
     for i=1:length(sources_avail)
       gdat_data.(sources_avail{i}).data = [];
       gdat_data.(sources_avail{i}).units = [];
@@ -1601,6 +1601,25 @@ elseif strcmp(mapping_for_aug.method,'switchcase')
 	gdat_data.label{end+1}='P_{ic}';
       end
     end
+    if any(strmatch('rad',gdat_data.gdat_params.source))
+      % radiated power
+      params_eff.data_request='prad';
+      try
+	rad=gdat_aug(shot,params_eff);
+      catch
+      end
+      if ~isempty(rad.data) && ~isempty(rad.dim)
+	for i=1:length(fields_to_copy)
+	  if isfield(rad,fields_to_copy{i})
+	    gdat_data.rad.(fields_to_copy{i}) = rad.(fields_to_copy{i});
+	  end
+	end
+        % add to main with linear interpolation and 0 for extrapolated values
+	gdat_data.data(:,end+1) = interpos(-21,gdat_data.rad.t,gdat_data.rad.data,gdat_data.t);
+	gdat_data.x(end+1) =gdat_data.x(end)+1;
+	gdat_data.label{end+1}='P_{rad}';
+      end
+    end
     % add tot power
     gdat_data.data(:,end+1) = sum(gdat_data.data,2);
     gdat_data.label{end+1}='P_{tot}';
-- 
GitLab