1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| folder=('E:\matrices\')
compteur = 0
%reading of satellite matrices (hdf)
ousuisje=pwd;
cd(folder);
file=dir('*.hdf');
directory=cellstr(char(file.name)) ;
ndir=length(directory);
for i=1:ndir
if i==1 % first image processed
L2map=char(directory(i));
compteur=compteur+1;
chlor_a = hdfread(L2map, '/chlor_a', 'Index', {[1 1],[1 1],[1827 1221]}); chlor_a = double(chlor_a); chlor_a = 1*chlor_a+0;
else % second and other images processed
L2map1=char(directory(i-1));
L2map1 = L2map1(2:8)
L2map=char(directory(i));
julien = L2map(2:8)
TF = strcmp(L2map1,julien)
if TF == 1 % if dates are similar
compteur=compteur+0;
L2map_ini=char(directory(i));
chlor_a_new = hdfread(L2map, '/chlor_a', 'Index', {[1 1],[1 1],[1827 1221]});chlor_a_new = double(chlor_a_new); chlor_a_new = 1*chlor_a_new+0;
chlor_a_final=max(chlor_a,chlor_a_new) ; chlor_a_final = double(chlor_a_final);
else % if dates are different
compteur=compteur+1;
% creation hdf5 file of the date d
chlor_a_final=chlor_a_final;
h5create(L2map1,'.h5', '/dataset1', size(chlor_a_final));
h5write(L2map1,'.h5', '/dataset1', chlor_a_final);
% read new data day d+1
L2map=char(directory(i));
chlor_a = hdfread(L2map, '/chlor_a', 'Index', {[1 1],[1 1],[1827 1221]}); chlor_a = double(chlor_a); chlor_a = 1*chlor_a+0;
end
end
end |
Partager