%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Figure setup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
positionVector1 = [0.1 0.9 0.07 0.05] ;
positionVector2 = [0.2 0.9 0.07 0.05] ;
positionVector3 = [0.3 0.9 0.07 0.05] ;
positionVector4 = [0.4 0.9 0.07 0.05] ;
positionVector5 = [0.5 0.9 0.07 0.05] ;
positionVector6 = [0.6 0.9 0.07 0.05] ;
positionVector7 = [0.7 0.9 0.07 0.05];

positionVector8 = [0.1 0.8 0.07 0.05] ;
positionVector9 = [0.2 0.8 0.07 0.05] ;
positionVector10 = [0.3 0.8 0.07 0.05];
positionVector11 = [0.4 0.8 0.07 0.05];
positionVector12 = [0.5 0.8 0.07 0.05];
positionVector13 = [0.6 0.8 0.07 0.05];
positionVector14 = [0.7 0.8 0.07 0.05];

positionVector15 = [0.1 0.7 0.07 0.05];
positionVector16 = [0.2 0.7 0.07 0.05];
positionVector17 = [0.3 0.7 0.07 0.05];
positionVector18 = [0.4 0.7 0.07 0.05];
positionVector19 = [0.5 0.7 0.07 0.05] ;
positionVector20 = [0.6 0.7 0.07 0.05] ;
positionVector21 = [0.7 0.7 0.07 0.05] ;

positionVector22 = [0.1 0.6 0.07 0.05] ;
positionVector23 = [0.2 0.6 0.07 0.05] ;
positionVector24 = [0.3 0.6 0.07 0.05] ;
positionVector25 = [0.4 0.6 0.07 0.05];
positionVector26 = [0.5 0.6 0.07 0.05] ;
positionVector27 = [0.6 0.6 0.07 0.05] ;
positionVector28 = [0.7 0.6 0.07 0.05];

positionVector29 = [0.1 0.5 0.07 0.05];
positionVector30 = [0.2 0.5 0.07 0.05];
positionVector31 = [0.3 0.5 0.07 0.05];
positionVector32 = [0.4 0.5 0.07 0.05];
positionVector33 = [0.5 0.5 0.07 0.05];
positionVector34 = [0.6 0.5 0.07 0.05];
positionVector35 = [0.7 0.5 0.07 0.05];

positionVector36 = [0.1 0.4 0.07 0.05];
positionVector37 = [0.2 0.4 0.07 0.05];
positionVector38 = [0.3 0.4 0.07 0.05];
positionVector39 = [0.4 0.4 0.07 0.05];
positionVector40 = [0.5 0.4 0.07 0.05];
positionVector41 = [0.6 0.4 0.07 0.05];
positionVector42 = [0.7 0.4 0.07 0.05];

positionVector43 = [0.1 0.3 0.07 0.05];
positionVector44 = [0.2 0.3 0.07 0.05];
positionVector45 = [0.3 0.3 0.07 0.05];
positionVector46 = [0.4 0.3 0.07 0.05];
positionVector47 = [0.5 0.3 0.07 0.05];
positionVector48 = [0.6 0.3 0.07 0.05];
positionVector49 = [0.7 0.3 0.07 0.05];

positionVector50 = [0.1 0.2 0.07 0.05];
positionVector51 = [0.2 0.2 0.07 0.05];
positionVector52 = [0.3 0.2 0.07 0.05];
positionVector53 = [0.4 0.2 0.07 0.05];
positionVector54 = [0.5 0.2 0.07 0.05];
positionVector55 = [0.6 0.2 0.07 0.05];
positionVector56 = [0.7 0.2 0.07 0.05];

%clean out extreme inventories
filename = 'data_2010/lev_inv.txt';
data3 = importdata(filename);
INV3 = data3(:,4);
INV3(INV3>=9E14)=NaN;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
% Max surface gyre concentrations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = 'data_2010/max_conc_surf.txt';
data1 = importdata(filename);
pinp1 = data1(:,6);
prise1 = data1(:,7);
%pbc1 = data1(:,8);
%pagg1 = data1(:,9);
%kp1 = data1(:,10);
%zpref1 = data1(:,11);
%ping1 = data1(:,12);
NPG1 = data1(:,1);
NAG1 = data1(:,2);
SPG1 = data1(:,3);
SAG1 = data1(:,4);
IOG1 = data1(:,5);

% Filter for inventories greater than integrated input at 2010
prise1(isnan(INV3))=NaN;
%prise1(prise1>=0.05)=NaN;
pinp1(isnan(prise1))=NaN;
%pbc1(isnan(prise1))=NaN;
%pagg1(isnan(prise1))=NaN;
%kp1(isnan(prise1))=NaN;
%zpref1(isnan(prise1))=NaN;
%ping1(isnan(prise1))=NaN;

filename = 'data_2100/max_conc_surf.txt';
data2 = importdata(filename);
pinp2 = data2(:,6);
prise2 = data2(:,7);
%pbc2 = data2(:,8);
%pagg2 = data2(:,9);
%kp2 = data2(:,10);
%zpref2 = data2(:,11);
%ping2 = data2(:,12);
NPG2 = data2(:,1);
NAG2 = data2(:,2);
SPG2 = data2(:,3);
SAG2 = data2(:,4);
IOG2 = data2(:,5);

% Filter for inventories greater than integrated input at 2010
prise2(isnan(INV3))=NaN;
%prise2(prise2>=0.05)=NaN;
pinp2(isnan(prise2))=NaN;
%pbc2(isnan(prise2))=NaN;
%pagg2(isnan(prise2))=NaN;
%kp2(isnan(prise2))=NaN;
%zpref2(isnan(prise2))=NaN;
%ping2(isnan(prise2))=NaN;

figure

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% North Pacific Gyre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector1);

scatter(prise1,NPG1,30,'blue','filled'); 
xlim( [0 0.05])
ylim([0 0.4])
ylabel({'Max'; 'Conc'; 'N. Pac.'},'FontSize',10)
%hold on
%scatter(prise2,NPG2,30,'red','filled')

subplot('Position',positionVector2);
scatter(pinp1,NPG1,30,'blue','filled');
ylim([0 0.4])
%hold on
%scatter(pinp2,NPG2,30,'red','filled')

%subplot('Position',positionVector3);
%scatter(pbc1,NPG1,30,'blue','filled'); 
%hold on
%scatter(pbc2,NPG2,30,'red','filled')

%subplot('Position',positionVector4);
%scatter(pagg1,NPG1,30,'blue','filled');
%hold on
%scatter(pagg2,NPG2,30,'red','filled')

%subplot('Position',positionVector5);
%scatter(kp1,NPG1,30,'blue','filled');
%hold on
%scatter(kp2,NPG2,30,'red','filled')

%subplot('Position',positionVector6);
%scatter(zpref1,NPG1,30,'blue','filled');
%hold on
%scatter(zpref2,NPG2,30,'red','filled')

