Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Oceano2python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
Oceano2python
Commits
e70bfbec
Commit
e70bfbec
authored
5 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
update tests
parent
d532e0fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test.toml
+31
-31
31 additions, 31 deletions
tests/test.toml
tests/test_config.py
+69
-23
69 additions, 23 deletions
tests/test_config.py
with
100 additions
and
54 deletions
tests/test.toml
+
31
−
31
View file @
e70bfbec
...
@@ -27,16 +27,16 @@ titleSummary = "CTD profiles processed during PIRATA-FR29 cruise"
...
@@ -27,16 +27,16 @@ titleSummary = "CTD profiles processed during PIRATA-FR29 cruise"
typeInstrument
=
"SBE911+"
typeInstrument
=
"SBE911+"
instrumentNumber
=
"09P1263"
instrumentNumber
=
"09P1263"
[ctd.header]
[ctd.header]
isHeader
=
'^[*#]'
isHeader
=
'^[*#]'
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
=
'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)
'
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*'
bottomDepth
=
'Bottom Depth\s*:\s*(\d*\.?\d+?)\s*\S*'
operator
=
'Operator\s*:\s*(.*)'
operator
=
'Operator\s*:\s*(.*)'
type
=
'Type\s*:\s*(.*)'
type
=
'Type\s*:\s*(.*)'
[btl]
[btl]
typeInstrument
=
"SBE32 standard 24 Niskin bottles"
typeInstrument
=
"SBE32 standard 24 Niskin bottles"
...
@@ -120,27 +120,27 @@ comment = "Extract from .lad files"
...
@@ -120,27 +120,27 @@ comment = "Extract from .lad files"
NAVG
=
23
NAVG
=
23
[split.ctdAll]
[split.ctdAll]
ETDD
=
2
ETDD
=
1
PRES
=
3
PRES
=
2
DEPTH
=
4
DEPTH
=
3
TE01
=
5
TE01
=
4
TE02
=
6
TE02
=
5
CND1
=
7
CND1
=
6
CND2
=
8
CND2
=
7
DOV1
=
9
DOV1
=
8
DOV2
=
10
DOV2
=
9
DVT1
=
1
1
DVT1
=
1
0
DVT2
=
1
2
DVT2
=
1
1
TUR3
=
1
3
TUR3
=
1
2
FLU2
=
1
4
FLU2
=
1
3
FLU3
=
1
5
FLU3
=
1
4
DO12
=
1
6
DO12
=
1
5
DO22
=
1
7
DO22
=
1
6
PSA1
=
1
8
PSA1
=
1
7
PSA2
=
1
9
PSA2
=
1
8
DEN1
=
20
DEN1
=
19
DEN2
=
2
1
DEN2
=
2
0
SVEL
=
2
2
SVEL
=
2
1
NAVG
=
23
NAVG
=
23
[split.btl]
[split.btl]
...
...
This diff is collapsed.
Click to expand it.
tests/test_config.py
+
69
−
23
View file @
e70bfbec
...
@@ -15,48 +15,70 @@ class testConfig(unittest.TestCase):
...
@@ -15,48 +15,70 @@ class testConfig(unittest.TestCase):
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
,
'
codeRoscop
'
:
'
C:\git\python\oceano2python\code_roscop.csv
'
,
'
debug
'
:
False
,
'
echo
'
:
True
,
'
ascii
'
:
"
ascii
"
,
'
netcdf
'
:
"
netcdf
"
,
'
odv
'
:
"
odv
"
}
'
codeRoscop
'
:
'
C:\git\python\oceano2python\code_roscop.csv
'
,
'
ascii
'
:
"
ascii
"
,
'
netcdf
'
:
"
netcdf
"
,
'
odv
'
:
"
odv
"
}
self
.
cruise
=
{
'
cycleMesure
'
:
'
PIRATA-FR29
'
,
'
plateforme
'
:
'
THALASSA
'
,
'
callsign
'
:
'
FNFP
'
,
'
institute
'
:
'
IRD
'
,
self
.
cruise
=
{
'
cycleMesure
'
:
'
PIRATA-FR29
'
,
'
timezone
'
:
'
GMT
'
,
'
beginDate
'
:
'
01/03/2019
'
,
'
endDate
'
:
'
04/04/2019
'
,
'
pi
'
:
'
BOURLES
'
,
'
plateforme
'
:
'
THALASSA
'
,
'
creator
'
:
'
Jacques.Grelet@ird.fr
'
}
'
callsign
'
:
'
FNFP
'
,
'
institute
'
:
'
IRD
'
,
'
timezone
'
:
'
GMT
'
,
'
beginDate
'
:
'
01/03/2019
'
,
'
endDate
'
:
'
04/04/2019
'
,
'
pi
'
:
'
BOURLES
'
,
'
creator
'
:
'
Jacques.Grelet@ird.fr
'
}
self
.
ctd
=
{
'
cruisePrefix
'
:
'
fr29
'
,
'
station
'
:
'
Station
\\
s*:
\\
s*
\\
D*(
\\
d*)
'
,
'
stationPrefixLength
'
:
3
,
self
.
ctd
=
{
'
cruisePrefix
'
:
'
fr29
'
,
'
titleSummary
'
:
'
CTD profiles processed during PIRATA-FR29 cruise
'
,
'
typeInstrument
'
:
'
SBE911+
'
,
'
station
'
:
'
Station\s*:\s*\D*(\d*)
'
,
'
instrumentNumber
'
:
'
09P1263
'
,
'
stationPrefixLength
'
:
3
,
'
header
'
:
{
'
isHeader
'
:
'
^[*#]
'
,
'
isDevice
'
:
'
^
\\
*
\\
s+(Sea-Bird)
'
,
'
titleSummary
'
:
'
CTD profiles processed during PIRATA-FR29 cruise
'
,
'
typeInstrument
'
:
'
SBE911+
'
,
'
instrumentNumber
'
:
'
09P1263
'
}
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*
'
,
'
operator
'
:
'
Operator
\\
s*:
\\
s*(.*)
'
,
'
bottomDepth
'
:
'
Bottom Depth\s*:\s*(\d*\.?\d+?)\s*\S*
'
,
'
type
'
:
'
Type
\
\
s*:
\
\
s*(.*)
'
}
'
operator
'
:
'
Operator
\s*:\s*(.*)
'
,
}
'
type
'
:
'
Type\s*:\s*(.*)
'
}
self
.
xbt
=
{
'
cruisePrefix
'
:
"
fr29
"
,
'
stationPrefixLength
'
:
3
,
'
acquisitionSoftware
'
:
"
WinMK21
"
,
self
.
xbt
=
{
'
cruisePrefix
'
:
"
fr29
"
,
'
acquisitionVersion
'
:
"
2.10.1
"
,
'
processingSoftware
'
:
""
,
'
processingVersion
'
:
""
,
'
stationPrefixLength
'
:
3
,
'
type
'
:
"
SIPPICAN
"
,
'
sn
'
:
"
01150
"
,
'
title_summary
'
:
"
XBT profiles processed during PIRATA-FR29 cruise
"
,
'
typeInstrument
'
:
"
SIPPICAN+
"
,
'
comment
'
:
"
Extract from .edf files
"
,
'
instrumentNumber
'
:
"
N/A
"
,
'
header
'
:
{
'
endHeader
'
:
'
Depth\s*\(m\)
'
,
'
acquisitionSoftware
'
:
"
WinMK21
"
,
'
acquisitionVersion
'
:
"
2.10.1
"
,
'
processingSoftware
'
:
""
,
'
processingVersion
'
:
""
,
'
type
'
:
"
SIPPICAN
"
,
'
sn
'
:
"
01150
"
,
'
title_summary
'
:
"
XBT profiles processed during PIRATA-FR29 cruise
"
,
'
comment
'
:
"
Extract from .edf files
"
}
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
'
:
2
,
'
PRES
'
:
3
,
'
DEPTH
'
:
4
,
'
TEMP
'
:
5
,
'
PSAL
'
:
1
8
,
self
.
splitCtd
=
{
'
ETDD
'
:
1
,
'
PRES
'
:
2
,
'
DEPTH
'
:
3
,
'
TEMP
'
:
4
,
'
PSAL
'
:
1
7
,
'
DENS
'
:
20
,
'
SVEL
'
:
2
2
,
'
DOX2
'
:
1
6
,
'
FLU2
'
:
1
4
,
'
FLU3
'
:
1
5
,
'
TUR3
'
:
1
3
,
'
NAVG
'
:
23
}
'
DENS
'
:
19
,
'
SVEL
'
:
2
1
,
'
DOX2
'
:
1
5
,
'
FLU2
'
:
1
3
,
'
FLU3
'
:
1
4
,
'
TUR3
'
:
1
2
,
'
NAVG
'
:
23
}
self
.
splitCtdAll
=
{
'
ETDD
'
:
2
,
'
PRES
'
:
3
,
'
DEPTH
'
:
4
,
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
'
:
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
}
def
test_global
(
self
):
def
test_global
(
self
):
'''
test block [global]
'''
'''
test block [global]
'''
...
@@ -74,8 +96,17 @@ class testConfig(unittest.TestCase):
...
@@ -74,8 +96,17 @@ class testConfig(unittest.TestCase):
'''
test block [ctd]
'''
'''
test block [ctd]
'''
d
=
self
.
cfg
[
'
ctd
'
]
d
=
self
.
cfg
[
'
ctd
'
]
for
k
in
d
.
keys
():
for
k
in
d
.
keys
():
# problem with nested table
if
k
==
'
header
'
:
break
self
.
assertEqual
(
d
[
k
],
self
.
ctd
[
k
])
self
.
assertEqual
(
d
[
k
],
self
.
ctd
[
k
])
def
test_ctd_header
(
self
):
'''
test block [ctd.header]
'''
d
=
self
.
cfg
[
'
ctd
'
][
'
header
'
]
for
k
in
d
.
keys
():
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
'
]
...
@@ -94,11 +125,26 @@ class testConfig(unittest.TestCase):
...
@@ -94,11 +125,26 @@ class testConfig(unittest.TestCase):
for
k
in
d
.
keys
():
for
k
in
d
.
keys
():
self
.
assertEqual
(
d
[
k
],
self
.
splitBtl
[
k
])
self
.
assertEqual
(
d
[
k
],
self
.
splitBtl
[
k
])
def
test_
split_
xbt
(
self
):
def
test_xbt
(
self
):
"""
Test if all value in block [xbt] are correct
"""
"""
Test if all value in block [xbt] are correct
"""
d
=
self
.
cfg
[
'
xbt
'
]
d
=
self
.
cfg
[
'
xbt
'
]
for
k
in
d
.
keys
():
for
k
in
d
.
keys
():
# problem with nested table
if
k
==
'
header
'
:
break
self
.
assertEqual
(
d
[
k
],
self
.
xbt
[
k
])
self
.
assertEqual
(
d
[
k
],
self
.
xbt
[
k
])
def
test_xbt_header
(
self
):
'''
test block [xbt.header]
'''
d
=
self
.
cfg
[
'
xbt
'
][
'
header
'
]
for
k
in
d
.
keys
():
self
.
assertEqual
(
d
[
k
],
self
.
xbtHeader
[
k
])
def
test_split_xbt
(
self
):
"""
Test if all value in block [split.xbt] are correct
"""
d
=
self
.
cfg
[
'
split
'
][
'
xbt
'
]
for
k
in
d
.
keys
():
self
.
assertEqual
(
d
[
k
],
self
.
splitXbt
[
k
])
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
unittest
.
main
()
unittest
.
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment