%function ACSE_campbell_mast_wrapper


di{1}='F:\ACSE_AWS\ACSE_GPS_data';
di{2}='F:\ACSE_AWS\ACSE_WxStat_data';
di{3}='F:\ACSE_AWS\ACSE_WxStat_Volt_data';

do{1}='F:\working\STKH_WX\GPS';
do{2}='F:\working\STKH_WX\WxStat';
do{3}='F:\working\STKH_WX\WxStat_volt';

%read raw files
for n=1:3
    list=dir(di{n});
    for m=3:length(list)
        display(fullfile(di{n},list(m).name))
        if (n==1)
            [data]=get_campbell_gps(fullfile(di{n},list(m).name));
            DT=[num2str(data.PC_TIME(1,1)),num2str(data.PC_TIME(1,2)),num2str(data.PC_TIME(1,3)),'_',num2str(data.PC_TIME(1,4))];
            save(fullfile(do{n},['GPS_',DT,'.mat']),'data')
            clear data DT
        end
        if (n==2)
            [data]=get_campbell_WxStat(fullfile(di{n},list(m).name));
            DT=[num2str(data.PC_TIME(1,1)),num2str(data.PC_TIME(1,2)),num2str(data.PC_TIME(1,3)),'_',num2str(data.PC_TIME(1,4))];
            save(fullfile(do{n},['Wx_',DT,'.mat']),'data')
            clear data DT
        end
        if (n==3)
            [data]=get_campbell_WxStat_volt(fullfile(di{n},list(m).name));
            DT=[num2str(data.PC_TIME(1,1)),num2str(data.PC_TIME(1,2)),num2str(data.PC_TIME(1,3)),'_',num2str(data.PC_TIME(1,4))];
            save(fullfile(do{n},['Wx_volt_',DT,'.mat']),'data')
            clear data DT
        end

    end
end    