
% Extract proxy data
clear
%loadclbd1
%loadclbd2
%load_hires
load_critreg

% extract lat
j=1;for i=2:(length(dataArray)-1); lat{j}=[dataArray{i}(2)];j=j+1;end
plat1=[lat{:}];
S = sprintf('%s*', plat1{:});
p_lat = sscanf(S, '%f*')';

clear lat plat1
j=1;for i=2:(length(dataArray)-1); lat{j}=[dataArray{i}(3)];j=j+1;end
plat1=[lat{:}];
S = sprintf('%s*', plat1{:});
p_lon = sscanf(S, '%f*')';

% extract archive type
j=1;for i=2:(length(dataArray)-1); archive{j}=[dataArray{i}(4)];j=j+1;end
archive=[archive{:}]';

% extract proxy data type
j=1;for i=2:(length(dataArray)-1); pty{j}=[dataArray{i}(6)];j=j+1;end
proxy_names=[pty{:}];

%load pv2_0_0_clbrmvd
%load pv2_0_0
%load pv2_0_0_hires.mat
load('pv2_0_0_critreg.mat')

%year=yrs(:)';
year=year(:)';

%proxy_ama=proxyama2_clbrmvd;
proxy_ama=proxyama2_critreg;

%save(['/d1/nsteiger/proxy-data/PAGES2k_v2/v2_0_0/proxy_ama_2.0.0_calib-removed_1881_1916_1995_0.67.mat'],...
%    'archive','p_lat','p_lon','year','proxy_ama','proxy_names')
%save(['/d1/nsteiger/proxy-data/PAGES2k_v2/v2_0_0/proxy_ama_2.0.0_calib-selection_1881_1916_1995_0.67.mat'],...
%    'archive','p_lat','p_lon','year','proxy_ama','proxy_names')
%save(['/d1/nsteiger/proxy-data/PAGES2k_v2/v2_0_0/proxy_ama_2.0.0_highres.mat'],...
%    'archive','p_lat','p_lon','year','proxy_ama','proxy_names')
save(['/d1/nsteiger/proxy-data/PAGES2k_v2/v2_0_0/proxy_ama_2.0.0_calib-selection_1881_1916_1995_0.67_infilled_DINEOF_PAGES-crit-regional+FDR.mat'],...
    'archive','p_lat','p_lon','year','proxy_ama','proxy_names')

