From 0af0e8f89097460234f260d1232cddcf13b75aa1 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Fri, 28 Sep 2001 08:09:40 +0000
Subject: [PATCH] keywords needed for GUIprofs added and some others and
 tested, added also .dim and .dimunits

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1830 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 JET/loadJETdata.m | 10 +++---
 TCV/loadTCVdata.m | 90 ++++++++++++++++-------------------------------
 2 files changed, 35 insertions(+), 65 deletions(-)

diff --git a/JET/loadJETdata.m b/JET/loadJETdata.m
index c25503ce..0a8e25f9 100644
--- a/JET/loadJETdata.m
+++ b/JET/loadJETdata.m
@@ -192,7 +192,7 @@ disp(['case ' JETkeywrdcase{index}])
 disp(' ')
 switch JETkeywrdcase{index}
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'simplereaddata'
 
     ppftype=JETsiglocation{1,index};
@@ -224,7 +224,7 @@ switch JETkeywrdcase{index}
       trace.d=d;
     end
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {JETkeywrdall{JETsig.ine} , JETkeywrdall{JETsig.ite}}
     %  ne, te raw data from LIDR vs R,t. Add error bars
     ppftype='ppf';
@@ -242,7 +242,7 @@ switch JETkeywrdcase{index}
     clear error
     error=e;
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {JETkeywrdall{JETsig.inerho} , JETkeywrdall{JETsig.iterho}}
     %  ne, te on rho mesh. use lid2, thus need chain2 to have been run. Add error bars
     ppftype='ppf';
@@ -261,7 +261,7 @@ switch JETkeywrdcase{index}
     error=e;
 
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'sxr','sxR'}
     %  LOAD MULTI CHANNEL DATA    
     %  load JET soft x-ray data 
@@ -304,7 +304,7 @@ switch JETkeywrdcase{index}
       trace.dimunits=[{'time [s]'} ; {'channels'}];
     end
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'ece'
     starti=varargin{1}(1);
     endi=varargin{1}(2);
diff --git a/TCV/loadTCVdata.m b/TCV/loadTCVdata.m
index 16be9c7e..52240227 100644
--- a/TCV/loadTCVdata.m
+++ b/TCV/loadTCVdata.m
@@ -13,8 +13,8 @@
 % 'te'= Te raw profile on (z,t). ADD error bars in .std
 % 'nerho'= ne profile on (rho=sqrt(psi),time) mesh.Note rho is a 2D array as depends on time. ADD error bars in .std
 % 'terho'= Te profile on (rho=sqrt(psi),time) mesh.Note rho is a 2D array as depends on time. ADD error bars in .std
-% 'profnerho' =  ne smoothed or fitted with .std=error bars, vs (rho,t) (from Thomson fit)
-% 'profterho' =  te smoothed or fitted with .std=error bars, vs (rho,t) (from Thomson fit)
+% 'profnerho' =  ne smoothed or fitted , vs (rho,t) (from Thomson fit)
+% 'profterho' =  te smoothed or fitted , vs (rho,t) (from Thomson fit)
 % 'neft' =  ne fitted from data on rho mesh (from proffit.local_time:neft)
 % 'teft' =  te fitted from data on rho mesh (from proffit.local_time:teft)
 % 'neftav' =  ne fitted from averaged over time data on rho mesh (from proffit.avg_time:neft)
@@ -153,8 +153,6 @@ TCVkeywrdcase(TCVsig.ine)=TCVkeywrdall(TCVsig.ine); % special as dimensions from
 TCVkeywrdcase(TCVsig.ite)=TCVkeywrdall(TCVsig.ite); % idem
 TCVkeywrdcase(TCVsig.inerho)=TCVkeywrdall(TCVsig.inerho); % idem
 TCVkeywrdcase(TCVsig.iterho)=TCVkeywrdall(TCVsig.iterho); % idem
-TCVkeywrdcase(TCVsig.iprofnerho)=TCVkeywrdall(TCVsig.iprofnerho); % special as add .std
-TCVkeywrdcase(TCVsig.iprofterho)=TCVkeywrdall(TCVsig.iprofterho); % idem
 TCVkeywrdcase(TCVsig.isxr)=TCVkeywrdall(TCVsig.isxr);
 TCVkeywrdcase(TCVsig.isxR)=TCVkeywrdall(TCVsig.isxR);
 TCVkeywrdcase(TCVsig.iece)=TCVkeywrdall(TCVsig.iece);
