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

update with ascii human file, dot extension

parent 5ef587da
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ OPTIONS_LADCP = data/LADCP/*.lad -i LADCP -k DEPTH EWCT NSCT
OPTIONS_BTL = data/CTD/btl/fr290*.btl -i BTL -k BOTL PRES DEPTH ETDD TE01 TE02 PSA1 PSA2 DO11 DO12 DO21 DO22 FLU2
OPTIONS_COLCOR = data/TSG/COLCOR/*.colcor -i TSG -k SSJT SSTP SSPS
OPTIONS_SEASAVE = data/TSG/SEASAVE/*.cnv -i TSG -k SSJT SSTP SSPS
OPTIONS_CASINO = data/CASINO/*.csv -i CASINO -k LATITUDE LONGITUDE SSJT SSTP SSPS
OPTIONS_CASINO = data/CASINO/*.csv -i CASINO -k LATITUDE LONGITUDE SSJT SSTP SSPS WMSP WDIR
.PHONY: clean-pyc clean-build lint test run build
......
......@@ -142,7 +142,7 @@ def writeProfile(cfg, device, fe, r):
writeDataProfile(fileName, cfg, device.lower(), fe, r)
print(' done...')
def writeDataTrajectory(dataFile, cfg, device, fe, r):
def writeDecimalDataTrajectory(dataFile, cfg, device, fe, r):
f = open(dataFile, 'w')
# write header, first line
......@@ -160,6 +160,7 @@ def writeDataTrajectory(dataFile, cfg, device, fe, r):
for k in fe.keys:
f.write(f" {k} ")
f.write("\n")
# write data
for n in range(fe.n):
for k in fe.keys:
fmt = fe.roscop[k]['format']
......@@ -170,19 +171,64 @@ def writeDataTrajectory(dataFile, cfg, device, fe, r):
f.write("\n")
f.close()
def writeHumanDataTrajectory(dataFile, cfg, device, fe, r):
f = open(dataFile, 'w')
# write header, first line
f.write("{} {} {} ".format(cfg['cruise']['CYCLEMESURE'],
cfg['cruise']['PLATEFORME'], cfg['cruise']['INSTITUTE']))
if 'typeInstrument' in cfg[device]:
f.write(f"{cfg[device]['typeInstrument']}")
if 'instrumentNumber' in cfg[device]:
f.write(f"{cfg[device]['instrumentNumber']}")
if 'PI' in cfg['cruise']:
f.write(f"{cfg['cruise']['PI']}")
f.write("\n")
# write header, second line with physical parameter liste, fill with N/A if necessary
for k in fe.keys:
if k == 'DAYD':
f.write(" DATE TIME ")
continue
f.write(f" {k} ")
f.write("\n")
# write data
for n in range(fe.n):
for k in fe.keys:
if k == 'LATITUDE':
f.write(f" {tools.Dec2dmc(fe[k][n],'N')} ")
continue
if k == 'LONGITUDE':
f.write(f" {tools.Dec2dmc(fe[k][n],'E')} ")
continue
if k == 'DAYD':
dt = tools.julian2dt(fe[k][n])
f.write(f" {dt.strftime('%d/%m/%Y %H:%M:%S')} ")
continue
fmt = fe.roscop[k]['format']
if '_FillValue' in fe.roscop[k] and fe[k][n] == fe.roscop[k]['_FillValue']:
f.write(' 1e+36 ')
else:
f.write(f" {fmt} " % (fe[k][n]))
f.write("\n")
f.close()
def writeTrajectory(cfg, device, fe, r):
if not os.path.exists(cfg['global']['ASCII']):
os.makedirs(cfg['global']['ASCII'])
# fileName = "{}/{}.{}".format(cfg['global']['ASCII'],
# cfg['cruise']['CYCLEMESURE'], device.lower())
# logging.debug('writing header file: {}'.format(fileName))
# writeHeaderProfile(fileName, cfg, device.lower(), fe, r, )
# write ascii file with human read time and position
fileName = "{}/{}.{}".format(cfg['global']['ASCII'],
cfg['cruise']['CYCLEMESURE'], device.lower())
print('writing file: {}'.format(fileName), end='', flush=True)
writeHumanDataTrajectory(fileName, cfg, device.lower(), fe, r, )
print(' done...')
# write ascii file with decimal time and position
fileName = "{}/{}_{}".format(cfg['global']['ASCII'],
cfg['cruise']['CYCLEMESURE'], device.lower())
print('writing data file: {}'.format(fileName), end='', flush=True)
writeDataTrajectory(fileName, cfg, device.lower(), fe, r)
print('writing file: {}'.format(fileName), end='', flush=True)
writeDecimalDataTrajectory(fileName, cfg, device.lower(), fe, r)
print(' done...')
\ No newline at end of file
......@@ -18,12 +18,12 @@ DOX2,float32,dissolved oxygen,moles_of_oxygen_per_unit_mass_in_sea_water,micromo
DENS,float32,density,sea_water_density,kg/m3,,TIME DEPTH LATITUDE LONGITUDE,,-1.5,38,%6.3f,1E+36,,0.001,Ocean density,,,,,
SVEL,float32,sound velocity,speed_of_sound_in_sea_water,meter/second,,TIME DEPTH LATITUDE LONGITUDE,,1350,1600,%7.2f,1E+36,,0.001,Ocean sound velocity,,,,,
DRYT,float32,air temperature,air_temperature,degree_Celsius,,TIME DEPTH LATITUDE LONGITUDE,,-1.5,38,%6.3f,1E+36,,0.001,Air temperature,,,,,
WMSP,float32,wind speed - max aver per 2 mn,wind_speed,meter/second,,TIME DEPTH LATITUDE LONGITUDE,,0,200,%6.3f,1E+36,,0.001,Horizontal wind speed,,,,,
WDIR,float32,wind direction rel. true north,wind_to_direction,degree,,TIME DEPTH LATITUDE LONGITUDE,,0,360,%5.1f,1E+36,,0.001,Horizontal wind speed,,,,,
ATMS,float32,atmospheric pressure - sea lev,air_pressure_at_sea_level,hectoPascal,,TIME DEPTH LATITUDE LONGITUDE,,940,1030,%8.3f,1E+36,,0.001,Atmospheric pressure at sea level,,,,,
RELH,float32,relative humidity,relative_humidity,%,,TIME DEPTH LATITUDE LONGITUDE,,0,100,%6.1f,1E+36,,0.001,Relative humidity,,,,,
NSCT,float32,current north component,,cm/second,,TIME DEPTH LATITUDE LONGITUDE,,-100,100,%7.3f,1E+36,,0.01," Current north",,,,,
EWCT,float32,current east component,,cm/second,,TIME DEPTH LATITUDE LONGITUDE,,-100,100,%7.3f,1E+36,,0.02,Current east,,,,,
WMSP,float32,wind speed - max aver per 2 mn,wind_speed,meter/second,,TIME DEPTH LATITUDE LONGITUDE,,0,200,%4.1f,1E+36,,0.001,Horizontal wind speed,,,,,
WDIR,float32,wind direction rel. true north,wind_to_direction,degree,,TIME DEPTH LATITUDE LONGITUDE,,0,360,%3.0f,1E+36,,0.001,Horizontal wind speed,,,,,
ATMS,float32,atmospheric pressure - sea lev,air_pressure_at_sea_level,hectoPascal,,TIME DEPTH LATITUDE LONGITUDE,,940,1030,%6.1f,1E+36,,0.001,Atmospheric pressure at sea level,,,,,
RELH,float32,relative humidity,relative_humidity,%,,TIME DEPTH LATITUDE LONGITUDE,,0,100,%4.1f,1E+36,,0.001,Relative humidity,,,,,
NSCT,float32,current north component,,cm/second,,TIME DEPTH LATITUDE LONGITUDE,,-100,100,%7.2f,1E+36,,0.01," Current north",,,,,
EWCT,float32,current east component,,cm/second,,TIME DEPTH LATITUDE LONGITUDE,,-100,100,%7.2f,1E+36,,0.02,Current east,,,,,
SSJT,float32,sea surface water jacket temperature,sea_water_temperature,degree_Celsius,,TIME DEPTH LATITUDE LONGITUDE,,-1.5,38,%6.3f,-300,,0.001,Ocean temperature,,,,,
SSTP,float32,sea surface water temperature,sea_water_temperature,degree_Celsius,,TIME DEPTH LATITUDE LONGITUDE,,-1.5,38,%6.3f,-300,,0.001,Sea surface Ocean temperature,,,,,
SSPS,float32,sea surface practical salinity,"sea_water_salinity ",pss,,TIME DEPTH LATITUDE LONGITUDE,,-1.5,38,%6.3f,-1,,0.001,Ocean salinity,,,,,
......
......@@ -258,3 +258,7 @@ comment = "Extract from .csv files"
SSTP = 94
SSJT = 95
SSPS = 96
WMSP = 65
WDIR = 64
DRYT = 66
RELH = 68
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