From ee4e6667575b763736cedf4183857d4cda60cffb Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Wed, 2 Dec 2009 14:45:04 +0000
Subject: [PATCH] add extra load in case problem

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

diff --git a/TCV/loadTCVdata.m b/TCV/loadTCVdata.m
index 0f207fc3..99dec812 100644
--- a/TCV/loadTCVdata.m
+++ b/TCV/loadTCVdata.m
@@ -328,7 +328,7 @@ switch TCVkeywrdcase{index}
 % $$$       return
     end
     tracetdi=tdi(nodenameeff);
-    mdsclose
+    mdsclose;
     if isempty(tracetdi.data) | isnan(tracetdi.data)
       disp(['node ' nodenameeff ' is empty for shot = ' num2str(shot)])
       return
@@ -427,7 +427,7 @@ switch TCVkeywrdcase{index}
     if any(strcmp(fieldnames(tracetdi),'units'))
       trace.units=tracetdi.units;
     end
-    mdsclose('mdsip')
+    mdsclose('mdsip');
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'nerho','terho'}
@@ -437,6 +437,10 @@ switch TCVkeywrdcase{index}
     if strcmp(TCVkeywrdcase{index},'nerho')
       nodenameeff='\results::thomson:ne';
       tracetdi=tdi(nodenameeff);
+      if isempty(tracetdi.data)
+        ishot=mdsopen(shot)
+        tracetdi=tdi(nodenameeff)
+      end
       nodenameeff='\results::thomson:ne; error_bar ; fir_thom_rat; (ne,std)*fir_thom_rat';
       tracestd=tdi('\results::thomson:ne:error_bar');
       if shot>=23801
@@ -482,7 +486,7 @@ switch TCVkeywrdcase{index}
     if any(strcmp(fieldnames(tracetdi),'units'))
       trace.units=tracetdi.units;
     end
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'nerhozshift','terhozshift'}
@@ -548,7 +552,7 @@ switch TCVkeywrdcase{index}
     if any(strcmp(fieldnames(tracetdi),'units'))
       trace.units=tracetdi.units;
     end
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'profnerho','profterho'}
@@ -577,7 +581,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) '; Thomson autfits from ' nodenameeff ];
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'qrho'}
@@ -595,7 +599,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) ';' nodenameeff];
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'vol'}
@@ -628,7 +632,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) ';' nodenameeff liuqe_ext];
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'rhovol'}
@@ -658,7 +662,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) '; sqrt(V/Va) from ' nodenameeff liuqe_ext];
-    mdsclose
+    mdsclose;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'sxr','sxR'}
@@ -744,7 +748,7 @@ switch TCVkeywrdcase{index}
     if any(strcmp(fieldnames(tracetdi),'units'))
       trace.units=tracetdi.units;
     end
-    mdsclose
+    mdsclose;
     
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'MPX'
@@ -759,7 +763,7 @@ switch TCVkeywrdcase{index}
       mdsopen(shot);
       keyboard
       signal=get_mds_mio('MPX',[t_1 t_2]);
-      mdsclose
+      mdsclose;
       trace.data=signal.data;
       for i=1:size(signal.dim{2},2)
         trace.t(:,i)=signal.dim{1};
@@ -788,7 +792,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) ';' nodenameeff{1} ',' nodenameeff{2}];
-    mdsclose
+    mdsclose;
     error=0;
     
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
@@ -807,7 +811,7 @@ switch TCVkeywrdcase{index}
       trace.units=tracetdi.units;
     end
     trace.name=[num2str(shot) ';' nodenameeff{1} ',' nodenameeff{2}];
-    mdsclose
+    mdsclose;
     error=0;
     
   otherwise
-- 
GitLab