From 32dcc90e4884badcb1351d161994ca656ab68482 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Wed, 17 Sep 2014 21:22:47 +0000
Subject: [PATCH] to have same nerho as nerho

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4547 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/loadTCVdata.m | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/crpptbx/TCV/loadTCVdata.m b/crpptbx/TCV/loadTCVdata.m
index 0d6b4232..95954bae 100644
--- a/crpptbx/TCV/loadTCVdata.m
+++ b/crpptbx/TCV/loadTCVdata.m
@@ -804,16 +804,38 @@ switch TCVkeywrdcase{index}
   case {'nerhozshift','terhozshift'}
     % ne or Te from Thomson data on rho=sqrt(psi_normalised) mesh: (rho,t)
     % allow for z shift of equil
-    if  nargin>=2 & ~isempty(varargin{1})
+    if  nargin>=3 & ~isempty(varargin{1})
       zshift=varargin{1};
     else
       zshift=0.;
     end
     mdsopen(shot);
+    time=mdsdata('\results::thomson:times');
     if strcmp(TCVkeywrdcase{index},'nerhozshift')
       nodenameeff='\results::thomson:ne';
       tracetdi=tdi(nodenameeff);
       tracestd=tdi('\results::thomson:ne:error_bar');
+      if shot>=23801
+        tracefirrat=tdi('\results::thomson.profiles.auto:fir_thom_rat'); %time base not same!!
+        if isempty(tracefirrat.data) || ischar(tracefirrat.data)
+          disp('problem with \results::thomson.profiles.auto:fir_thom_rat: empty')
+        end
+      else
+        tracefirrat=tdi('\results::thomson:fir_thom_rat');
+        if isempty(tracefirrat.data) || ischar(tracefirrat.data)
+          disp('problem with \results::thomson.profiles.auto:fir_thom_rat: empty')
+          tracefirrat.dim{1}=[];
+        else
+          tracefirrat.dim{1}=time;
+        end
+      end
+      if ~isempty(tracefirrat.data) || ischar(tracefirrat.data)
+        tracefirrat_data=NaN*ones(size(tracetdi.dim{1}));
+        itim=iround(time,tracefirrat.dim{1});
+        tracefirrat_data(itim)=tracefirrat.data;
+      else
+        tracefirrat_data=NaN;
+      end
     else
       nodenameeff='\results::thomson:te';
       tracetdi=tdi(nodenameeff);
@@ -821,9 +843,13 @@ switch TCVkeywrdcase{index}
     end
     trace.data=tracetdi.data'; % Thomson data as (t,z)
     trace.std=tracestd.data';
+    if strcmp(TCVkeywrdcase{index},'nerhozshift')
+      trace.firrat=tracefirrat_data;
+      trace.data_abs=trace.data*diag(tracefirrat_data);
+      trace.std_abs=trace.std*diag(tracefirrat_data);
+    end
     trace.name=[num2str(shot) ';' nodenameeff];
     % add correct dimensions
-    time=mdsdata('\results::thomson:times');
     % construct rho mesh
     if strcmp(endstr,'_-1')
       error(['in ' TCVkeywrdcase{index} ' endstr should not be ' endstr]);
-- 
GitLab