Skip to content

Commit

Permalink
Added script to make daytimex
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchharley committed Feb 1, 2021
1 parent a4f8610 commit 2a7c731
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions CSPmakeDayTimex.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function CSPmakeDayTimex(site,matlabday1,matlabday2)

[epochtimes,filenames,filepaths,tide_levels] = CSPgetImageList(site,'Processed');
siteDB = CSPreadSiteDB(site);
matlabtimes = epoch2Matlab(epochtimes)+siteDB.timezone.gmt_offset/24; %Convert to local time
matlabtimes_vec = datevec(matlabtimes);
I = find(ismember(matlabtimes_vec(:,4),[7:18])); %Only use images between 8am and 6pm
matlabtimes = matlabtimes(I);
matlabdays = matlabday1:matlabday2;

for i = 1:length(matlabdays)
disp(['Doing days ' num2str(i) ' of ' num2str(length(matlabdays))])
Iday = find(floor(matlabtimes)==matlabdays(i));
if length(Iday)>2
II = uint32(imread(fullfile(filepaths(Iday(1)).name,filenames(Iday(1)).name)));
for j = 2:length(Iday)
%Snap = uint32(imread(fullfile(filepaths(Iday(j)).name,filenames(Iday(j)).name)));
II = imadd(II,uint32(imread(fullfile(filepaths(Iday(j)).name,filenames(Iday(j)).name))));
end
I = imdivide(II,length(Iday));
fparts = CSPparseFilename(filenames(Iday(j)).name);
epochtime = matlab2Epoch(matlabdays(i)+siteDB.timezone.gmt_offset/24);
fparts.type = 'daytimex';
newname = CSPargusFilename(epochtime,site,-1,fparts.type,fparts.user,'jpg');
imwrite(uint8(I),fullfile(filepaths(Iday(j)).name,newname),'jpg','quality',100);
end
end



0 comments on commit 2a7c731

Please sign in to comment.