I have new string from file ("new.dat") to be merge with file ("old.dat").
File : "new.dat"
WBGG 120200Z VRB03KT 9000 FEW015 BKN160 28/25 Q1013 NOSIG
File : "old.dat"
WBGG 120130Z VRB02KT 9000 FEW015 BKN150 27/25 Q1013 NOSIG
WBGG 120100Z VRB02KT 9999 FEW014 BKN150 26/25 Q1012 NOSIG
The expected output will overwrite and became new ("old.dat")
WBGG 120200Z VRB03KT 9000 FEW015 BKN160 28/25 Q1013 NOSIG
WBGG 120130Z VRB02KT 9000 FEW015 BKN150 27/25 Q1013 NOSIG
WBGG 120100Z VRB02KT 9999 FEW014 BKN150 26/25 Q1012 NOSIG
The process will continue as the new string in "new.dat" appeared in the system. The result from the current script is weird. Anyone got ideas?
new=open("new.dat","r")
old=open("old.dat","r")
for line1 in new:
data1=line1
for line2 in old:
data2=line2
newdata=np.array([data1,data2])
## overwrite file and become old file
newfile = open("old.dat", 'w')
newfile.write(newdata)
newfile.close()