From 439b080a75b08fee2009d4231bdc34f0165e2b2e Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 29 Sep 2015 20:36:40 +0000
Subject: [PATCH] tested all present request names, only sxr and ece missing

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@5076 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/gdat_tcv.m          | 1 +
 crpptbx/gdat_plot.m             | 9 +++++++--
 crpptbx/test_all_requestnames.m | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m
index d8df155b..0824d4c8 100644
--- a/crpptbx/TCV/gdat_tcv.m
+++ b/crpptbx/TCV/gdat_tcv.m
@@ -719,6 +719,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       gdat_data.units = 'T/s';
       gdat_data.data_fullpath='abs(mhdmode("LFS",n,1))';
       gdat_data.request_description = 'delta_Bdot from magnetic probes to get n=1, 2 and 3';
+      gdat_data.label = {'n=1','n=2','n=3'}; % can be used in legend(gdat_data.label)
     end
     
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/crpptbx/gdat_plot.m b/crpptbx/gdat_plot.m
index d75dc2fa..5a4b4110 100644
--- a/crpptbx/gdat_plot.m
+++ b/crpptbx/gdat_plot.m
@@ -69,12 +69,17 @@ if prod(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty
     ylabel_eff = gdat_data.label;
     if iscell(gdat_data.label) && length(gdat_data.label)>=2; ylabel_eff = gdat_data.label{2}; end
     if ~isempty(gdat_data.units)
-      ylabel([ylabel_eff '[' gdat_data.units ']']);
+      hylabel=ylabel([ylabel_eff '[' gdat_data.units ']']);
     else
-      ylabel(ylabel_eff);
+      hylabel=ylabel(ylabel_eff);
     end
     zoom on;
   end
+  if strcmp(gdat_data.gdat_request,'mhd')
+    % special case, add legend instead of ylabel
+    delete(hylabel);
+    legend(gdat_data.label,2);
+  end
 else
   disp('cannot plot gdat_data, has empty data or t field')
 end
diff --git a/crpptbx/test_all_requestnames.m b/crpptbx/test_all_requestnames.m
index dca61943..ac1415ac 100644
--- a/crpptbx/test_all_requestnames.m
+++ b/crpptbx/test_all_requestnames.m
@@ -1,6 +1,8 @@
 
 machine='AUG';
 shot=30594;
+machine='TCV';
+shot=48836;
 aa=gdat('machine',machine);
 aa=gdat;
 all_request_names = aa.gdat_request
-- 
GitLab