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
602269e8
Commit
602269e8
authored
4 years ago
by
thopri
Browse files
Options
Download
Email Patches
Plain Diff
fixed units issue and tide test output bug
parent
0e3ad301
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
inputs/namelist_cmems.bdy
inputs/namelist_cmems.bdy
+4
-4
pynemo/profile.py
pynemo/profile.py
+4
-2
pynemo/tests/nemo_tide_test.py
pynemo/tests/nemo_tide_test.py
+3
-0
pynemo/tide/fes_extract_HC.py
pynemo/tide/fes_extract_HC.py
+3
-8
No files found.
inputs/namelist_cmems.bdy
View file @
602269e8
...
...
@@ -106,10 +106,10 @@
ln_tide = .true. ! =T : produce bdy tidal conditions
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(2) = 'S2'
clname(3) = 'O1'
clname(4) = 'K1'
clname(5) = 'N2'
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)
...
...
This diff is collapsed.
Click to expand it.
pynemo/profile.py
View file @
602269e8
...
...
@@ -439,6 +439,8 @@ def process_bdy(setup_filepath=0, mask_gui=False):
cons
=
tide
.
nemo_bdy_tide_rot
(
Setup
,
DstCoord
,
bdy_ind
[
't'
],
bdy_ind
[
'u'
],
bdy_ind
[
'v'
],
settings
[
'clname'
],
settings
[
'tide_model'
])
write_tidal_data
(
Setup
,
DstCoord
,
bdy_ind
,
settings
[
'clname'
],
cons
)
if
settings
[
'tide_checker'
]
==
True
:
logger
.
info
(
'tide checker starting now.....'
)
tt_test
=
tt
.
main
(
setup_filepath
,
settings
[
'amp_thres'
],
settings
[
'phase_thres'
],
settings
[
'ref_model'
])
...
...
@@ -451,6 +453,8 @@ def process_bdy(setup_filepath=0, mask_gui=False):
cons
=
tide
.
nemo_bdy_tide_rot
(
Setup
,
DstCoord
,
bdy_ind
[
't'
],
bdy_ind
[
'u'
],
bdy_ind
[
'v'
],
settings
[
'clname'
],
settings
[
'tide_model'
])
write_tidal_data
(
Setup
,
DstCoord
,
bdy_ind
,
settings
[
'clname'
],
cons
)
if
settings
[
'tide_checker'
]
==
True
:
logger
.
info
(
'tide checker starting now.....'
)
tt_test
=
tt
.
main
(
setup_filepath
,
settings
[
'amp_thres'
],
settings
[
'phase_thres'
],
settings
[
'ref_model'
])
...
...
@@ -462,8 +466,6 @@ def process_bdy(setup_filepath=0, mask_gui=False):
logger
.
error
(
'Tidal model: %s, not recognised'
,
settings
[
'tide_model'
])
return
write_tidal_data
(
Setup
,
DstCoord
,
bdy_ind
,
settings
[
'clname'
],
cons
)
logger
.
info
(
'Tidal constituents written to file'
)
...
...
This diff is collapsed.
Click to expand it.
pynemo/tests/nemo_tide_test.py
View file @
602269e8
...
...
@@ -127,12 +127,15 @@ def read_fes(fes_fname,grid):
fes_tide
=
Dataset
(
fes_fname
)
if
grid
==
'Z'
:
fes_amp
=
np
.
array
(
fes_tide
.
variables
[
'amplitude'
][:])
# convert to m
fes_amp
=
fes_amp
/
100
fes_phase
=
np
.
array
(
fes_tide
.
variables
[
'phase'
][:])
if
grid
!=
'Z'
:
fes_amp
=
np
.
array
(
fes_tide
.
variables
[
grid
+
'a'
][:])
fes_phase
=
np
.
array
(
fes_tide
.
variables
[
grid
+
'g'
][:])
# convert to m/s
fes_amp
=
fes_amp
/
100
fes_lat
=
fes_tide
.
variables
[
'lat'
][:]
fes_lon
=
fes_tide
.
variables
[
'lon'
][:]
...
...
This diff is collapsed.
Click to expand it.
pynemo/tide/fes_extract_HC.py
View file @
602269e8
...
...
@@ -69,7 +69,7 @@ class HcExtract(object):
amp
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
str
(
constituents
[
ncon
])
+
'_Z.nc'
).
variables
[
'amplitude'
][:])))
# set fill values to zero
amp
[
amp
==
18446744073709551616.00000
]
=
0
# convert to m from cm
# convert
amp
to m from cm
amp
=
amp
/
100.00
phase
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
constituents
[
ncon
]
+
'_Z.nc'
).
variables
[
'phase'
][:])))
# set fill values to 0
...
...
@@ -96,7 +96,7 @@ class HcExtract(object):
amp
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
constituents
[
ncon
]
+
'_U.nc'
).
variables
[
'Ua'
][:])))
# set fill values to zero
amp
[
amp
==
18446744073709551616.00000
]
=
0
# convert
to cm from m
# convert
amp units to m/s
amp
=
amp
/
100.00
phase
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
constituents
[
ncon
]
+
'_U.nc'
).
variables
[
'Ug'
][:])))
phase
[
phase
==
18446744073709551616.00000
]
=
0
...
...
@@ -120,7 +120,7 @@ class HcExtract(object):
amp
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
constituents
[
ncon
]
+
'_V.nc'
).
variables
[
'Va'
][:])))
# set fill value to zero
amp
[
amp
==
18446744073709551616.00000
]
=
0
# convert
m
to
c
m
# convert
amp units
to m
/s
amp
=
amp
/
100.00
phase
=
np
.
ma
.
MaskedArray
.
filled
(
np
.
flipud
(
np
.
rot90
(
Dataset
(
settings
[
'tide_fes'
]
+
constituents
[
ncon
]
+
'_V.nc'
).
variables
[
'Vg'
][:])))
phase
[
phase
==
18446744073709551616.00000
]
=
0
...
...
@@ -254,11 +254,6 @@ class HcExtract(object):
data
[
cons_index
,
:,
:].
imag
,
maskedpoints
,
lonlat
)
#for velocity_dataset values
#if height_data is not None:
# data_temp[cons_index, :, 0] = data_temp[cons_index, :, 0]/height_data*100
# data_temp[cons_index, :, 1] = data_temp[cons_index, :, 1]/height_data*100
zcomplex
=
np
.
array
(
data_temp
[
cons_index
,
:,
0
],
dtype
=
complex
)
zcomplex
.
imag
=
data_temp
[
cons_index
,
:,
1
]
...
...
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