SetDirectory["\\\\pcmerit03\\MERITdata\\"];
<<"prolog.m";
SetDirectory["\\\\pcmerit03\\MERITdata\\"]
FileNames[]

(* Adding additional file during runs *)
SetDirectory["\\\\pcmerit03\\MERITdata\\"];
logo=ReadList["071015 logfile.txt","String"];
triggers=Select[logo,StringPosition[#,"2007"]≠{}&&StringPosition[#,{"Triggered mode: trigger received"}]≠ {}&]
triggers=Map[FromDate[{2007,10,15,ToExpression[StringTake[#,{13,14}]],ToExpression[StringTake[#,{16,17}]],ToExpression[StringTake[#,{19,20}]]}]&,
triggers]
SetDirectory["c:\\MERIT Data\\"]
Export["newtemp.txt",
Select[logo,StringPosition[#,"2007"]≠{}&&StringPosition[#,{"e","t"}]=={}&]
]
CryoCycle=FromDate[{2007,10,15,16,00,00}];

SetDirectory["c:\\MERIT Data\\"]
(* DeleteFile["c:\\\\data0\\Merit\\TemperatureReading\\Temperatures.txt"]
CopyFile["\\\\pcmerit03\\MERITdata\\Temperatures.txt","c:\\\\data0\\Merit\\TemperatureReading\\Temperatures.txt"] *)

data=ReadList["Temperatures.txt","String"];
cols=Join[{"date","time"},Drop[StringSplit[data[[2]],{"\t"}],{1}]];
MatrixForm[Transpose[{Table[ToString[m],{m,15}],cols}]]
dim=Dimensions[data][[1]]-2;
Export["temp.txt",Drop[data,2]];
(* remove comment lines *)
test=ReadList["temp.txt",String];
Export["temp.txt",
Select[test,StringPosition[#,{"Sensor","Time"}]=={}&]
]
(* ++++++++++++++ *)
data=ReadList["temp.txt",{"Word","Word","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number"}];
newdata=ReadList["newtemp.txt",{"Word","Word","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number","Number"}];
data=Transpose[Join[Take[data,9420],newdata,Drop[data,9420]]];

date=data[[1]];
time=data[[2]];
time=FromDate/@Transpose[{(ToExpression[StringTake[#1,{7,10}]]&)/@date,(ToExpression[StringTake[#1,{1,2}]]&)/@date,(ToExpression[StringTake[#1,{4,5}]]&)/@date,(ToExpression[StringTake[#1,{1,2}]]&)/@time,(ToExpression[StringTake[#1,{4,5}]]&)/@time,(ToExpression[StringTake[#1,{7,8}]]&)/@time}];
HourFreq=3;
timing=Table[m,{m,AbsoluteTime[Join[Take[DateList[time[[1]]],{1,3}],{0,0,0}]],time[[-1]]+4 3600,3600 HourFreq}];
xaxis=({#1,ToString[DateList[#1][[4]]]<>":00"}&)/@timing;
xaxis2=({#1,ToString[DateList[#1][[3]]]<>"/"<>ToString[DateList[#1][[2]]]}&)/@timing;
Do[If[xaxis2[[m,2]]==xaxis2[[m-1,2]],xaxis2=Drop[xaxis2,{m}]],{m,Length[xaxis2],2,-1}];
loc=Transpose[data][[-1]]
ColorTable={RGBColor[0,0,1],RGBColor[0,0,1],RGBColor[0,0,1],RGBColor[0,0,1],RGBColor[0,0,0],RGBColor[0,0,0],RGBColor[0,0,0],RGBColor[1,0,0]};
StartTime=AbsoluteTime[{2007,10,13,10,0,0}];EndTime=AbsoluteTime[{2007,10,16,10,0,0}];
If[False,{StartTime=time[[1]],EndTime=time[[-1]]}];
If[True,{StartTime=FromDate[Date[]]-1.5*24*3600,EndTime=FromDate[Date[]]}];

Show[ListPlot[{(Transpose[{time,#1}]&)/@Take[data,{4,11}]}[[1]],FrameLabel->{"","Temperature (([)^o)C]"},FrameTicks->{xaxis,Automatic,xaxis2,None},Joined->False,PlotRange->{{StartTime,EndTime+(EndTime-StartTime) 0.22`},{10,45}},ImageSize->1000],Graphics[{Text[StringDrop[cols[[4]],-3],{time[[-1]],loc[[4]]},{-1,0}],Text[StringDrop[cols[[5]],-3],{time[[-1]],loc[[5]]},{-1,0}],Text[StringDrop[cols[[6]],-3],{time[[-1]],loc[[6]]},{-1,0}],Text[StringDrop[cols[[7]],-3],{time[[-1]],loc[[7]]},{-1,0}],Text[StringDrop[cols[[8]],-3],{time[[-1]],loc[[8]]},{-1,0}],Text[StringDrop[cols[[9]],-3],{time[[-1]],loc[[9]]},{-1,0}],Text[StringDrop[cols[[10]],-3],{time[[-1]],loc[[10]]},{-1,0}],Text[StringDrop[cols[[11]],-3],{time[[-1]],loc[[11]]},{-1,0}],Text[StringTake[cols[[13]],{8,16}]<>ToString[loc[[13]] (10^3)]<>" μg/(m^3)",{time[[-1]],15},{-1,0}]}],Graphics[{Text["Primary heater failed",{AbsoluteTime[{2007,10,11,15,0,0}],35},{-1,0},{0,1}],Text["Second. heater failed",{AbsoluteTime[{2007,10,12,5,0,0}],35},{-1,0},{0,1}],Text["Vacuum intervention",{AbsoluteTime[{2007,10,15,10,0,0}],35},{-1,0},{0,1}],Line[{{triggers[[1]],15},{triggers[[1]],40}}],Line[{{triggers[[2]],15},{triggers[[2]],40}}],Line[{{triggers[[3]],15},{triggers[[3]],40}}],Line[{{triggers[[4]],15},{triggers[[4]],40}}],Line[{{triggers[[5]],15},{triggers[[5]],40}}],{AbsoluteThickness[5],Line[{{CryoCycle,14},{CryoCycle+60 40,14}}]}}]]

Export["graph.gif",%]