Skip to content
Snippets Groups Projects
Commit f4ce2551 authored by Jacques Grelet's avatar Jacques Grelet
Browse files

add max value from sqlite from each profile

parent d9e03a4f
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ MAIN = $(PROJECT).py
PYTHON = python
PYLINT = pylint
TEST_PATH = tests
OPTIONS_CTD = data/CTD/cnv/dfr2900[1-3].cnv -i CTD -k PRES ETDD TEMP PSAL DOX2 DENS SVEL FLU2 FLU3 TUR3 NAVG
OPTIONS_CTD = data/CTD/cnv/dfr2900?.cnv -i CTD -k PRES ETDD TEMP PSAL DOX2 DENS SVEL FLU2 FLU3 TUR3 NAVG
OPTIONS_XBT = data/XBT/T7_0000*.EDF -i XBT -k DEPTH TEMP SVEL
OPTIONS_LADCP = data/LADCP/*.lad -i LADCP -k DEPTH EWCT NSCT
......
......@@ -56,7 +56,16 @@ def writeHeader(hdrFile, cfg, device, fe, r):
print(f"{fmt} " % (fe[k][i]), end='')
f.write(f"{fmt} " % (fe[k][i]))
# get max value for each profile
col = f"MAX({fe.keys[0]})"
query = fe.db.query(f"SELECT {col} FROM data WHERE station_id = {int(fe['PROFILE'][i])}")
for idx, item in enumerate(query):
dt = item[col]
if dt == None:
pass
else:
print("%6.1f " % (item[col]))
f.write("%6.1f " % (item[col]))
print(end = '\n')
f.write('\n')
......
......@@ -427,6 +427,7 @@ if __name__ == "__main__":
for file in args.files:
files += glob(file)
# call fe with dbname='test.db' to create db file
fe = FileExtractor(files, Roscop('code_roscop.csv'), args.keys)
#print(f"File(s): {files}, Config: {args.config}")
cfg = toml.load(args.config)
......
......@@ -247,6 +247,7 @@ def process(args, cfg, ti):
args.keys = cfg['split'][device.lower()].keys()
# extract header and data from files
#fe = FileExtractor(args.files, r, args.keys, dbname='test.db')
fe = FileExtractor(args.files, r, args.keys)
# prepare (compile) each regular expression inside toml file under section [<device=ti>.header]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment