Skip to content
Snippets Groups Projects
Commit 44c37397 authored by jacques Grelet's avatar jacques Grelet
Browse files

add codeRoscop

parent 8e3828c2
No related branches found
No related tags found
No related merge requests found
...@@ -13,71 +13,72 @@ class testConfig(unittest.TestCase): ...@@ -13,71 +13,72 @@ class testConfig(unittest.TestCase):
def setUp(self): def setUp(self):
"""Initialisation des tests.""" """Initialisation des tests."""
self.cfg = toml.load('tests/test.toml') self.cfg = toml.load('tests/test.toml')
self.glob = {'author': 'jgrelet IRD March 2019 PIRATA-FR29 cruise', self.glob = {'author': 'jgrelet IRD March 2019 PIRATA-FR29 cruise',
'debug': False, 'echo': True, 'debug': False, 'echo': True,
'codeRoscop': 'C:\git\python\oceano2python\code_roscop.csv', # 'codeRoscop': 'C:\git\python\oceano2python\code_roscop.csv',
'ascii': "ascii", 'codeRoscop': '/home/jgrelet/git/oceano2python/code_roscop.csv',
'netcdf': "netcdf", 'ascii': "ascii",
'odv': "odv"} 'netcdf': "netcdf",
'odv': "odv"}
self.cruise = {'cycleMesure': 'PIRATA-FR29',
'plateforme': 'THALASSA', self.cruise = {'cycleMesure': 'PIRATA-FR29',
'callsign': 'FNFP', 'plateforme': 'THALASSA',
'institute': 'IRD', 'callsign': 'FNFP',
'timezone': 'GMT', 'institute': 'IRD',
'beginDate': '01/03/2019', 'timezone': 'GMT',
'endDate': '04/04/2019', 'beginDate': '01/03/2019',
'pi': 'BOURLES', 'endDate': '04/04/2019',
'creator': 'Jacques.Grelet@ird.fr'} 'pi': 'BOURLES',
'creator': 'Jacques.Grelet@ird.fr'}
self.ctd = {'cruisePrefix': 'fr29',
'station': 'Station\s*:\s*\D*(\d*)', self.ctd = {'cruisePrefix': 'fr29',
'station': 'Station\s*:\s*\D*(\d*)',
'stationPrefixLength': 3, 'stationPrefixLength': 3,
'titleSummary': 'CTD profiles processed during PIRATA-FR29 cruise', 'titleSummary': 'CTD profiles processed during PIRATA-FR29 cruise',
'typeInstrument': 'SBE911+', 'typeInstrument': 'SBE911+',
'instrumentNumber': '09P1263'} 'instrumentNumber': '09P1263'}
self.ctdHeader = {'isHeader': '^[*#]', self.ctdHeader = {'isHeader': '^[*#]',
'LATITUDE': 'NMEA\s+Latitude\s*[:=]\s*(\d+)\s+(\d+\.\d+)\s+(\w)', 'LATITUDE': 'NMEA\s+Latitude\s*[:=]\s*(\d+)\s+(\d+\.\d+)\s+(\w)',
'LONGITUDE': 'NMEA\s+Longitude\s*[:=]\s*(\d+)\s+(\d+.\d+)\s+(\w)', 'LONGITUDE': 'NMEA\s+Longitude\s*[:=]\s*(\d+)\s+(\d+.\d+)\s+(\w)',
'DATETIME': 'System UpLoad Time\s*=\s*(\w+)\s+(\d+)\s+(\d+)\s+(\d+):(\d+):(\d+)', 'DATETIME': 'System UpLoad Time\s*=\s*(\w+)\s+(\d+)\s+(\d+)\s+(\d+):(\d+):(\d+)',
'DATE': 'Date\s*:\s*(\d+)/(\d+)/(\d+)', 'DATE': 'Date\s*:\s*(\d+)/(\d+)/(\d+)',
'TIME': '[Heure|Hour]\s*:\s*(\d+)[:hH](\d+):(\d+)', 'TIME': '[Heure|Hour]\s*:\s*(\d+)[:hH](\d+):(\d+)',
'bottomDepth': 'Bottom Depth\s*:\s*(\d*\.?\d+?)\s*\S*', 'BATH': 'Bottom Depth\s*:\s*(\d*\.?\d+?)\s*\S*',
'operator': 'Operator\s*:\s*(.*)', 'operator': 'Operator\s*:\s*(.*)',
'type': 'Type\s*:\s*(.*)'} 'type': 'Type\s*:\s*(.*)'}
self.xbt = {'cruisePrefix': "fr29", self.xbt = {'cruisePrefix': "fr29",
'stationPrefixLength': 3, 'stationPrefixLength': 3,
'typeInstrument': "SIPPICAN+", 'typeInstrument': "SIPPICAN+",
'instrumentNumber': "N/A", 'instrumentNumber': "N/A",
'acquisitionSoftware': "WinMK21", 'acquisitionSoftware': "WinMK21",
'acquisitionVersion': "2.10.1", 'acquisitionVersion': "2.10.1",
'processingSoftware': "", 'processingVersion': "", 'processingSoftware': "", 'processingVersion': "",
'type': "SIPPICAN", 'type': "SIPPICAN",
'sn': "01150", 'sn': "01150",
'title_summary': "XBT profiles processed during PIRATA-FR29 cruise", 'title_summary': "XBT profiles processed during PIRATA-FR29 cruise",
'comment': "Extract from .edf files"} 'comment': "Extract from .edf files"}
self.xbtHeader = {'endHeader': 'Depth\s*\(m\)', self.xbtHeader = {'endHeader': 'Depth\s*\(m\)',
'TIME': 'Time of Launch\s*[:=]\s*(\d+):(\d+):(\d+)', 'TIME': 'Time of Launch\s*[:=]\s*(\d+):(\d+):(\d+)',
'DATE': 'Date of Launch\s*[:=]\s*(\d+)/(\d+)/(\d+)', 'DATE': 'Date of Launch\s*[:=]\s*(\d+)/(\d+)/(\d+)',
'DATETIME': 'System UpLoad Time\s*=\s*(\w+)\s+(\d+)\s+(\d+)\s+(\d+):(\d+):(\d+)', 'DATETIME': 'System UpLoad Time\s*=\s*(\w+)\s+(\d+)\s+(\d+)\s+(\d+):(\d+):(\d+)',
'LATITUDE': 'Latitude\s*[:=]\s*(\d+)\s+(\d+\.\d+)(\w)', 'LATITUDE': 'Latitude\s*[:=]\s*(\d+)\s+(\d+\.\d+)(\w)',
'LONGITUDE': 'Longitude\s*[:=]\s*(\d+)\s+(\d+.\d+)(\w)'} 'LONGITUDE': 'Longitude\s*[:=]\s*(\d+)\s+(\d+.\d+)(\w)'}
self.splitCtd = {'ETDD': 1, 'PRES': 2, 'DEPTH': 3, 'TEMP': 4, 'PSAL': 17, self.splitCtd = {'ETDD': 1, 'PRES': 2, 'DEPTH': 3, 'TEMP': 4, 'PSAL': 17,
'DENS': 19, 'SVEL': 21, 'DOX2': 15, 'FLU2': 13, 'FLU3': 14, 'TUR3': 12, 'NAVG': 23} 'DENS': 19, 'SVEL': 21, 'DOX2': 15, 'FLU2': 13, 'FLU3': 14, 'TUR3': 12, 'NAVG': 23}
self.splitCtdAll = {'ETDD': 1, 'PRES': 2, 'DEPTH': 3, 'TE01': 4, 'TE02': 5, 'CND1': 6, 'CND2': 7, 'DOV1': 8, 'DOV2': 9, 'DVT1': 10, 'DVT2': 11, self.splitCtdAll = {'ETDD': 1, 'PRES': 2, 'DEPTH': 3, 'TE01': 4, 'TE02': 5, 'CND1': 6, 'CND2': 7, 'DOV1': 8, 'DOV2': 9, 'DVT1': 10, 'DVT2': 11,
'TUR3': 12, 'FLU2': 13, 'FLU3': 14, 'DO12': 15, 'DO22': 16, 'PSA1': 17, 'PSA2': 18, 'DEN1': 19, 'DEN2': 20, 'SVEL': 21, 'NAVG': 23} 'TUR3': 12, 'FLU2': 13, 'FLU3': 14, 'DO12': 15, 'DO22': 16, 'PSA1': 17, 'PSA2': 18, 'DEN1': 19, 'DEN2': 20, 'SVEL': 21, 'NAVG': 23}
self.splitBtl = {'BOTL': 1, 'month': 2, 'day': 3, 'year': 4, 'PSA1': 5, 'PSA2': 6, 'DO11': 7, self.splitBtl = {'BOTL': 1, 'month': 2, 'day': 3, 'year': 4, 'PSA1': 5, 'PSA2': 6, 'DO11': 7,
'DO12': 8, 'DO21': 9, 'DO22': 10, 'Potemp090C': 11, 'Potemp190C': 12, 'DO12': 8, 'DO21': 9, 'DO22': 10, 'Potemp090C': 11, 'Potemp190C': 12,
'ETDD': 13, 'PRES': 14, 'DEPH': 15, 'TE01': 16, 'TE02': 17, 'CND1': 18, 'CND2': 19, 'ETDD': 13, 'PRES': 14, 'DEPH': 15, 'TE01': 16, 'TE02': 17, 'CND1': 18, 'CND2': 19,
'DOV1': 20, 'DOV2': 21, 'DVT1': 22, 'DVT2': 23, 'TUR3': 24, 'FLU2': 25} 'DOV1': 20, 'DOV2': 21, 'DVT1': 22, 'DVT2': 23, 'TUR3': 24, 'FLU2': 25}
self.splitXbt = {'DEPTH': 0, 'TEMP': 1, 'SVEL': 2} self.splitXbt = {'DEPTH': 0, 'TEMP': 1, 'SVEL': 2}
def test_global(self): def test_global(self):
...@@ -100,13 +101,13 @@ class testConfig(unittest.TestCase): ...@@ -100,13 +101,13 @@ class testConfig(unittest.TestCase):
if k == 'header': if k == 'header':
break break
self.assertEqual(d[k], self.ctd[k]) self.assertEqual(d[k], self.ctd[k])
def test_ctd_header(self): def test_ctd_header(self):
''' test block [ctd.header]''' ''' test block [ctd.header]'''
d = self.cfg['ctd']['header'] d = self.cfg['ctd']['header']
for k in d.keys(): for k in d.keys():
self.assertEqual(d[k], self.ctdHeader[k]) self.assertEqual(d[k], self.ctdHeader[k])
def test_split_ctd(self): def test_split_ctd(self):
""" Test if all value in block [split.ctd] are correct """ """ Test if all value in block [split.ctd] are correct """
d = self.cfg['split']['ctd'] d = self.cfg['split']['ctd']
...@@ -133,18 +134,19 @@ class testConfig(unittest.TestCase): ...@@ -133,18 +134,19 @@ class testConfig(unittest.TestCase):
if k == 'header': if k == 'header':
break break
self.assertEqual(d[k], self.xbt[k]) self.assertEqual(d[k], self.xbt[k])
def test_xbt_header(self): def test_xbt_header(self):
''' test block [xbt.header]''' ''' test block [xbt.header]'''
d = self.cfg['xbt']['header'] d = self.cfg['xbt']['header']
for k in d.keys(): for k in d.keys():
self.assertEqual(d[k], self.xbtHeader[k]) self.assertEqual(d[k], self.xbtHeader[k])
def test_split_xbt(self): def test_split_xbt(self):
""" Test if all value in block [split.xbt] are correct """ """ Test if all value in block [split.xbt] are correct """
d = self.cfg['split']['xbt'] d = self.cfg['split']['xbt']
for k in d.keys(): for k in d.keys():
self.assertEqual(d[k], self.splitXbt[k]) self.assertEqual(d[k], self.splitXbt[k])
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
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