Commit 4aa6ff42 authored by Paul Nicot's avatar Paul Nicot
Browse files

depot initial

parents
function MIZ_CIS
% function MIZ_CIS
%
% cette fonction synthétise les données de glace (date,lat,lon,width...)
% obtenu à partir des cartes de glace du CIS (traitement ArcGIS)
%
% --» données dans ~/data/MIZ_CIS/EM/
%
%
%-----------------------------------------------------------------%
% *********************** Adjust_space.m ************************ %
% Fields required by the function adjust_space.m. Please fill every
% of the following and call "adjust_space" in the script whenever
% you want.
ncol = 1; % no. subplot column
nrow = 3; % no. subplot row
dx = 0.03 ; % horiz. space between subplots
dy = 0.04; % vert. space between subplots
lefs = 0.1; % very left of figure
rigs = 0.1; % very right of figure
tops = 0.05; % top of figure
bots = 0.1; % bottom of figure
figw = (1-(lefs+rigs+(ncol-1)*dx))/ncol;
figh = (1-(tops+bots+(nrow-1)*dy))/nrow;
count_col = 1;
count_row = 1;
% *************************************************************** %
figure(1)
clf
set(gcf,'PaperUnits','centimeters','PaperPosition',[1 1 15 15])
% liste le nom des fichiers .csv
fid = dir('*.csv');
% crée une matrice
EM_MIZ = NaN(3,6,length(fid));
for i=1:length(fid);
clear file n N
N = fid(i).name;
n = datenum(str2num(N(:,4:7)), str2num(N(:,8:9)), str2num(N(:,10:11)));
EM_MIZ(:,6,i) = n;
file = csvread(N);
% une ligne par zone
% 1 = Labrador Sea
% 2 = Hudson Bay
% 3 = St. Lawrence Gulf
% 0 = en dehors des limites --> pas pris en compte
% supprime les lignes où le périmètre < 350 km
file(find(file(:,5) < 350),:) = NaN;
% et qui sont en dehors des limites (zone = 0)
file(find(file(:,1) == 0),:) = NaN;
% et dont l'indice de circularite > 0,2
%file(find(file(:,20) > 0.2),:) = NaN;
%-----------------------------------------------%
% Pour toutes les lignes du labrador (1) %
%-----------------------------------------------%
j1 = find(file(:,1) == 1);
for j=1:length(j1);
clear lat lon A P prelon prelat width widthq prewidth prewidthq
lat = file(j1(j),3);
lon = file(j1(j),2);
A = file(j1(j),4);
P = file(j1(j),5);
% precalcule des lat/lon moyennées
prelon(j) = lon*A;
prelat(j) = lat*A;
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A)./P;
prewidth(j) = width(j).*A;
% calcal de largeurs Bis (quadratic)
widthq(j) = (P-sqrt(P.^2-16.*A))./4;
prewidthq(j) = widthq(j).*A;
end
% zone
EM_MIZ(1,1,i) = 1;
% lon_x
EM_MIZ(1,2,i) = sum(prelon)/sum(A);
% lat_x
EM_MIZ(1,3,i) = sum(prelat)/sum(A);
% width
EM_MIZ(1,4,i) = sum(prewidth)/sum(A);
% width_q
EM_MIZ(1,5,i) = sum(prewidthq)/sum(A);
if isempty(j1) == 1; % si il n'y a pas de données
EM_MIZ(1,:,i) = NaN;
end
%-----------------------------------------------%
% Pour toutes les lignes de hudson (2) %
%-----------------------------------------------%
j2 = find(file(:,1) == 2);
for j=1:length(j2);
clear lat lon A P prelon prelat width widthq prewidth prewidthq
lat = file(j2(j),3);
lon = file(j2(j),2);
A = file(j2(j),4);
P = file(j2(j),5);
% precalcule des lat/lon moyennées
prelon(j) = lon*A;
prelat(j) = lat*A;
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A)./P;
prewidth(j) = width(j).*A;
% calcal de largeurs Bis (quadratic)
widthq(j) = (P-sqrt(P.^2-16.*A))./4;
prewidthq(j) = widthq(j).*A;
end
% zone
EM_MIZ(2,1,i) = 2;
% lon_x
EM_MIZ(2,2,i) = sum(prelon)/sum(A);
% lat_x
EM_MIZ(2,3,i) = sum(prelat)/sum(A);
% width
EM_MIZ(2,4,i) = sum(prewidth)/sum(A);
% width_q
EM_MIZ(2,5,i) = sum(prewidthq)/sum(A);
if isempty(j2) == 1; % si il n'y a pas de données
EM_MIZ(2,:,i) = NaN;
end
%-----------------------------------------------%
% Pour toutes les lignes de GSL (3) %
%-----------------------------------------------%
j3 = find(file(:,1) == 3);
for j=1:length(j3);
clear lat lon A P prelon prelat width widthq prewidth prewidthq
lat = file(j3(j),3);
lon = file(j3(j),2);
A = file(j3(j),4);
P = file(j3(j),5);
% precalcule des lat/lon moyennées
prelon(j) = lon*A;
prelat(j) = lat*A;
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A)./P;
prewidth(j) = width(j).*A;
% calcal de largeurs Bis (quadratic)
widthq(j) = (P-sqrt(P.^2-16.*A))./4;
prewidthq(j) = widthq(j).*A;
end
% zone
EM_MIZ(3,1,i) = 3;
% lon_x
EM_MIZ(3,2,i) = sum(prelon)/sum(A);
% lat_x
EM_MIZ(3,3,i) = sum(prelat)/sum(A);
% width
EM_MIZ(3,4,i) = sum(prewidth)/sum(A);
% width_q
EM_MIZ(3,5,i) = sum(prewidthq)/sum(A);
if isempty(j3) == 1; % si il n'y a pas de données
EM_MIZ(3,:,i) = NaN;
end;
end;
clear lat lon A P prelon prelat width widthq prewidth prewidthq
Labrador = squeeze(EM_MIZ(1,:,:));
Hudson = squeeze(EM_MIZ(2,:,:));
Gulf = squeeze(EM_MIZ(3,:,:));
figure(1)
subplot(3,1,1)
hold on
plot(Labrador(6,:),Labrador(5,:),'linewidth',1)
%plot(Labrador_FA(6,:),Labrador_FA(5,:),'r','linewidth',1)
datetick('x','dd/mm/yy')
ylim([0 150])
title('Labrador Sea - MIZ width','FontSize',14,'FontWeight','bold')
hold off
subplot(3,1,2)
hold on
plot(Hudson(6,:),Hudson(5,:),'linewidth',1)
%plot(Hudson_FA(6,:),Hudson_FA(5,:),'r','linewidth',1)
datetick('x','dd/mm/yy')
ylim([0 150])
title('Hudson Bay - MIZ width','FontSize',14,'FontWeight','bold')
hold off
subplot(3,1,3)
hold on
plot(Gulf(6,:),Gulf(5,:),'linewidth',1)
%plot(Gulf_FA(6,:),Gulf_FA(5,:),'r','linewidth',1)
datetick('x','dd/mm/yy')
ylim([0 150])
title('Gulf of St. Lawrence - MIZ width','FontSize',14,'FontWeight','bold')
hold off
figure (2)
subplot(1,3,1)
ylim([0 150])
scatter(Labrador(2,:),Labrador(3,:),5,Labrador(5,:),'filled')
subplot(1,3,2)
scatter(Hudson(2,:),Hudson(3,:),5,Hudson(5,:),'filled')
subplot(1,3,3)
scatter(Gulf(2,:),Gulf(3,:),5,Gulf(5,:),'filled')
csvwrite('MIZ_Labrador_centroid_CIS.dat',transpose(Labrador));
function MIZ_GLD(MIZ_files)
% function MIZ_GLD
%
% cette fonction synthétise les données de glace (date,lat,lon,width...)
% obtenu à partir des cartes de glace du Groenland (traitement ArcGIS
% pour obtenir la MIZ)
%
% --» données dans ~/data/MIZ_Greenland/MIZ_Greenland/
%
% "ls -1 *.bin > ctd_files"
%
%-----------------------------------------------------------------%
% *********************** Adjust_space.m ************************ %
% Fields required by the function adjust_space.m. Please fill every
% of the following and call "adjust_space" in the script whenever
% you want.
ncol = 1; % no. subplot column
nrow = 3; % no. subplot row
dx = 0.03 ; % horiz. space between subplots
dy = 0.04; % vert. space between subplots
lefs = 0.1; % very left of figure
rigs = 0.1; % very right of figure
tops = 0.05; % top of figure
bots = 0.1; % bottom of figure
figw = (1-(lefs+rigs+(ncol-1)*dx))/ncol;
figh = (1-(tops+bots+(nrow-1)*dy))/nrow;
count_col = 1;
count_row = 1;
% *************************************************************** %
figure(1)
clf
set(gcf,'PaperUnits','centimeters','PaperPosition',[1 1 15 15])
% liste le nom des fichiers .csv
%fid = dir('*Greenland_WA.csv');
% liste le nom des fichiers .shp
fid = dir('MIZ_CTaFA_*_fin.shp');
% crée une matrice
MIZ_CTaFA = NaN(3,6,length(fid));
for i=1:length(fid);
clear file n N file S*
N = fid(i).name;
file = char(N(1:18));
n = datenum(str2num(file(:,11:14)), str2num(file(:,15:16)), str2num(file(:,17:18)));
% n = datenum(str2num(file(:,8:11)), str2num(file(:,12:13)), str2num(file(:,14:15)));
MIZ_CTaFA(1:3,6,i) = n;
% Selection des polyg où le périmètre >= 350 km et par regions
%---------------------------------------------------------------
%S_grl = shaperead(N,'Selector',{@(perimeter,center_lon) (perimeter >= 350) && (center_lon > -44) && (center_lon < 8), 'perimeter','Center_Lon'});
S_grl = shaperead(N,'Selector',{@(center_lon) (center_lon > -44) && (center_lon < 8),'Center_Lon'});
%S_bar = shaperead(N,'Selector',{@(perimeter,center_lon) (perimeter >= 350) && (center_lon > 8),'perimeter','Center_Lon'});
S_bar = shaperead(N,'Selector',{@(center_lon) (center_lon > 8),'Center_Lon'});
%S_lab = shaperead(N,'Selector',{@(perimeter,center_lon) (perimeter >= 350) && (center_lon < -44),'perimeter','Center_Lon'});
S_lab = shaperead(N,'Selector',{@(center_lon) (center_lon < -44),'Center_Lon'});
%---------------------------------------------------------------
%----------------------------------------------------------%
% Pour toutes les lignes à l'Est du GRD (-44 à 8) %
% Greenland Sea %
%----------------------------------------------------------%
clear lat lon A P prelon prelat width widthq prewidth prewidthq
if isempty(S_grl) == 0; % s'il y a des données
for j=1:length(S_grl);
A(j) = S_grl(j).Area
P(j) = S_grl(j).perimeter
lat(j) = S_grl(j).Center_Lat
lon(j) = S_grl(j).Center_Lon
% precalcule des lat/lon moyennées
prelon(j) = lon(j)*A(j);
prelat(j) = lat(j)*A(j);
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A(j))./P(j);
prewidth(j) = width(j).*A(j);
% calcal de largeurs Bis (quadratic)
widthq(j) = (P(j)-sqrt(P(j).^2-16.*A(j)))./4;
prewidthq(j) = widthq(j).*A(j);
end;
% lon_x
MIZ_CTaFA(1,2,i) = sum(prelon)/sum(A);
% lat_x
MIZ_CTaFA(1,3,i) = sum(prelat)/sum(A);
% width
MIZ_CTaFA(1,4,i) = sum(prewidth)/sum(A);
% width_q
MIZ_CTaFA(1,5,i) = sum(prewidthq)/sum(A);
else
MIZ_CTaFA(1,:,i) = NaN;
end;
%------------------------------------------------------%
% Pour toutes les lignes à l'ouest du GRD (<-44) %
% Labrador Sea %
%------------------------------------------------------%
clear lat lon A P prelon prelat width widthq prewidth prewidthq
if isempty(S_lab) == 0; % s'il y a des données
for j=1:length(S_lab);
A(j) = S_lab(j).Area
P(j) = S_lab(j).perimeter
lat(j) = S_lab(j).Center_Lat
lon(j) = S_lab(j).Center_Lon
% precalcule des lat/lon moyennées
prelon(j) = lon(j)*A(j);
prelat(j) = lat(j)*A(j);
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A(j))./P(j);
prewidth(j) = width(j).*A(j);
% calcal de largeurs Bis (quadratic)
widthq(j) = (P(j)-sqrt(P(j).^2-16.*A(j)))./4;
prewidthq(j) = widthq(j).*A(j);
end;
% lon_x
MIZ_CTaFA(2,2,i) = sum(prelon)/sum(A);
% lat_x
MIZ_CTaFA(2,3,i) = sum(prelat)/sum(A);
% width
MIZ_CTaFA(2,4,i) = sum(prewidth)/sum(A);
% width_q
MIZ_CTaFA(2,5,i) = sum(prewidthq)/sum(A);
else;
MIZ_CTaFA(2,:,i) = NaN;
end;
%----------------------------------------------------------%
% Pour toutes les lignes à l'Est ( > 8) %
% Barents Sea %
%----------------------------------------------------------%
clear lat lon A P prelon prelat width widthq prewidth prewidthq
if isempty(S_bar) == 0; % s'il y a des données
for j=1:length(S_bar);
A(j) = S_bar(j).Area
P(j) = S_bar(j).perimeter
lat(j) = S_bar(j).Center_Lat
lon(j) = S_bar(j).Center_Lon
% precalcule des lat/lon moyennées
prelon(j) = lon(j)*A(j);
prelat(j) = lat(j)*A(j);
% calcul de largeurs de MIZ (2A/P)
width(j) = (2.*A(j))./P(j);
prewidth(j) = width(j).*A(j);
% calcal de largeurs Bis (quadratic)
widthq(j) = (P(j)-sqrt(P(j).^2-16.*A(j)))./4;
prewidthq(j) = widthq(j).*A(j);
end;
% lon_x
MIZ_CTaFA(3,2,i) = sum(prelon)/sum(A);
% lat_x
MIZ_CTaFA(3,3,i) = sum(prelat)/sum(A);
% width
MIZ_CTaFA(3,4,i) = sum(prewidth)/sum(A);
% width_q
MIZ_CTaFA(3,5,i) = sum(prewidthq)/sum(A);
else
MIZ_CTaFA(3,:,i) = NaN;
end;
end;
clear lat lon A P prelon prelat width widthq prewidth prewidthq
MIZ_CTaFA_GRL = squeeze(MIZ_CTaFA(1,:,:));
MIZ_CTaFA_LAB = squeeze(MIZ_CTaFA(2,:,:));
MIZ_CTaFA_BAR = squeeze(MIZ_CTaFA(3,:,:));
% Save MIZ variables
% save MIZ_Conly_GRL.mat;
% save MIZ_Conly_LAB.mat;
% save MIZ_Conly_BAR.mat;
% utilisation de la fonction errorpatch
figure(1)
title('MIZ width (km)')
subplot(3,1,1)
hold all
plot(MIZ_CToFA_GRL(6,:),MIZ_CToFA_GRL(5,:),'g','linewidth',2)
hold all
plot(MIZ_CTaFA_GRL(6,:),MIZ_CTaFA_GRL(5,:),'r','linewidth',2)
hold all
plot(MIZ_Fonly_GRL(6,:),MIZ_Fonly_GRL(5,:),'m','linewidth',2)
hold all
plot(MIZ_Conly_GRL(6,:),MIZ_Conly_GRL(5,:),'b','linewidth',2)
datetick
ylim([0 120])
title('Greenland Sea (44E to 8W)')
hold off
subplot(3,1,2)
hold all
plot(MIZ_CToFA_LAB(6,:),MIZ_CToFA_LAB(5,:),'g','linewidth',2)
hold all
plot(MIZ_CTaFA_LAB(6,:),MIZ_CTaFA_LAB(5,:),'r','linewidth',2)
hold all
plot(MIZ_Fonly_LAB(6,:),MIZ_Fonly_LAB(5,:),'m','linewidth',2)
hold all
plot(MIZ_Conly_LAB(6,:),MIZ_Conly_LAB(5,:),'b','linewidth',2)
%datetick
%ylim([0 120])
%title('Labrador Sea (< 44E)','18')
hold off
subplot(3,1,3)
hold all
plot(MIZ_CToFA_BAR(6,:),MIZ_CToFA_BAR(5,:),'g','linewidth',2)
hold all
plot(MIZ_CTaFA_BAR(6,:),MIZ_CTaFA_BAR(5,:),'r','linewidth',2)
hold all
plot(MIZ_Fonly_BAR(6,:),MIZ_Fonly_BAR(5,:),'m','linewidth',2)
hold all
plot(MIZ_Conly_BAR(6,:),MIZ_Conly_BAR(5,:),'b','linewidth',2)
%datetick
%ylim([0 120])
%title('Barents Sea (> 8W)')
hold off
for i = 1:length(MIZ_CTaFA_GRL);
x_grl(i) = MIZ_Conly_GRL(6,i);
y_grl(i) = nanmean([MIZ_Conly_GRL(5,i),MIZ_Fonly_GRL(5,i),MIZ_CTaFA_GRL(5,i),MIZ_CToFA_GRL(5,i)]);
l_grl(i) = y_grl(i) - nanmin([MIZ_Conly_GRL(5,i) MIZ_Fonly_GRL(5,i) MIZ_CTaFA_GRL(5,i) MIZ_CToFA_GRL(5,i)]);
u_grl(i) = nanmax([MIZ_Conly_GRL(5,i) MIZ_Fonly_GRL(5,i) MIZ_CTaFA_GRL(5,i) MIZ_CToFA_GRL(5,i)]) - y_grl(i);
x_bar(i) = MIZ_Conly_GRL(6,i);
y_bar(i) = nanmean([MIZ_Conly_BAR(5,i),MIZ_Fonly_BAR(5,i),MIZ_CTaFA_BAR(5,i),MIZ_CToFA_BAR(5,i)]);
l_bar(i) = y_bar(i) - nanmin([MIZ_Conly_BAR(5,i) MIZ_Fonly_BAR(5,i) MIZ_CTaFA_BAR(5,i) MIZ_CToFA_BAR(5,i)]);
u_bar(i) = nanmax([MIZ_Conly_BAR(5,i) MIZ_Fonly_BAR(5,i) MIZ_CTaFA_BAR(5,i) MIZ_CToFA_BAR(5,i)]) - y_bar(i);
x_lab(i) = MIZ_Conly_GRL(6,i);
y_lab(i) = nanmean([MIZ_Conly_LAB(5,i),MIZ_Fonly_LAB(5,i),MIZ_CTaFA_LAB(5,i),MIZ_CToFA_LAB(5,i)]);
l_lab(i) = y_lab(i) - nanmin([MIZ_Conly_LAB(5,i) MIZ_Fonly_LAB(5,i) MIZ_CTaFA_LAB(5,i) MIZ_CToFA_LAB(5,i)]);
u_lab(i) = nanmax([MIZ_Conly_LAB(5,i) MIZ_Fonly_LAB(5,i) MIZ_CTaFA_LAB(5,i) MIZ_CToFA_LAB(5,i)]) - y_lab(i);
end;
figure (2)
subplot(3,1,1)
h = errorpatch(x_grl,y_grl,l_grl,u_grl, [.6 .6 .6], 'k')
datetick
title('Greenland Sea (44E to 8W)')
ylim([0 120])
subplot(3,1,2)
h2 = errorpatch(x_lab,y_lab,l_lab,u_lab, [.6 .6 .6], 'k')
datetick
title('Labrador Sea (< 44E)')
ylim([0 120])
subplot(3,1,3)
h3 = errorpatch(x_bar,y_bar,l_bar,u_bar, [.6 .6 .6], 'k')
datetick
title('Barents Sea (> 8W)')
ylim([0 120])
figure (3)
scatter(Greenland(2,:),Greenland(3,:),50,Greenland(5,:),'filled')
hold on
scatter(Labrador(2,:),Labrador(3,:),50,Labrador(5,:),'filled')
hold off
\ No newline at end of file
function MIZ_GLD(MIZ_files)
% function MIZ_GLD
%
% cette fonction synthétise les données de glace (date,lat,lon,width...)
% obtenu à partir des cartes de glace du Groenland (traitement ArcGIS
% pour obtenir la MIZ)
%
% --» données dans ~/data/MIZ_Greenland/MIZ_Greenland/
%
% "ls -1 *.bin > ctd_files"
%
%-----------------------------------------------------------------%
% *********************** Adjust_space.m ************************ %
% Fields required by the function adjust_space.m. Please fill every
% of the following and call "adjust_space" in the script whenever
% you want.
ncol = 1; % no. subplot column
nrow = 3; % no. subplot row
dx = 0.03 ; % horiz. space between subplots
dy = 0.04; % vert. space between subplots
lefs = 0.1; % very left of figure
rigs = 0.1; % very right of figure
tops = 0.05; % top of figure
bots = 0.1; % bottom of figure
figw = (1-(lefs+rigs+(ncol-1)*dx))/ncol;
figh = (1-(tops+bots+(nrow-1)*dy))/nrow;
count_col = 1;
count_row = 1;
% *************************************************************** %
figure(1)
clf
set(gcf,'PaperUnits','centimeters','PaperPosition',[1 1 15 15])
% liste le nom des fichiers .csv
%fid = dir('*Greenland_WA.csv');