def createCsvFile(confFrame):
createCsvDir()
stationName = confFrame.stations[0].stn
prettyDate = time.strftime("%Y%m%d_%H%M%S", time.localtime())
csvFileName = "{}_{}.csv".format(prettyDate, stationName.rstrip())
csv_path = "{}/{}".format(CSV_DIR, csvFileName)
if (os.path.isfile(csv_path)):
nextIndex = getNextIndex(csv_path)
csvFileName = "{}_{}.csv".format(prettyDate, nextIndex)
csv_path = "{}/{}".format(CSV_DIR, csvFileName)
csv_handle = open(csv_path, 'w')
csv_handle.write("Timestamp")
for ch in confFrame.stations[0].channels:
csv_handle.write(",{}".format(ch.rstrip())) if ch.rstrip() != '' else None
csv_handle.write(",Freq")
csv_handle.write(",ROCOF")
csv_handle.write("\n")
return csv_handle
评论列表
文章目录