Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions backup_py/convert_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def phpfina_get_meta(datadir,feedid):

def phpfina_convert(datadir,csvdir,feedid,tag,name):
meta = phpfina_get_meta(datadir,feedid)
csv_fh = open(csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv","w")
csv_path = csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv"
csv_path= csv_path.replace(":", "-") # this is needed on windows at least because ":" are not allowed in file names
csv_fh = open(csv_path,"w")
fh = open(datadir+str(feedid)+".dat","rb")
for i in range(0,meta['npoints']):
time = meta['start_time'] + i*meta['interval']
Expand All @@ -32,8 +34,9 @@ def phptimeseries_convert(datadir,csvdir,feedid,tag,name):
if os.path.isfile(datadir+"feed_"+str(feedid)+".MYD"):
bytesize = os.stat(datadir+"feed_"+str(feedid)+".MYD").st_size
npoints = int(bytesize/9.0)

csv_fh = open(csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv","w")
csv_path = csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv"
csv_path = csv_path.replace(":", "-") # this is needed on windows at least because ":" are not allowed in file names
csv_fh = open(csv_path,"w")
fh = open(datadir+"feed_"+str(feedid)+".MYD","rb")

for i in range(0,npoints):
Expand Down