Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
thopri
PyNEMO
Commits
57e91468
Commit
57e91468
authored
5 years ago
by
James Harle
Browse files
Options
Download
Email Patches
Plain Diff
2to3 update
parent
ca637fde
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
pynemo/tests/gcoms_break_depth_test.py
pynemo/tests/gcoms_break_depth_test.py
+6
-6
pynemo/tests/nemo_bdy_msk_c_test.py
pynemo/tests/nemo_bdy_msk_c_test.py
+2
-2
pynemo/tests/nemo_bdy_setup_test.py
pynemo/tests/nemo_bdy_setup_test.py
+7
-7
pynemo/tests/reader_ncml_test.py
pynemo/tests/reader_ncml_test.py
+5
-5
No files found.
pynemo/tests/gcoms_break_depth_test.py
View file @
57e91468
...
...
@@ -23,8 +23,8 @@ class Test(unittest.TestCase):
self
.
lon
,
self
.
lat
=
np
.
meshgrid
(
self
.
lon
,
self
.
lat
)
#gcoms_break_depth.gcoms_boundary_masks(self.bathy, -1, 0)
print
self
.
bathy
.
shape
print
self
.
bathy
print
(
self
.
bathy
.
shape
)
print
(
self
.
bathy
)
pass
...
...
@@ -39,10 +39,10 @@ class Test(unittest.TestCase):
self
.
bathy
[
self
.
bathy
>=
0
]
=
0
self
.
bathy
=
self
.
bathy
*-
1
tmp
=
gcoms_break_depth
.
polcoms_select_domain
(
self
.
bathy
,
self
.
lat
,
self
.
lon
,
roi
,
200
)
self
.
assertEqual
s
(
tmp
[
32
,
0
],
1
,
"Set the break select correctly"
)
self
.
assertEqual
s
(
tmp
[
40
,
0
],
1
,
"Set the break select correctly 40"
)
self
.
assertEqual
s
(
tmp
[
50
,
0
],
1
,
"Set the break select correctly 50"
)
self
.
assertEqual
s
(
tmp
[
60
,
0
],
1
,
"Set the break select correctly 60"
)
self
.
assertEqual
(
tmp
[
32
,
0
],
1
,
"Set the break select correctly"
)
self
.
assertEqual
(
tmp
[
40
,
0
],
1
,
"Set the break select correctly 40"
)
self
.
assertEqual
(
tmp
[
50
,
0
],
1
,
"Set the break select correctly 50"
)
self
.
assertEqual
(
tmp
[
60
,
0
],
1
,
"Set the break select correctly 60"
)
def
testGcomsBreakDepth
(
self
):
r
=
18
...
...
This diff is collapsed.
Click to expand it.
pynemo/tests/nemo_bdy_msk_c_test.py
View file @
57e91468
...
...
@@ -11,8 +11,8 @@ class Test(unittest.TestCase):
def
testMaskData
(
self
):
mask
=
Mask
(
'data/grid_C/NNA_R12_bathy_meter_bench.nc'
)
print
mask
.
data
.
shape
self
.
assertEqual
(
mask
.
data
.
shape
,(
401
L
,
351
L
),
'Mask reading failed'
)
print
(
mask
.
data
.
shape
)
self
.
assertEqual
(
mask
.
data
.
shape
,(
401
,
351
),
'Mask reading failed'
)
if
__name__
==
"__main__"
:
...
...
This diff is collapsed.
Click to expand it.
pynemo/tests/nemo_bdy_setup_test.py
View file @
57e91468
...
...
@@ -45,7 +45,7 @@ class Test(unittest.TestCase):
#test
setup
=
Setup
(
'test.bdy'
)
self
.
assertEqual
s
(
setup
.
settings
,{
'nonambigious'
:
True
},
"Didn't recognize valid setting"
)
self
.
assertEqual
(
setup
.
settings
,{
'nonambigious'
:
True
},
"Didn't recognize valid setting"
)
#delete file
os
.
remove
(
'test.bdy'
)
...
...
@@ -64,12 +64,12 @@ class Test(unittest.TestCase):
#test
setup
=
Setup
(
'test.bdy'
)
print
setup
.
settings
self
.
assertEqual
s
(
setup
.
settings
[
'nonambigious'
],
False
,
"Didn't recognize logical setting"
)
self
.
assertEqual
s
(
setup
.
settings
[
'floatval'
],
10.9
,
"Didn't recognize rn value in setting"
)
self
.
assertEqual
s
(
setup
.
settings
[
'floatval2'
],
20.9
,
"Didn't recongnize nn value in setting"
)
self
.
assertEqual
s
(
setup
.
settings
[
'stringval'
],
'coordinates.nc'
,
"Didn't recognize cn string value in setting"
)
self
.
assertEqual
s
(
setup
.
settings
[
'stringval2'
],
'gregorian'
,
"Didn't recognize sn string value in setting"
)
print
(
setup
.
settings
)
self
.
assertEqual
(
setup
.
settings
[
'nonambigious'
],
False
,
"Didn't recognize logical setting"
)
self
.
assertEqual
(
setup
.
settings
[
'floatval'
],
10.9
,
"Didn't recognize rn value in setting"
)
self
.
assertEqual
(
setup
.
settings
[
'floatval2'
],
20.9
,
"Didn't recongnize nn value in setting"
)
self
.
assertEqual
(
setup
.
settings
[
'stringval'
],
'coordinates.nc'
,
"Didn't recognize cn string value in setting"
)
self
.
assertEqual
(
setup
.
settings
[
'stringval2'
],
'gregorian'
,
"Didn't recognize sn string value in setting"
)
#delete file
os
.
remove
(
'test.bdy'
)
...
...
This diff is collapsed.
Click to expand it.
pynemo/tests/reader_ncml_test.py
View file @
57e91468
...
...
@@ -34,7 +34,7 @@ class Test(unittest.TestCase):
testfile
=
os
.
path
.
join
(
testpath
,
"testremote.ncml"
)
sd
=
Reader
(
testfile
,
0
).
grid
dataset
=
Data2
(
sd
.
dataset
,
"time_counter"
)
self
.
assertEqual
s
(
len
(
dataset
),
8
,
"There should 8 datasets"
)
self
.
assertEqual
(
len
(
dataset
),
8
,
"There should 8 datasets"
)
def
testVariable
(
self
):
init_jnius
()
...
...
@@ -80,11 +80,11 @@ class Test(unittest.TestCase):
testpath
,
file_name
=
os
.
path
.
split
(
__file__
)
testfile
=
os
.
path
.
join
(
testpath
,
"testremote.ncml"
)
repo
=
Reader
(
testfile
,
0
)
self
.
assertEqual
s
(
len
(
repo
[
't'
].
time_counter
),
8
,
"Time counter should be 8"
)
self
.
assertEqual
s
(
repo
[
't'
].
time_counter
[
0
],
691416000
,
"The first time value doesn't match"
)
self
.
assertEqual
(
len
(
repo
[
't'
].
time_counter
),
8
,
"Time counter should be 8"
)
self
.
assertEqual
(
repo
[
't'
].
time_counter
[
0
],
691416000
,
"The first time value doesn't match"
)
repo
=
Reader
(
testfile
,
100
)
self
.
assertEqual
s
(
len
(
repo
[
't'
].
time_counter
),
8
,
"Time counter should be 8"
)
self
.
assertEqual
s
(
repo
[
't'
].
time_counter
[
0
],
691416100
,
"The first time value doesn't match"
)
self
.
assertEqual
(
len
(
repo
[
't'
].
time_counter
),
8
,
"Time counter should be 8"
)
self
.
assertEqual
(
repo
[
't'
].
time_counter
[
0
],
691416100
,
"The first time value doesn't match"
)
if
__name__
==
"__main__"
:
#import sys;sys.argv = ['', 'Test.testName']
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment