% load data to matlab from txt files
% txt files produced in Ferret

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
% Ave depth of max conc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = 'data_2100/max_conc.txt';
data1 = importdata(filename);
pinp1 = data1(:,2);
prise1 = data1(:,3);
pbc1 = data1(:,4);
pagg1 = data1(:,5);
kp1 = data1(:,6);
zpref1 = data1(:,7);
ping1 = data1(:,8);
MAXD1 = data1(:,1);

% Filter for inventories greater than integrated input at 2010
prise1(isnan(INV3))=NaN;
%prise1(prise1>=0.06)=NaN;
prise1(isnan(INV3))=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_2010/max_conc.txt';
data2 = importdata(filename);
pinp2 = data2(:,2);
prise2 = data2(:,3);
pbc2 = data2(:,4);
pagg2 = data2(:,5);
kp2 = data2(:,6);
zpref2 = data2(:,7);
ping2 = data2(:,8);
MAXD2 = data2(:,1);

% Filter for inventories greater than integrated input at 2010
prise2(isnan(INV3))=NaN;
%prise2(prise2>=0.06)=NaN;
prise2(isnan(INV3))=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;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Now make the plot
figure
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];


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot('Position',positionVector1);

scatter(prise1,MAXD1,30,'red','filled'); 
xlim( [0 0.1])
ylim([0 600])
ylabel({'Ave Max'; 'Conc'; 'Depth (m)'},'FontSize',10)
hold on
scatter(prise2,MAXD2,30,'blue','filled')

subplot('Position',positionVector2);
scatter(pinp1,MAXD1,30,'red','filled');
ylim([0 600])
hold on
scatter(pinp2,MAXD2,30,'blue','filled')

subplot('Position',positionVector3);
scatter(pbc1,MAXD1,30,'red','filled'); 
ylim([0 600])
hold on
scatter(pbc2,MAXD2,30,'blue','filled')

subplot('Position',positionVector4);
scatter(pagg1,MAXD1,30,'red','filled');
ylim([0 600])
hold on
scatter(pagg2,MAXD2,30,'blue','filled')

subplot('Position',positionVector5);
scatter(kp1,MAXD1,30,'red','filled');
ylim([0 600])
hold on
scatter(kp2,MAXD2,30,'blue','filled')

subplot('Position',positionVector6);
scatter(zpref1,MAXD1,30,'red','filled');
ylim([0 600])
hold on
scatter(zpref2,MAXD2,30,'blue','filled')

