rawmerger: write_table_all() for direct csv output of merged table
This commit is contained in:
parent
0bd96a1426
commit
4ce51b55c7
@ -33,3 +33,5 @@ cdef extern from "../lib/rawmerge.hpp":
|
|||||||
vector[double] get_channel(int)
|
vector[double] get_channel(int)
|
||||||
# get total merged time series
|
# get total merged time series
|
||||||
vector[double] get_time_series()
|
vector[double] get_time_series()
|
||||||
|
# dump all channels to .csv
|
||||||
|
void write_table_all(const char*,char)
|
||||||
|
@ -53,3 +53,6 @@ cdef class rawmerger:
|
|||||||
|
|
||||||
def get_time_series(self):
|
def get_time_series(self):
|
||||||
return self.rawit.get_time_series()
|
return self.rawit.get_time_series()
|
||||||
|
|
||||||
|
def write_table_all(self, const char* csvfile, char delimiter):
|
||||||
|
return self.rawit.write_table_all(csvfile,delimiter)
|
||||||
|
@ -296,7 +296,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// print all data to file
|
// print all data to file
|
||||||
void write_table(std::string filename, char delimiter = ',', int precision = 6, int width = 25)
|
void write_table_all(std::string filename, char delimiter = ',', int precision = 6, int width = 25)
|
||||||
{
|
{
|
||||||
// if at least one channel including its time series is present
|
// if at least one channel including its time series is present
|
||||||
if ( timeseries_.size() > 0 && channels_.size() > 0 )
|
if ( timeseries_.size() > 0 && channels_.size() > 0 )
|
||||||
|
@ -83,6 +83,9 @@ for rf in rawlist :
|
|||||||
# show summary of successfully merged channels
|
# show summary of successfully merged channels
|
||||||
print("\nmerged channels:\n")
|
print("\nmerged channels:\n")
|
||||||
|
|
||||||
|
# write merged table to .csv output
|
||||||
|
eatmea.write_table_all('allchannels.csv'.encode(),ord(','))
|
||||||
|
|
||||||
# get number of successfully merged channels and their names (+units)
|
# get number of successfully merged channels and their names (+units)
|
||||||
numch = eatmea.get_num_channels()
|
numch = eatmea.get_num_channels()
|
||||||
chnames = [chnm.decode(encoding='UTF-8',errors='ignore') for chnm in eatmea.get_channel_names()]
|
chnames = [chnm.decode(encoding='UTF-8',errors='ignore') for chnm in eatmea.get_channel_names()]
|
||||||
@ -118,6 +121,6 @@ pq.write_table(pyarwtab,'allchannels.parquet',compression='BROTLI') # compressi
|
|||||||
# try to read and decode the .parquet file
|
# try to read and decode the .parquet file
|
||||||
df = pq.read_table('allchannels.parquet')
|
df = pq.read_table('allchannels.parquet')
|
||||||
print(df.to_pandas())
|
print(df.to_pandas())
|
||||||
df.to_pandas().to_csv('allchannels.csv',index=False,encoding='utf-8',sep=",")
|
# df.to_pandas().to_csv('allchannels.csv',index=False,encoding='utf-8',sep=",")
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user