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
e243f7d7
Commit
e243f7d7
authored
4 years ago
by
thopri
Browse files
Options
Download
Email Patches
Plain Diff
ready for release 0.1 (hopefuly)
parent
d5d9f5c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
inputs/namelist_cmems.bdy
inputs/namelist_cmems.bdy
+14
-4
pynemo/tests/nemo_tide_test.py
pynemo/tests/nemo_tide_test.py
+9
-1
No files found.
inputs/namelist_cmems.bdy
View file @
e243f7d7
...
...
@@ -107,13 +107,23 @@
sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo)
clname(1) = 'M2' ! constituent name
clname(2) = 'S2'
clname(3) = 'O1'
clname(4) = 'K1'
clname(5) = 'N2'
clname(3) = 'N2'
clname(4) = 'O1'
clname(5) = 'K1'
!clname(6) = 'K2'
!clname(7) = 'L2'
!clname(8) = 'NU2'
!clname(9) = 'M4'
!clname(10) = 'MS4'
!clname(11) = 'Q1'
!clname(12) = 'P1'
!clname(13) = 'S1'
!clname(14) = '2N2'
!clname(15) = 'MU2'
ln_trans = .false. ! interpolate transport rather than velocities
ln_tide_checker = .true. ! run tide checker on PyNEMO tide output
sn_ref_model = 'fes' ! which model to check output against (FES only)
nn_amp_thres = 0.
3
0 ! amplitude thresold to compare against (m)
nn_amp_thres = 0.
1
0 ! amplitude thresold to compare against (m)
!------------------------------------------------------------------------------
! Time information
!------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
pynemo/tests/nemo_tide_test.py
View file @
e243f7d7
...
...
@@ -47,7 +47,7 @@ logging.basicConfig(filename='nrct.log', level=logging.INFO)
# TODO: add TPXO read and subset functionality currently only uses FES as "truth"
def
main
(
bdy_file
=
'inputs/namelist_cmems.bdy'
,
amplitude_threshold
=
0.
25
,
model
=
'fes'
,
model_res
=
1
/
16
):
def
main
(
bdy_file
=
'inputs/namelist_cmems.bdy'
,
amplitude_threshold
=
0.
1
,
model
=
'fes'
,
model_res
=
1
/
16
):
logger
.
info
(
'============================================'
)
logger
.
info
(
'Start Tide Test Logging: '
+
time
.
asctime
())
logger
.
info
(
'============================================'
)
...
...
@@ -161,6 +161,7 @@ def subset_reference(pynemo_out, reference):
idx_lon
=
idx_lon
.
astype
(
np
.
int64
)
amp_sub
=
reference
[
'amp'
][
idx_lat
,
idx_lon
]
# surpress warnings due to NaNmean
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
,
category
=
RuntimeWarning
)
for
i
in
range
(
np
.
shape
(
amp_sub
)[
1
]):
...
...
@@ -271,6 +272,7 @@ def compare_tides(pynemo_out,subset,amp_thres,model_res):
exceed_sum
=
np
.
sum
(
exceed_lat
+
exceed_lon
)
if
exceed_sum
>
0
:
raise
Exception
(
'Dont Panic: Lat and/or Lon further away from model point than model resolution'
)
# surpress warnings as NaNs from averaging surrounding pixels can cause issues
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
,
category
=
RuntimeWarning
)
# compare amp
...
...
@@ -301,10 +303,12 @@ def compare_tides(pynemo_out,subset,amp_thres,model_res):
abs_ph_thres
=
abs_ph
>
phase_thres
err_pha
=
pynemo_out
[
'phase'
][
abs_ph_thres
[
0
,:]].
tolist
()
err_pha_amp
=
pynemo_out
[
'amp'
][
abs_ph_thres
].
tolist
()
err_pha_lats
=
pynemo_out
[
'lat'
][
abs_ph_thres
].
tolist
()
err_pha_lons
=
pynemo_out
[
'lon'
][
abs_ph_thres
].
tolist
()
err_ref_pha
=
subset
[
'phase'
][
abs_ph_thres
].
tolist
()
err_ref_pha_amp
=
subset
[
'amp'
][
abs_ph_thres
].
tolist
()
err_ref_lats_pha
=
subset
[
'lat'
][
abs_ph_thres
].
tolist
()
err_ref_lons_pha
=
subset
[
'lon'
][
abs_ph_thres
].
tolist
()
...
...
@@ -312,9 +316,11 @@ def compare_tides(pynemo_out,subset,amp_thres,model_res):
max_len
=
max
(
lerr_pha
,
lerr_amp
)
if
not
max_len
==
lerr_pha
:
err_pha
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_pha_amp
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_pha_lats
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_pha_lons
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_ref_pha
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_ref_pha_amp
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_ref_lats_pha
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
err_ref_lons_pha
.
extend
([
''
]
*
(
max_len
-
lerr_pha
))
if
not
max_len
==
lerr_amp
:
...
...
@@ -334,7 +340,9 @@ def compare_tides(pynemo_out,subset,amp_thres,model_res):
'phase_lat'
:
err_pha_lats
,
'phase_lon'
:
err_pha_lons
,
'phase'
:
err_pha
,
'phase_amp'
:
err_pha_amp
,
'ref_phase'
:
err_ref_pha
,
'ref_phase_amp'
:
err_ref_pha_amp
,
'ref_phase_lats'
:
err_ref_lats_pha
,
'ref_phase_lons'
:
err_ref_lons_pha
})
...
...
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