From c079f6003733972062a2b9f88410241989f53532 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Thu, 14 Mar 2019 13:47:26 +0000 Subject: [PATCH] add checks if data is ok and suggest ways out when liuqe dims are not consistent git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11578 d63d8f72-b253-0410-a779-e742ad2e26cf --- crpptbx/TCV/gdat_tcv.m | 25 +++++++++++++++++++++++-- crpptbx/get_grids_1d.m | 4 +--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m index e5c465ec..a850e622 100644 --- a/crpptbx/TCV/gdat_tcv.m +++ b/crpptbx/TCV/gdat_tcv.m @@ -2047,11 +2047,32 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end params_eff.data_request='psi_axis'; % psi_edge=0 with LIUQE psi_axis=gdat_tcv(shot,params_eff); - % assume same dimensions, check + % assume same dimensions, check. Note data dims can be different from dim{} when there is a problem with liuqe run if numel(phi_tor.data) ~= numel(q_rho.data) || numel(psi_axis.data) ~= numel(phi_tor.dim{2}) - disp(['problems in gdat_tcv with ' data_request_eff ' with unexpected dimensions']) + warning(['problems in gdat_tcv with ' data_request_eff ' with unexpected dimensions']) return; end + % check time sizes since can happen problems with old liuqe runs + if size(q_rho.data,2) ~= size(phi_tor.data,2) + warning(['time sizes between q_rho and phi_tor do not match: ' num2str(size(q_rho.data,2)) ' and ' num2str(size(phi_tor.data,2))]); + return + end + if size(q_rho.data,2) ~= length(psi_axis.data) + psi_axis + q_rho + disp('q_rho.dim');q_rho.dim + phi_tor + disp('phi_tor.dim');phi_tor.dim + disp(['WARNING: time sizes between q_rho and psi_axis do not match: ' num2str(size(q_rho.data,2)) ' and ' ... + num2str(length(psi_axis.data))]); + disp('WARNING: should have been caught, so probably q_rho.dim not the same as data(:,:) dims') + disp('should run: >> liuqe_default_run_sequence(shot)') + return + end + if size(q_rho.data,1) ~= size(phi_tor.data,1) + warning(['radial sizes between q_rho and phi_tor do not match: ' num2str(size(q_rho.data,1)) ' and ' num2str(size(phi_tor.data,1))]); + return + end for it=1:size(q_rho.data,2) %if any(~isfinite(phi_tor.data(:,it))) ij=find(isfinite(q_rho.data(:,it))); diff --git a/crpptbx/get_grids_1d.m b/crpptbx/get_grids_1d.m index c39c59f1..12da7bd6 100644 --- a/crpptbx/get_grids_1d.m +++ b/crpptbx/get_grids_1d.m @@ -50,7 +50,7 @@ gdat_data.grids_1d.rhotornorm = NaN*ones(size(gdat_data.data)); gdat_data.grids_1d.rhovolnorm = NaN*ones(size(gdat_data.data)); if (isempty(rhotor_norm.x) ||isempty(rhotor_norm.t) || isempty(rhotor_norm.data)) ... - && (isempty(rhovol.x) ||isempty(rhovol.t) || isempty(rhovol.data)) + || (isempty(rhovol.x) ||isempty(rhovol.t) || isempty(rhovol.data)) return end @@ -104,5 +104,3 @@ end gdat_data.grids_1d.rhotor_edge=interpos(-63,rhotor_norm.t',rhotor_norm.rhotor_edge,gdat_data.t',-0.01); gdat_data.grids_1d.volume_edge=interpos(-63,rhovol.t',rhovol.volume_edge,gdat_data.t',-0.01); gdat_data.grids_1d.b0=interpos(-63,rhotor_norm.t',rhotor_norm.b0,gdat_data.t',-0.01); - - -- GitLab