subplot('Position',positionVector7);
scatter(ping1,MAXD1,30,'red','filled');
ylim([0 600])
hold on
scatter(ping2,MAXD2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
% Percent total MP inventory by depth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = 'data_2100/lev_inv.txt';
data1 = importdata(filename);
pinp1 = data1(:,5);
prise1 = data1(:,6);
pbc1 = data1(:,7);
pagg1 = data1(:,8);
kp1 = data1(:,9);
zpref1 = data1(:,10);
ping1 = data1(:,11);
SURF1 = data1(:,1);
MID1 = data1(:,2);
DEEP1 = data1(:,3);
INV1 = data1(:,4);

%prise1(prise1>=0.06)=NaN;
prise1(isnan(INV3))=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_2010/lev_inv.txt';
data2 = importdata(filename);
pinp2 = data2(:,5);
prise2 = data2(:,6);
pbc2 = data2(:,7);
pagg2 = data2(:,8);
kp2 = data2(:,9);
zpref2 = data2(:,10);
ping2 = data2(:,11);
SURF2 = data2(:,1);
MID2 = data2(:,2);
DEEP2 = data2(:,3);
INV2 = data2(:,4);
%prise2(prise2>=0.1)=NaN;
prise2(isnan(INV3))=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;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Now make the plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot('Position',positionVector8);
scatter(prise1,INV1,30,'red','filled');
xlim( [0 0.1])
ylim([0 5E17])
ylabel({'Global';'MP inv';'(part)'},'FontSize',10)
hold on
scatter(prise2,INV2,30,'blue','filled')

subplot('Position',positionVector9);
scatter(pinp1,INV1,30,'red','filled');
ylim([0 5E17])
hold on
scatter(pinp2,INV2,30,'blue','filled')

subplot('Position',positionVector10);
scatter(pbc1,INV1,30,'red','filled');
ylim([0 5E17]) 
hold on
scatter(pbc2,INV2,30,'blue','filled')

subplot('Position',positionVector11);
scatter(pagg1,INV1,30,'red','filled');
ylim([0 5E17])
hold on
scatter(pagg2,INV2,30,'blue','filled')

subplot('Position',positionVector12);
scatter(kp1,INV1,30,'red','filled');
ylim([0 5E17])
hold on
scatter(kp2,INV2,30,'blue','filled')

subplot('Position',positionVector13);
scatter(zpref1,INV1,30,'red','filled');
ylim([0 5E17])
hold on
scatter(zpref2,INV2,30,'blue','filled')

subplot('Position',positionVector14);
scatter(ping1,INV1,30,'red','filled');
ylim([0 5E17])
hold on
scatter(ping2,INV2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot('Position',positionVector15);
scatter(prise1,SURF1,30,'red','filled');
xlim( [0 0.1])
ylim([0 1])
ylabel({'Frac';'< 100 m'},'FontSize',10)
hold on
scatter(prise2,SURF2,30,'blue','filled')

subplot('Position',positionVector16);
scatter(pinp1,SURF1,30,'red','filled');
ylim([0 1])
hold on
scatter(pinp2,SURF2,30,'blue','filled')

subplot('Position',positionVector17);
scatter(pbc1,SURF1,30,'red','filled'); 
ylim([0 1])
hold on
scatter(pbc2,SURF2,30,'blue','filled')

subplot('Position',positionVector18);
scatter(pagg1,SURF1,30,'red','filled');
ylim([0 1])
hold on
scatter(pagg2,SURF2,30,'blue','filled')

subplot('Position',positionVector19);
scatter(kp1,SURF1,30,'red','filled');
ylim([0 1])
hold on
scatter(kp2,SURF2,30,'blue','filled')

subplot('Position',positionVector20);
scatter(zpref1,SURF1,30,'red','filled');
ylim([0 1])
hold on
scatter(zpref2,SURF2,30,'blue','filled')

subplot('Position',positionVector21);
scatter(ping1,SURF1,30,'red','filled');
ylim([0 1])
hold on
scatter(ping2,SURF2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector22);
scatter(prise1,MID1,30,'red','filled');
ylim([0 1])
xlim( [0 0.1])
ylabel({'Frac';'100-500';'m'},'FontSize',10)
hold on
scatter(prise2,MID2,30,'blue','filled')

subplot('Position',positionVector23);
scatter(pinp1,MID1,30,'red','filled');
ylim([0 1])
hold on
scatter(pinp2,MID2,30,'blue','filled')

subplot('Position',positionVector24);
scatter(pbc1,MID1,30,'red','filled'); 
ylim([0 1])
hold on
scatter(pbc2,MID2,30,'blue','filled')

subplot('Position',positionVector25);
scatter(pagg1,MID1,30,'red','filled');
ylim([0 1])
hold on
scatter(pagg2,MID2,30,'blue','filled')

subplot('Position',positionVector26);
scatter(kp1,MID1,30,'red','filled');
ylim([0 1])
hold on
scatter(kp2,MID2,30,'blue','filled')

subplot('Position',positionVector27);
scatter(zpref1,MID1,30,'red','filled');
ylim([0 1])
hold on
scatter(zpref2,MID2,30,'blue','filled')

subplot('Position',positionVector28);
scatter(ping1,MID1,30,'red','filled');
ylim([0 1])
hold on
scatter(ping2,MID2,30,'blue','filled')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot('Position',positionVector29);
scatter(prise1,DEEP1,30,'red','filled'); 
ylim([0 1])
xlim( [0 0.1])
ylabel({'Frac';'> 500 m'},'FontSize',10)
hold on
scatter(prise2,DEEP2,30,'blue','filled')

subplot('Position',positionVector30);
scatter(pinp1,DEEP1,30,'red','filled');
ylim([0 1])
hold on
scatter(pinp2,DEEP2,30,'blue','filled')

subplot('Position',positionVector31);
scatter(pbc1,DEEP1,30,'red','filled'); 
ylim([0 1])
hold on
scatter(pbc2,DEEP2,30,'blue','filled')

subplot('Position',positionVector32);
scatter(pagg1,DEEP1,30,'red','filled');
ylim([0 1])
hold on
scatter(pagg2,DEEP2,30,'blue','filled')

subplot('Position',positionVector33);
scatter(kp1,DEEP1,30,'red','filled');
ylim([0 1])
hold on
scatter(kp2,DEEP2,30,'blue','filled')

subplot('Position',positionVector34);
scatter(zpref1,DEEP1,30,'red','filled');
ylim([0 1])
hold on
scatter(zpref2,DEEP2,30,'blue','filled')

subplot('Position',positionVector35);
scatter(ping1,DEEP1,30,'red','filled');
ylim([0 1])
hold on
scatter(ping2,DEEP2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Percent total MP inventory by latitude
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = 'data_2100/lo_lat.txt';
data1 = importdata(filename);
pinp1 = data1(:,2);
prise1 = data1(:,3);
pbc1 = data1(:,4);
pagg1 = data1(:,5);
kp1 = data1(:,6);
zpref1 = data1(:,7);
ping1 = data1(:,8);
LL1 = data1(:,1);
%prise1(prise1>=0.1)=NaN;
prise1(isnan(INV3))=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_2010/lo_lat.txt';
data2 = importdata(filename);
pinp2 = data2(:,2);
prise2 = data2(:,3);
pbc2 = data2(:,4);
pagg2 = data2(:,5);
kp2 = data2(:,6);
zpref2 = data2(:,7);
ping2 = data2(:,8);
LL2 = data2(:,1);
%prise2(prise2>=0.1)=NaN;
prise2(isnan(INV3))=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;

subplot('Position',positionVector36);
scatter(prise1,LL1,30,'red','filled');
xlim( [0 0.1])
ylim([0 1])
ylabel({'Frac'; '40S-40N'},'FontSize',10)
hold on
scatter(prise2,LL2,30,'blue','filled')

subplot('Position',positionVector37);
scatter(pinp1,LL1,30,'red','filled');
ylim([0 1])
hold on
scatter(pinp2,LL2,30,'blue','filled')

subplot('Position',positionVector38);
scatter(pbc1,LL1,30,'red','filled'); 
ylim([0 1])
hold on
scatter(pbc2,LL2,30,'blue','filled')

subplot('Position',positionVector39);
scatter(pagg1,LL1,30,'red','filled');
ylim([0 1])
hold on
scatter(pagg2,LL2,30,'blue','filled')

subplot('Position',positionVector40);
scatter(kp1,LL1,30,'red','filled');
ylim([0 1])
hold on
scatter(kp2,LL2,30,'blue','filled')

subplot('Position',positionVector41);
scatter(zpref1,LL1,30,'red','filled');
ylim([0 1])
hold on
scatter(zpref2,LL2,30,'blue','filled')

subplot('Position',positionVector42);
scatter(ping1,LL1,30,'red','filled');
ylim([0 1])
hold on
scatter(ping2,LL2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filename = 'data_2100/hi_lat.txt';
data1 = importdata(filename);
pinp1 = data1(:,4);
prise1 = data1(:,5);
pbc1 = data1(:,6);
pagg1 = data1(:,7);
kp1 = data1(:,8);
zpref1 = data1(:,9);
ping1 = data1(:,10);

SO1 = data1(:,2);
AR1 = data1(:,3);
%prise1(prise1>=0.1)=NaN;
prise1(isnan(INV3))=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_2010/hi_lat.txt';
data2 = importdata(filename);
pinp2 = data2(:,4);
prise2 = data2(:,5);
pbc2 = data2(:,6);
pagg2 = data2(:,7);
kp2 = data2(:,8);
zpref2 = data2(:,9);
ping2 = data2(:,10);

SO2 = data2(:,2);
AR2 = data2(:,3);
%prise2(prise2>=0.1)=NaN;
prise2(isnan(INV3))=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;

subplot('Position',positionVector43);
scatter(prise1,SO1,30,'red','filled');
xlim( [0 0.1])
ylim([0 0.1])
ylabel({'Frac';'> 60S'},'FontSize',10)
hold on
scatter(prise2,SO2,30,'blue','filled')

subplot('Position',positionVector44);
scatter(pinp1,SO1,30,'red','filled');
ylim([0 0.1])
hold on
scatter(pinp2,SO2,30,'blue','filled')

subplot('Position',positionVector45);
scatter(pbc1,SO1,30,'red','filled'); 
ylim([0 0.1])
hold on
scatter(pbc2,SO2,30,'blue','filled')

subplot('Position',positionVector46);
scatter(pagg1,SO1,30,'red','filled');
ylim([0 0.1])
hold on
scatter(pagg2,SO2,30,'blue','filled')

subplot('Position',positionVector47);
scatter(kp1,SO1,30,'red','filled');
ylim([0 0.1])
hold on
scatter(kp2,SO2,30,'blue','filled')

subplot('Position',positionVector48);
scatter(zpref1,SO1,30,'red','filled');
ylim([0 0.1])
hold on
scatter(zpref2,SO2,30,'blue','filled')

subplot('Position',positionVector49);
scatter(ping1,SO1,30,'red','filled');
ylim([0 0.1])
hold on
scatter(ping2,SO2,30,'blue','filled')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot('Position',positionVector50);
scatter(prise1,AR1,30,'red','filled');
xlim( [0 0.1])
ylim([0 0.1])
xlabel('F_R','FontSize',10) 
ylabel({'Frac';'> 60N'},'FontSize',10)
hold on
scatter(prise2,AR2,30,'blue','filled')

subplot('Position',positionVector51);
scatter(pinp1,AR1,30,'red','filled');
ylim([0 0.1])
xlabel('F_T','FontSize',10) 
hold on
scatter(pinp2,AR2,30,'blue','filled')

subplot('Position',positionVector52);
scatter(pbc1,AR1,30,'red','filled'); 
ylim([0 0.1])
xlabel('F_B','FontSize',10)
hold on
scatter(pbc2,AR2,30,'blue','filled')

subplot('Position',positionVector53);
scatter(pagg1,AR1,30,'red','filled');
ylim([0 0.1])
xlabel('F_A','FontSize',10)
hold on
scatter(pagg2,AR2,30,'blue','filled')

subplot('Position',positionVector54);
scatter(kp1,AR1,30,'red','filled');
ylim([0 0.1])
xlabel('k_P','FontSize',10)
hold on
scatter(kp2,AR2,30,'blue','filled')

subplot('Position',positionVector55);
scatter(zpref1,AR1,30,'red','filled');
ylim([0 0.1])
xlabel('\psi_{MP}','FontSize',10)
hold on
scatter(zpref2,AR2,30,'blue','filled')

subplot('Position',positionVector56);
scatter(ping1,AR1,30,'red','filled');
ylim([0 0.1])
xlabel('R_{F:MP}','FontSize',10)
hold on
scatter(ping2,AR2,30,'blue','filled')
