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

fix bug in writeHeaderProfile, use i+1

parent 678fdfc0
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ def writeHeaderProfile(hdrFile, cfg, device, fe, r):
# get max value for each profile, DEPTH or PRES is the first value => keys[0]
col = f"MAX({fe.keys[0]})"
query = fe.db.query(
f"SELECT {col} FROM data WHERE station_id = {i}")
f"SELECT {col} FROM data WHERE station_id = {i+1}")
for idx, item in enumerate(query):
dt = item[col]
if dt == None:
......
......@@ -24,7 +24,7 @@ def writeProfile(cfg, device, fe, r):
fileName = "{}/OS_{}_{}.nc".format(cfg['global']
['NETCDF'], cfg['cruise']['CYCLEMESURE'], device)
print(f"writing netCDF file: {fileName}", end='', flush=True)
print(f"writing netCDF file: {fileName}")
if not os.path.exists(cfg['global']['NETCDF']):
os.makedirs(cfg['global']['NETCDF'])
......@@ -81,6 +81,7 @@ def writeProfile(cfg, device, fe, r):
setattr(ncvars[key], k, hash[k])
nc._enddef()
print("Writing Global attributes")
# add global attributes
nc.data_type = "OceanSITES profile data"
nc.Conventions = "CF-1.7"
......@@ -110,6 +111,7 @@ def writeProfile(cfg, device, fe, r):
# write the ncvars
for key in variables:
print(f"Writing variable : {key}")
if any(key in item for item in fe.variables_1D):
ncvars[key][:] = fe[key]
else:
......@@ -117,7 +119,7 @@ def writeProfile(cfg, device, fe, r):
# close the NETCDF file
nc.close()
print(' done...')
print('done...')
def writeTrajectory(cfg, device, fe, r):
......
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