From 657caf1790f882a408d8d5a547165fd26b2b4198 Mon Sep 17 00:00:00 2001 From: Povl Abrahamsen Date: Fri, 4 Nov 2022 09:48:55 +0000 Subject: [PATCH 1/2] misc. graphics changes --- CTD_Chipod/mfiles/CalibrateChipodCTD.m | 12 ++++++++++-- .../mfiles/MakeCasts_CTDchipod_function.m | 10 ++++++---- CTD_Chipod/mfiles/PlotChipodDataRaw_General.m | 15 ++++++++++++--- .../Plot_TP_profiles_EachCast_CTDchipod.m | 8 ++++++++ CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m | 13 +++++++++++-- CTD_Chipod/mfiles/ezpc.m | 17 +++++++++++++++++ 6 files changed, 64 insertions(+), 11 deletions(-) diff --git a/CTD_Chipod/mfiles/CalibrateChipodCTD.m b/CTD_Chipod/mfiles/CalibrateChipodCTD.m index 62c1f15..8262668 100644 --- a/CTD_Chipod/mfiles/CalibrateChipodCTD.m +++ b/CTD_Chipod/mfiles/CalibrateChipodCTD.m @@ -82,7 +82,11 @@ loglog(f,p2,f,p,'linewidth',2); axis tight grid on - legend('digital','analog','location','best') + try + legend('digital','analog','location','best','AutoUpdate','off') + catch + legend('digital','analog','location','best'); + end xlabel('Frequency [hz]') title(['Spectra of dT/dt - \tau =' num2str(chidat.cal.coef.T1P)]) ylabel('\Phi_{T_z} [^oC^2/s^{-2}]') @@ -114,7 +118,11 @@ loglog(f,p2,f,p,'linewidth',2); axis tight grid on - legend('digital','analog','location','best') + try + legend('digital','analog','location','best','AutoUpdate','off') + catch + legend('digital','analog','location','best'); + end xlabel('Frequency [hz]') title(['T2- Spectra of dT/dt - \tau =' num2str(chidat.cal.coef.T1P)]) ylabel('\Phi_{T_z} [^oC^2/s^{-2}]') diff --git a/CTD_Chipod/mfiles/MakeCasts_CTDchipod_function.m b/CTD_Chipod/mfiles/MakeCasts_CTDchipod_function.m index ea7dfca..16948b1 100644 --- a/CTD_Chipod/mfiles/MakeCasts_CTDchipod_function.m +++ b/CTD_Chipod/mfiles/MakeCasts_CTDchipod_function.m @@ -198,10 +198,12 @@ function MakeCasts_CTDchipod_function(the_project,mixpath) savedir_cal = fullfile(chi_proc_path_specific,'cal') ; ChkMkDir(savedir_cal) - % Plot the raw CTD data - ax = PlotRawCTD(CTD_24hz) ; - print(fullfile(chi_fig_path_specific,[whSN '_Cast_' castStr '_Fig0_RawCTD']),'-dpng') - + if ~exist(fullfile(chi_fig_path_specific,[whSN '_Cast_' castStr '_Fig0_RawCTD.png']),'file') + % Plot the raw CTD data + ax = PlotRawCTD(CTD_24hz) ; + print(fullfile(chi_fig_path_specific,[whSN '_Cast_' castStr '_Fig0_RawCTD']),'-dpng') + end + try %~~ Load chipod data diff --git a/CTD_Chipod/mfiles/PlotChipodDataRaw_General.m b/CTD_Chipod/mfiles/PlotChipodDataRaw_General.m index 708468b..2d0bac4 100644 --- a/CTD_Chipod/mfiles/PlotChipodDataRaw_General.m +++ b/CTD_Chipod/mfiles/PlotChipodDataRaw_General.m @@ -64,7 +64,16 @@ function PlotChipodDataRaw_General(the_project,mixpath) clear data head chidat close all - + + if saveplot==1 + figdir = fullfile(fig_path,'chipodraw',whSN); + figname = [chi_file_list(whfile).name(1:end-4)] ; + if exist(fullfile(figdir,[figname,'.png']),'file') + disp([figname,' has already been plotted; skipping...']) + continue; + end + end + %~~~ load chipod data try % 'big' chipod @@ -175,9 +184,9 @@ function PlotChipodDataRaw_General(the_project,mixpath) end if saveplot==1 - figdir = fullfile(fig_path,'chipodraw',whSN); +% figdir = fullfile(fig_path,'chipodraw',whSN); ChkMkDir(figdir) - figname = [chi_file_list(whfile).name(1:end-4)] ; +% figname = [chi_file_list(whfile).name(1:end-4)] ; print( fullfile(figdir,figname),'-dpng') end diff --git a/CTD_Chipod/mfiles/Plot_TP_profiles_EachCast_CTDchipod.m b/CTD_Chipod/mfiles/Plot_TP_profiles_EachCast_CTDchipod.m index d7f100c..0a2614c 100644 --- a/CTD_Chipod/mfiles/Plot_TP_profiles_EachCast_CTDchipod.m +++ b/CTD_Chipod/mfiles/Plot_TP_profiles_EachCast_CTDchipod.m @@ -49,6 +49,14 @@ function Plot_TP_profiles_EachCast_CTDchipod(the_project) waitbar(icast/Ncasts,hb) castname=CTDlist(icast).name(1:end-4) + if saveplot==1 + figdir=fullfile(BaseDir_data,'Figures','TPprofiles_AllSN'); + if exist(fullfile(figdir,['TP_profs_' castname '.png']),'file') + disp('Figure already plotted') + continue; + end + end + % Set up figure figure(1);clf agutwocolumn(1) diff --git a/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m b/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m index e605ee5..3b84a7a 100644 --- a/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m +++ b/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m @@ -145,10 +145,19 @@ function do_chi_calc_ctd_chipod(the_project,mixpath,varargin) castfile = Flist(icast).name; id1 = strfind(castfile,['_' whSN]); castStr = castfile(1:id1-1); + %fname=fullfile(savedir_cal,[castStr '_' whSN '_' castdir 'cast.mat']); fname = fullfile(savedir_cal,castfile) ; load(fname) %--- + + chi_proc_path_avg = fullfile(chi_proc_path_specific,'avg',... + ['zsm' num2str(Params.z_smooth) 'm_fmax' num2str(Params.fmax) 'Hz_respcorr' num2str(Params.resp_corr) '_fc_' num2str(Params.fc) 'hz_gamma' num2str(Params.gamma*100)] ) ; + processed_file=fullfile(chi_proc_path_avg,['avg_' castStr '_' C.castdir 'cast_' whSN '_' whsens '.mat']); + if exist(processed_file,'file') + disp(['avg_' castStr '_' C.castdir 'cast_' whSN '_' whsens ' already processed, skipping...']) + continue; + end clear TP ctd TP = C.([whsens 'P']); @@ -239,7 +248,7 @@ function do_chi_calc_ctd_chipod(the_project,mixpath,varargin) ylabel('P [db]') xlabel('# good data windows') title([whSN ' cast ' castStr ' - ' C.castdir 'cast'],'interpreter','none') - print('-dpng',fullfile(chi_fig_path_specific,[whSN '_' castStr '_Fig' num2str(whfig) '_' C.castdir 'cast_chi_' whsens '_avgPhist'])) + print('-dpng',fullfile(chi_fig_path_specific,[whSN '_Cast_' castStr '_Fig' num2str(whfig) '_' C.castdir 'cast_chi_' whsens '_avgPhist'])) whfig=whfig+1; end @@ -321,7 +330,7 @@ function do_chi_calc_ctd_chipod(the_project,mixpath,varargin) title([whSN],'interpreter','none') axes(ax(3)) title(['Sensor ' whsens]) - print('-dpng',fullfile(chi_fig_path_specific,[whSN '_' castStr '_Fig' num2str(whfig) '_' C.castdir 'cast_chi_' whsens '_avg_chi_KT_dTdz'])) + print('-dpng',fullfile(chi_fig_path_specific,[whSN '_Cast_' castStr '_Fig' num2str(whfig) '_' C.castdir 'cast_chi_' whsens '_avg_chi_KT_dTdz'])) whfig=whfig+1; %~~~ diff --git a/CTD_Chipod/mfiles/ezpc.m b/CTD_Chipod/mfiles/ezpc.m index 2996e16..34519ac 100644 --- a/CTD_Chipod/mfiles/ezpc.m +++ b/CTD_Chipod/mfiles/ezpc.m @@ -16,4 +16,21 @@ x=varargin{1};y=varargin{2};var=varargin{3}; end +% added by EPA, Mar 2022: + +if numel(y)>length(y) + y=y(:,1); +end +if numel(x)>length(x) + x=x(1,:); +end +good_x=find(~isnan(x)); +x=x(good_x); +var=var(:,good_x); +newx=[(3*x(1)-x(2)),(x(1:end-1)+x(2:end)),(x(end)*3-x(end-1))]/2; +[x,y]=meshgrid(newx,y); +var=[var,nan(length(y),1)]; + +% back to original programming: + h=pcolor(x,y,var);shading flat;axis ij From 724e56b68c6d6e98a2b3410060beb9b9a337e42b Mon Sep 17 00:00:00 2001 From: Povl Abrahamsen Date: Fri, 4 Nov 2022 10:13:38 +0000 Subject: [PATCH 2/2] undo a processing change that was added to the wrong branch --- CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m b/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m index 3b84a7a..8f205b3 100644 --- a/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m +++ b/CTD_Chipod/mfiles/do_chi_calc_ctd_chipod.m @@ -145,19 +145,10 @@ function do_chi_calc_ctd_chipod(the_project,mixpath,varargin) castfile = Flist(icast).name; id1 = strfind(castfile,['_' whSN]); castStr = castfile(1:id1-1); - %fname=fullfile(savedir_cal,[castStr '_' whSN '_' castdir 'cast.mat']); fname = fullfile(savedir_cal,castfile) ; load(fname) %--- - - chi_proc_path_avg = fullfile(chi_proc_path_specific,'avg',... - ['zsm' num2str(Params.z_smooth) 'm_fmax' num2str(Params.fmax) 'Hz_respcorr' num2str(Params.resp_corr) '_fc_' num2str(Params.fc) 'hz_gamma' num2str(Params.gamma*100)] ) ; - processed_file=fullfile(chi_proc_path_avg,['avg_' castStr '_' C.castdir 'cast_' whSN '_' whsens '.mat']); - if exist(processed_file,'file') - disp(['avg_' castStr '_' C.castdir 'cast_' whSN '_' whsens ' already processed, skipping...']) - continue; - end clear TP ctd TP = C.([whsens 'P']);