From f7d81b3010e25f317f8effd6c0afb1a21dbc53d2 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Fri, 21 Aug 2015 15:20:02 +0000
Subject: [PATCH] add desciption of data_request

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4888 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx_new/AUG/gdat_aug.m | 8 +++++++-
 crpptbx_new/TCV/gdat_tcv.m | 8 +++++++-
 crpptbx_new/gdat.m         | 2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/crpptbx_new/AUG/gdat_aug.m b/crpptbx_new/AUG/gdat_aug.m
index 228b8fd9..f070e344 100644
--- a/crpptbx_new/AUG/gdat_aug.m
+++ b/crpptbx_new/AUG/gdat_aug.m
@@ -201,7 +201,13 @@ data_request_eff = gdat_params.data_request; % in case was defined in pairs
 
 % if it is a request_keyword copy it:
 ij=strmatch(data_request_eff,data_request_names_all,'exact');
-if ~isempty(ij); gdat_data.gdat_request = data_request_names_all{ij}; end
+if ~isempty(ij); 
+  gdat_data.gdat_request = data_request_names_all{ij};
+  if isfield(data_request_names.all.(data_request_names_all{ij}),'description') && ~isempty(data_request_names.all.(data_request_names_all{ij}).description)
+    % copy description of keyword
+    gdat_data.request_description = data_request_names.all.(data_request_names_all{ij}).description;
+  end
+end
 
 % special treatment if shot and data_request given within pairs
 if isfield(gdat_params,'shot')
diff --git a/crpptbx_new/TCV/gdat_tcv.m b/crpptbx_new/TCV/gdat_tcv.m
index fdec0bce..44155bf3 100644
--- a/crpptbx_new/TCV/gdat_tcv.m
+++ b/crpptbx_new/TCV/gdat_tcv.m
@@ -200,7 +200,13 @@ data_request_eff = gdat_params.data_request; % in case was defined in pairs
 
 % if it is a request_keyword copy it:
 ij=strmatch(data_request_eff,data_request_names_all,'exact');
-if ~isempty(ij); gdat_data.gdat_request = data_request_names_all{ij}; end
+if ~isempty(ij); 
+  gdat_data.gdat_request = data_request_names_all{ij};
+  if isfield(data_request_names.all.(data_request_names_all{ij}),'description') && ~isempty(data_request_names.all.(data_request_names_all{ij}).description)
+    % copy description of keyword
+    gdat_data.request_description = data_request_names.all.(data_request_names_all{ij}).description;
+  end
+end
 
 % special treatment if shot and data_request given within pairs
 if isfield(gdat_params,'shot')
diff --git a/crpptbx_new/gdat.m b/crpptbx_new/gdat.m
index 5ec4e363..5b4804f9 100644
--- a/crpptbx_new/gdat.m
+++ b/crpptbx_new/gdat.m
@@ -100,7 +100,7 @@ if nargin>=2 % need at least 2 inputs to have 'machine','aug' as arguments (to a
     machine_eff = shot.machine;
   elseif isstruct(data_request) && isfield(data_request,'machine')
     machine_eff = data_request.machine;
-  else
+  elseif nargin>=3
     imachine=[];
     for i=1:length(varargin_eff)
       if ischar(varargin_eff{i})
-- 
GitLab