From 5a8b016fc29e3c49967a685f20651c779acceebd Mon Sep 17 00:00:00 2001 From: Jacques Grelet <jacques.grelet@ird.fr> Date: Thu, 17 Jan 2008 13:47:23 +0000 Subject: [PATCH] use of tsg.qc.hash quality object to dynamically plot SSPS_QC --- tsg_util/plot_SalTempVel.m | 70 +++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/tsg_util/plot_SalTempVel.m b/tsg_util/plot_SalTempVel.m index 96f6256..2c2a8ea 100644 --- a/tsg_util/plot_SalTempVel.m +++ b/tsg_util/plot_SalTempVel.m @@ -19,28 +19,60 @@ tsg = getappdata( hTsgGUI, 'tsg_data'); % ------------------------------------------- axes( hAxes(1)); -ind = find(tsg.SSPS_QC <= tsg.qc.Code.NO_CONTROL ); -plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... - strcat('.',tsg.qc.Color.NO_CONTROL)); +% plot all data in white to draw first axes before hold on if ind of +% tsg.SSPS_QC == NO_CONTROL is empty +% ---------------------------------- +plot(hAxes(1), tsg.DAYD, tsg.SSPS, '.w'); hold on; -ind = find(tsg.SSPS_QC == tsg.qc.Code.GOOD ); -plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... - strcat('.',tsg.qc.Color.GOOD)); - -ind = find(tsg.SSPS_QC == tsg.qc.Code.PROBABLY_GOOD ); -plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... - strcat('.',tsg.qc.Color.PROBABLY_GOOD)); - -ind = find(tsg.SSPS_QC == tsg.qc.Code.PROBABLY_BAD ); -plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... - strcat('.',tsg.qc.Color.PROBABLY_BAD)); - -ind = find(tsg.SSPS_QC == tsg.qc.Code.BAD ); -plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... - strcat('.',tsg.qc.Color.BAD)); -hold off; +% get list of keys from hashtable tsg.qc.hash, defined inside +% tsg_initialisation.m +% ----------------------------------------------------------- +qc_list = get(tsg.qc.hash); + +% iterate (loop) on each key store inside hastable +% ------------------------------------------------ +for i=1:numel(qc_list) + + % get key and some values in hashtable + % ------------------------------------ + key = qc_list{i}; + state = get(tsg.qc.hash, key, 'state'); + code = get(tsg.qc.hash, key, 'code'); + color = get(tsg.qc.hash, key, 'color'); + + % plot only for valid context menu (set to 'on') + % -------------------------------_______------- + if strcmp( state, 'on') + + % plot tsg salinity sample with right code/color + % ---------------------------------------------- + ind = find(tsg.SSPS_QC == code ); + plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... + strcat('.', color)); + end +end +% ind = find(tsg.SSPS_QC == tsg.qc.Code.GOOD ); +% plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... +% strcat('.',tsg.qc.Color.GOOD)); +% +% ind = find(tsg.SSPS_QC == tsg.qc.Code.PROBABLY_GOOD ); +% plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... +% strcat('.',tsg.qc.Color.PROBABLY_GOOD)); +% +% ind = find(tsg.SSPS_QC == tsg.qc.Code.PROBABLY_BAD ); +% plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... +% strcat('.',tsg.qc.Color.PROBABLY_BAD)); +% +% ind = find(tsg.SSPS_QC == tsg.qc.Code.BAD ); +% plot(hAxes(1), tsg.DAYD(ind), tsg.SSPS(ind), ... +% strcat('.',tsg.qc.Color.BAD)); +hold off; + +% set HandleVisibility 'On' to 'Callback' on first axes +% ----------------------------------------------------- +% set(hAxes(1), 'HandleVisibility', 'Callback'); % Plot Temperature and ship velocity with no qc color code % --------------------------------------------------------- -- GitLab