%run_plotTS
%
% Use this to call plotTS as many times as groups of stations
% A. Ganachaud, 2014

clear all
o2_params %to get general parameters; but many are modified below
p_final=1;
clear gistatbad %normally plots all stations/profiles
%gistatbad=[7,11,20,30,35,81] 

%
% depth range for each graphic
% Modif glazeo - 21/01/2015
gdeprange=[1980 3000 3510 4010]; 
% gdeprange=[980 1480 1800 2010]; 

%
% how to color station groups
gstatgroup=[1 3 %group 1
     4 43  % group 2
     45 57];% 
gicolor={'b','r','g','m'};
gstatgroupstr={'1-3','4-43','45-57'};

figure(1);clf

for usegroup=1:3;
    switch usegroup
        % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        % % Calibration group 1: stats 1-3
        % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %
        % group of stations to treat
        case 1
            gistat2cal=1:3;
            iswitch=0;
            wswitch=0;
            csuf='1_3_ex3';
            % run plotTS
            plotTS
            
            
            % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            % % Calibration group 2: stats 4-43
            % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            %
        case 2
            gistat2cal=4:43
            iswitch=1;
            wswitch=0;
            csuf='4_43_ex6';
            % run plotTS
            plotTS
            
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            % Calibration group 3: stats 45-57
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            
        case 3
            gistat2cal=45:57
            iswitch=0;
            wswitch=0;
            csuf='45_57_ex5';
            % run plotTS
            plotTS
    end
end

if p_final
    namefig=sprintf('ox_cal_theta_S-O_%d_%d_%s_is%d_ws%d_%s',statbeg, statend, cname,iswitch,wswitch,csuf);
    set(1,'paperunits','inch','paperorient','port')
    %set(1,'position',[561   460   875   496]) %this is position on the
    %screen !
    %get(1,'position')
    set(1,'paperposition',[0.3 0.5 5 6])
    
    nfopeps=sprintf('%s%s.eps',direps,namefig)
    exportfig(1,nfopeps,'preview','tiff','LineMode','scaled','color','rgb',...
        'FontMode','fixed','FontSize',10,'height',12);
    
    nfopjpg=sprintf('%s%s.png',dirjpg,namefig)
    exportfig(1,nfopjpg,'format','png','LineMode','scaled','color','rgb',...
        'FontMode','fixed','FontSize',10,'height',12);
end