@@ -174,11 +172,20 @@ TCVsiglocation(TCVsig.ircont)={'\results::r_contour'}; TCVsigtimeindx(TCVsig.irc
 TCVsiglocation(TCVsig.izcont)={'\results::z_contour'}; TCVsigtimeindx(TCVsig.izcont)=2;
 TCVsiglocation(TCVsig.ivol)={'\results::psitbx:vol'}; TCVsigtimeindx(TCVsig.ivol)=2;
 TCVsiglocation(TCVsig.ineint)={'\results::fir:lin_int_dens'};
+TCVsiglocation(TCVsig.iprofnerho)={'\results::th_prof_ne'};
+TCVsiglocation(TCVsig.iprofterho)={'\results::th_prof_te'};
 TCVsiglocation(TCVsig.ineft)={'\results::proffit.local_time:neft'}; TCVsigtimeindx(TCVsig.ineft)=2;
 TCVsiglocation(TCVsig.iteft)={'\results::proffit.local_time:teft'}; TCVsigtimeindx(TCVsig.iteft)=2;
 TCVsiglocation(TCVsig.ineftav)={'\results::proffit.avg_time:neft'}; TCVsigtimeindx(TCVsig.ineftav)=2;
 TCVsiglocation(TCVsig.iteftav)={'\results::proffit.avg_time:teft'}; TCVsigtimeindx(TCVsig.iteftav)=2;
 
+% initialize order of substructures and allows just a "return" if data empty
+trace.data=[];
+trace.x=[];
+trace.t=[];
+trace.dim=[];
+trace.dimunits=[];
+
 % find index of signal called upon
 if strcmp(data_type_eff(1:1),'\')
   % in case full node name was given
@@ -201,7 +208,7 @@ if strcmp(data_type_eff(1:1),'\')
     error('in loadTCVdata')
   end
 else
-  index=strmatch(data_type_eff(1:end-i_23),TCVkeywrdall,'exact');
+  index=strmatch(data_type_eff_noext,TCVkeywrdall,'exact');
   if isempty(index)
     disp(' ')
     disp('********************')
@@ -210,13 +217,10 @@ else
     disp('Available keywords:')
     TCVkeywrdall(:)
     disp('********************')
-    trace.data=[];
-    trace.t=[];
-    trace.x=[];
     return
   end
 end
-disp(['loading' ' ' data_type_eff ' from TCV shot #' num2str(shot)]);
+disp(['loading' ' ' data_type_eff_noext ' from TCV shot #' num2str(shot)]);
 disp(['case ' TCVkeywrdcase{index}])
 if i_23==2 & isempty(strmatch(TCVsiglocation(index),liuqe23,'exact'))
   disp('********')
@@ -247,7 +251,7 @@ end
 
 switch TCVkeywrdcase{index}
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'simpletdi'
 
     %  load TCV other data
@@ -257,34 +261,18 @@ switch TCVkeywrdcase{index}
     error=1;
     if eval(['~mdsdata(''node_exists("\' nodenameeff '")'')'])
       disp(['node ' nodenameeff ' does not exist for shot = ' num2str(shot)])
-      trace.data=[];
-      trace.x=[];
-      trace.t=[];
-      trace.dim=[];
-      trace.dimunits=[];
       return
     elseif eval(['mdsdata(''getnci("\' nodenameeff ':foo","length")'')==0'])
       disp(['no data for node ' nodenameeff ' for shot = ' num2str(shot)])
-      trace.data=[];
-      trace.x=[];
-      trace.t=[];
-      trace.dim=[];
-      trace.dimunits=[];
       return
     end
     tracetdi=tdi(nodenameeff);
     mdsclose(shot)
     if isempty(tracetdi.data) | isnan(tracetdi.data)
       disp(['node ' nodenameeff ' is empty for shot = ' num2str(shot)])
-      trace.data=[];
-      trace.x=[];
-      trace.t=[];
-      trace.dim=[];
-      trace.dimunits=[];
       return
     end
     trace.data=tracetdi.data;
-    trace.x=[]; % so that appears before trace.t in list of sub-structures
     if TCVsigtimeindx(index)>0
       trace.t=tracetdi.dim{TCVsigtimeindx(index)};
       ix=3-TCVsigtimeindx(index); % works only for 2D arrays
@@ -309,7 +297,6 @@ switch TCVkeywrdcase{index}
           'in simpletdi','warn')
       warning('in simpletdi of loadTCVdata')
     else
-      trace.x=[];
       if max(1,TCVsigtimeindx(index))~=1
         disp('Problems in loadTCVdata, max(1,TCVsigtimeindx(index)) should be 1')
       end
@@ -323,12 +310,10 @@ switch TCVkeywrdcase{index}
     else
       trace.dim=tracetdi.dim;
       trace.dimunits=tracetdi.dimunits;
-      trace.x=[];
-      trace.t=[];
     end
     error=0;
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'ne','te'}
     % ne or Te from Thomson data on raw z mesh vs (z,t)
     mdsopen(shot);
@@ -340,7 +325,7 @@ switch TCVkeywrdcase{index}
       tracestd=tdi('\results::thomson:te:error_bar');
     end
     trace.data=tracetdi.data'; % Thomson data as (t,z)
-    trace.std=tracestd.data;
+    trace.std=tracestd.data';
     % add correct dimensions
     time=mdsdata('\results::thomson:times');
     z=mdsdata('\diagz::thomson_set_up:vertical_pos');
@@ -350,7 +335,7 @@ switch TCVkeywrdcase{index}
     trace.t=time;
     mdsclose
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'nerho','terho'}
     % ne or Te from Thomson data on rho=sqrt(psi_normalised) mesh: (rho,t)
     mdsopen(shot);
@@ -362,7 +347,7 @@ switch TCVkeywrdcase{index}
       tracestd=tdi('\results::thomson:te:error_bar');
     end
     trace.data=tracetdi.data'; % Thomson data as (t,z)
-    trace.std=tracestd.data;
+    trace.std=tracestd.data';
     % add correct dimensions
     time=mdsdata('\results::thomson:times');
     % construct rho mesh
@@ -377,7 +362,7 @@ switch TCVkeywrdcase{index}
     trace.t=time;
     mdsclose
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'qrho'}
     % q profile on psi from liuqe
     mdsopen(shot);
@@ -389,30 +374,7 @@ switch TCVkeywrdcase{index}
     trace.dimunits=[{'sqrt(psi)'} ; {'time [s]'}];
     mdsclose
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
-  case {TCVkeywrdcase{TCVsig.iprofnerho},TCVkeywrdcase{TCVsig.iprofnerho}}
-    % Thomson profiles with error bars
-    mdsopen(shot);
-    if i_23==2
-      disp('cannot have profile on Liuqe>1, ask roland.behn@epfl.ch')
-      return
-    end
-    if strcmp(TCVkeywrdcase{index},TCVkeywrdcase{TCVsig.iprofnerho})
-      tracetdi=tdi('\results::th_prof_ne');
-      tracestd=tdi('\results::thomson:ne:error_bar');
-    else
-      tracetdi=tdi('\results::th_prof_te');
-      tracestd=tdi('\results::thomson:te:error_bar');
-    end
-    trace.data=tracetdi.data'; % Thomson data transposed
-    trace.x=tracetdi.dim{2};
-    trace.t=tracetdi.dim{1};
-    trace.dim=[{trace.x};{trace.t}];
-    trace.dimunits=[{'sqrt(psi)'} ; {'time [s]'}];
-    trace.std=tracestd.data;
-    mdsclose
-
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'sxr','sxR'}
     %  load TCV soft x-ray data
 
@@ -448,11 +410,19 @@ switch TCVkeywrdcase{index}
     trace.dimunits={'time [s]'};
     error=0;
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'ece'
     %  load TCV ECE data
     % Status=1 => Not Read Yet
     if ~isempty(find(status == 1))
+      if eval(['~mdsdata(''node_exists("\\RESULTS::ECE:rho")'')'])
+        disp(['node \RESULTS::ECE:rho does not exist for shot = ' num2str(shot)])
+        return
+      end
+      if eval(['mdsdata(''getnci("\\RESULTS::ECE:rho","length")'')==0'])
+        disp(['no data for \RESULTS::ECE:rho for shot = ' num2str(shot)])
+        return
+      end
       [TE_ECE,TE_ECE_ERR,RHO,R,T,TE_THOM,TE_THOM_ERR,Fcentral,CAL]=ece_te ...
           (shot,[0.1 0.29],10,10);
     end
@@ -469,7 +439,7 @@ switch TCVkeywrdcase{index}
     varargout{1}={radius};
     error=0;
 
-  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case 'MPX'
     %  load TCV MPX data
     % Status=1 => Not Read Yet
-- 
GitLab