%subplot('Position',positionVector7);
%scatter(ping1,NPG1,30,'blue','filled');
%hold on
%scatter(ping2,NPG2,30,'red','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% North Atlantic Gyre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector8);
scatter(prise1,NAG1,30,'blue','filled'); 
xlim( [0 0.05])
ylim( [0 0.4])
ylabel({'Max'; 'Conc'; 'N. Atl.'},'FontSize',10)
%hold on
%scatter(prise2,NAG2,30,'red','filled')

subplot('Position',positionVector9);
scatter(pinp1,NAG1,30,'blue','filled');
ylim( [0 0.4])
%hold on
%scatter(pinp2,NAG2,30,'red','filled')

%subplot('Position',positionVector10);
%scatter(pbc1,NAG1,30,'blue','filled'); 
%ylim( [0 1000])
%hold on
%scatter(pbc2,NAG2,30,'red','filled')

%subplot('Position',positionVector11);
%scatter(pagg1,NAG1,30,'blue','filled');
%ylim( [0 1000])
%hold on
%scatter(pagg2,NAG2,30,'red','filled')

%subplot('Position',positionVector12);
%scatter(kp1,NAG1,30,'blue','filled');
%ylim( [0 1000])
%hold on
%scatter(kp2,NAG2,30,'red','filled')

%subplot('Position',positionVector13);
%scatter(zpref1,NAG1,30,'blue','filled');
%ylim( [0 1000])
%hold on
%scatter(zpref2,NAG2,30,'red','filled')

%subplot('Position',positionVector14);
%scatter(ping1,NAG1,30,'blue','filled');
%ylim( [0 1000])
%hold on
%scatter(ping2,NAG2,30,'red','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% South Pacific Gyre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector15);
scatter(prise1,SPG1,30,'blue','filled'); 
xlim( [0 0.05])
ylabel({'Max'; 'Conc'; 'S. Pac.'},'FontSize',10)
ylim([0 0.2])
%hold on
%scatter(prise2,SPG2,30,'red','filled')

subplot('Position',positionVector16);
scatter(pinp1,SPG1,30,'blue','filled');
ylim([0 0.2])
%hold on
%scatter(pinp2,SPG2,30,'red','filled')

%subplot('Position',positionVector17);
%scatter(pbc1,SPG1,30,'blue','filled'); 
%hold on
%scatter(pbc2,SPG2,30,'red','filled')

%subplot('Position',positionVector18);
%scatter(pagg1,SPG1,30,'blue','filled');
%hold on
%scatter(pagg2,SPG2,30,'red','filled')

%subplot('Position',positionVector19);
%scatter(kp1,SPG1,30,'blue','filled');
%hold on
%scatter(kp2,SPG2,30,'red','filled')

%subplot('Position',positionVector20);
%scatter(zpref1,SPG1,30,'blue','filled');
%hold on
%scatter(zpref2,SPG2,30,'red','filled')

%subplot('Position',positionVector21);
%scatter(ping1,SPG1,30,'blue','filled');
%hold on
%scatter(ping2,SPG2,30,'red','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% South Atlantic Gyre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector22);

scatter(prise1,SAG1,30,'blue','filled'); 
xlim( [0 0.05])
ylim( [0 0.2])
ylabel({'Max'; 'Conc'; 'S. Atl.'},'FontSize',10)
%hold on
%scatter(prise2,SAG2,30,'red','filled')

subplot('Position',positionVector23);
scatter(pinp1,SAG1,30,'blue','filled');
ylim( [0 0.2])
%hold on
%scatter(pinp2,SAG2,30,'red','filled')

%subplot('Position',positionVector24);
%scatter(pbc1,SAG1,30,'blue','filled'); 
%ylim( [0 400])
%hold on
%scatter(pbc2,SAG2,30,'red','filled')

%subplot('Position',positionVector25);
%scatter(pagg1,SAG1,30,'blue','filled');
%ylim( [0 400])
%hold on
%scatter(pagg2,SAG2,30,'red','filled')

%subplot('Position',positionVector26);
%scatter(kp1,SAG1,30,'blue','filled');
%ylim( [0 400])
%hold on
%scatter(kp2,SAG2,30,'red','filled')

%subplot('Position',positionVector27);
%scatter(zpref1,SAG1,30,'blue','filled');
%ylim( [0 400])
%hold on
%scatter(zpref2,SAG2,30,'red','filled')

%subplot('Position',positionVector28);
%scatter(ping1,SAG1,30,'blue','filled');
%ylim( [0 400])
%hold on
%scatter(ping2,SAG2,30,'red','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indian O Gyre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector29);

scatter(prise1,IOG1,30,'blue','filled'); 
xlim( [0 0.05])
ylim([0 0.4])
ylabel({'Max'; 'Conc'; 'Ind. O.'},'FontSize',10)
xlabel('F_R','FontSize',10)
%hold on
%scatter(prise2,IOG2,30,'red','filled')

subplot('Position',positionVector30);
scatter(pinp1,IOG1,30,'blue','filled');
ylim([0 0.4])
xlabel('F_T','FontSize',10)
%hold on
%scatter(pinp2,IOG2,30,'red','filled')

%subplot('Position',positionVector31);
%scatter(pbc1,IOG1,30,'blue','filled'); 
%xlabel('F_B','FontSize',10)
%hold on
%scatter(pbc2,IOG2,30,'red','filled')

%subplot('Position',positionVector32);
%scatter(pagg1,IOG1,30,'blue','filled');
%xlabel('F_A','FontSize',10)
%hold on
%scatter(pagg2,IOG2,30,'red','filled')

%subplot('Position',positionVector33);
%scatter(kp1,IOG1,30,'blue','filled');
%xlabel('k_P','FontSize',10)
%hold on
%scatter(kp2,IOG2,30,'red','filled')

%subplot('Position',positionVector34);
%scatter(zpref1,IOG1,30,'blue','filled');

%hold on
%scatter(zpref2,IOG2,30,'red','filled')

%subplot('Position',positionVector35);
%scatter(ping1,IOG1,30,'blue','filled');
%hold on
%scatter(ping2,IOG2,30,'red','filled')
