%%%%%%%%%%%%%%%%%%%% Create Annual Excel Files from Monthly ones %%%%%%%%%%%%%%%%%%% % >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DATES LIST of Data Loggers CHANGES in each station: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< % % KEF-3 / PERIOD 2 >> '020A0029' after 21/07/2016 > > > after 1/7/2016 in the HD Directory % KEF-1 / PERIOD 2 >> '020A0022' after 14/08/2017 > > > after 1/8/2017 in the HD Directory % KEF-2 / PERIOD 2 >> '041A0260' after 18/08/2017 > > > after 1/9/2017 in the HD Directory % KEF-2 / PERIOD 3 >> '041A0267' after 22/09/2018 > > > after 1/10/2018 in the HD Directory % KEF-3 / PERIOD 3 >> '041A0262' after 23/09/2018 > > > after 1/9/2018 in the HD Directory % KTL-1 / PERIOD 3 >> '049A0638' after 04/01/2022 > > > after 1/1/2022 in the HD Directory % PAX-1 / PERIOD 2 >> '041A0261' after 29/07/2020 > > > after 1/08/2020 in the HD Directory % % >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< % >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DATA LOGGERS LOCATION and IDENTITY S/N <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< % ist==1; STATION= ('otranto', 'APL-1', 'OTRANTO-APULIA'); % ist==2; STATION= ('leuca', 'APL-2', 'LEUCA-APULIA'); % ist==3; STATION= ('lecce', 'APL-3', 'LECCE-APULIA'); % ist==4; STATION= ('041A0258', 'CRF-1', 'AYLIOTES-CORFU'); % 'CRF-1'/ PERIOD 2 >> '041A0263' after 1/8/2021 > > > after 1/8/2021 in the HD Directory % ist==5; STATION= ('041A0264', 'CRF-2', 'TEMPLONI-CORFU'); % ist==6; STATION= ('041A0266', 'CRF-3', 'KORISION-CORFU'); % ist==7; STATION= ('041A0263', 'PAX-1', 'PAXOS'); % PAX-1 / PERIOD 2 >> '041A0261' after 29/07/2020 > > > after 1/8/2020 in the HD Directory % ist==8; STATION= ('041A0259', 'LFK-1', 'LEFKADA'); % ist==9; STATION= ('041A0260', 'KEF-1', 'ANTYPATA-CEPHALONIA'); % KEF-1 / PERIOD 2 >> '020A0022' after 14/08/2017 > > > after 1/8/2017 in the HD Directory % ist==10; STATION=('041A0261', 'KEF-2', 'KIPOURIA-CEPHALONIA'); % KEF-2 / PERIOD 2 >> '041A0260' after 18/08/2017 > > > after 1/9/2017 in the HD Directory % KEF-2 / PERIOD 3 >> '041A0267' after 22/09/2018 > > > after 1/10/2018 in the HD Directory % ist==11; STATION=('041A0262', 'KEF-3', 'SKALA-CEPHALONIA'); % KEF-3 / PERIOD 2 >> '020A0029' after 21/07/2016; % KEF-3 / PERIOD 3 >> '041A0262' after 23/09/2018 > > > after 1/9/2018 in the HD Directory % ist==12; STATION=('041A0268', 'ZKT-3', 'SKINARI-ZAKYNTHOS'); % ist==13; STATION=('041A0270', 'ZKT-2', 'AIRPORT-ZAKYNTHOS'); % ist==14; STATION=('041A0265', 'ZKT-1', 'AGALAS-ZAKYNTHOS'); % ist==15; STATION=('041A0271', 'KTL-1', 'KATAKOLO-ILIA'); % KTL-1 / PERIOD 2 >> '041A0273' after 2/12/2019 > > > after 1/12/2019 in the HD Directory % KTL-1 / PERIOD 3 >> '049A0638' after 4/ 1/2022 > > > after 1/ 1/2022 in the HD Directory % ist==16; STATION=('041A0273', 'CRF-4', 'CORFU-TOWN') begun in 23 Sep 2020 ; % ist==17; STATION=('041A0269', 'ZKT-4', 'XENIA'); clear; station='LFK-1'; year='2022'; %% path = pwd; path = 'C:\A_A_PROJECTS\A_A_INTEREG_IV\STATIONS\A_CLIMATIC_BASE\REVIEWS\MONTHLY_MATRIXES\IW_STATs'; %% Define the MONTHLY Matrices OUTPUT Directory path=[path '\' station '\MandA Data\' station '_' year]; S = dir([path '\*.xls']); %% % create "list" ( month numbers matching month position ) n = 0; list = []; list_month = {'January','February','March','April','May','June','July','August','September','October','November','December'}'; % ΗμεÏ?ολογιακό έτος % list_month = {'July','August','September','October','November','December','January','February','March','April','May','June'}'; % ΥδÏ?ολογικό έτος for k = 1:numel(S) tmp = split(S(k).name,{'_','_','.'}); % keep only the month string extracted from excel file filename [tf,idx] = ismember(tmp{2},list_month); % look for membership with month list (idx contains position in list) list(k) = idx; end list = list(list>0); % remove non valid xls files [newlist,order] = sort(list); out = []; for k = 1:numel(order) filename = S(order(k)).name % see command window - excel files are processed in correct order F = fullfile(path,filename); data = readtable(F); out = [out;data]; end data = out; Date = datetime(data{:,1}, 'InputFormat','yyyy-MM-dd'); Time = datetime(data{:,2}, 'InputFormat','HH:mm'); %Time = datetime(data{:,2}, 'InputFormat','HH:mm','Locale','system'); %Time = datetime(data{:,2}, 'InputFormat','HH:mm', 'Format', 'preserveinput'); date_time = table(Date+timeofday(Time), 'VariableNames',{'DateTime'}); %% Date and Time columns combined datesonly = table(Date.Year,Date.Month,Date.Day,'VariableNames',{'YYYY','MM','DD'}); timesOnly = table(Time.Hour,Time.Minute, 'VariableNames',{'HH','mm'}); data = [datesonly timesOnly data(:,3:end)]; %% ΞεχωÏ?ιστές στήλες το TIMESTAMP date_time = table2array(date_time); filename_new = [station '_' year '.xlsx']; pathOUT=[path '\' filename_new]; writetable(data,pathOUT,'WriteVariableNames',1);