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

correct date in profile header to EPIC format

parent 3832b565
No related branches found
No related tags found
No related merge requests found
...@@ -99,8 +99,9 @@ def writeDataProfile(dataFile, cfg, device, fe, r): ...@@ -99,8 +99,9 @@ def writeDataProfile(dataFile, cfg, device, fe, r):
if k == 'PROFILE' or k == 'PRFL': if k == 'PROFILE' or k == 'PRFL':
f.write(f"{fmt} -1 " % (fe[k][i])) f.write(f"{fmt} -1 " % (fe[k][i]))
elif k == 'TIME': elif k == 'TIME':
# save date in EPIC format (numeric) in profile header
f.write(f" {fmt} {'%s'}" % (fe[k][i] - fe.julian_from_year, f.write(f" {fmt} {'%s'}" % (fe[k][i] - fe.julian_from_year,
tools.julian2format(fe[k][i]))) tools.julian2format(fe[k][i], "%Y%m%d%H%M%S")))
else: else:
if np.isnan(fe[k][i]): if np.isnan(fe[k][i]):
#print(k, type(fe[k][i])) #print(k, type(fe[k][i]))
......
...@@ -408,6 +408,8 @@ class Profile: ...@@ -408,6 +408,8 @@ class Profile:
if process_data: if process_data:
# reset sql dict to use with data table
sql = {}
# now, extract and process all data # now, extract and process all data
# split the line, remove leading and trailing space before # split the line, remove leading and trailing space before
p = line.strip().split(self.__separator) p = line.strip().split(self.__separator)
...@@ -420,16 +422,16 @@ class Profile: ...@@ -420,16 +422,16 @@ class Profile:
if cfg[device.lower()]['skipLineWith'] in p[-1]: if cfg[device.lower()]['skipLineWith'] in p[-1]:
continue continue
sql = {}
# insert data from list p with indice hash[key] # insert data from list p with indice hash[key]
#[sql[key] = p[hash[key]] for key in self.keys] #[sql[key] = p[hash[key]] for key in self.keys]
sql['station_id'] = pk sql['station_id'] = pk
for key in self.keys: for key in self.keys:
if key == 'ETDD' and 'julianOrigin' in cfg[device.lower()]: if key == 'ETDD' and 'julianOrigin' in cfg[device.lower()]:
sql[key] = float(p[hash[key]]) - float(self.julianOrigin) sql[key] = float(p[hash[key]]) - float(self.julianOrigin)
else: else:
logging.debug(f"{key}, {hash[key]}, {p[hash[key]]}") logging.debug(f"{key}, {hash[key]}, {p[hash[key]]}")
sql[key] = float(p[hash[key]]) sql[key] = float(p[hash[key]])
#self.db.insert("data", station_id = 1, PRES = 1, TEMP = 20, PSAL = 35, DOX2 = 20, DENS = 30) #self.db.insert("data", station_id = 1, PRES = 1, TEMP = 20, PSAL = 35, DOX2 = 20, DENS = 30)
self.db.insert("data", sql ) self.db.insert("data", sql )
......
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