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
05683532
Commit
05683532
authored
4 years ago
by
thopri
Browse files
Options
Download
Email Patches
Plain Diff
removed CMEMS specifc tracer varable names, NCML remppaing now used
parent
ae85fb8e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
71 deletions
+32
-71
inputs/CMEMS.ncml
inputs/CMEMS.ncml
+6
-4
inputs/namelist_cmems.bdy
inputs/namelist_cmems.bdy
+2
-3
pynemo/nemo_bdy_dl_cmems.py
pynemo/nemo_bdy_dl_cmems.py
+1
-0
pynemo/profile.py
pynemo/profile.py
+9
-42
pynemo/reader/ncml.py
pynemo/reader/ncml.py
+1
-15
test_scripts/meta_data.py
test_scripts/meta_data.py
+13
-7
No files found.
inputs/CMEMS.ncml
View file @
05683532
...
...
@@ -21,8 +21,10 @@
</ns0:aggregation>
</ns0:netcdf>
</ns0:aggregation>
<ns0:variable name="thetao" orgName="thetao" />
<ns0:variable name="uo" orgName="uo" />
<ns0:variable name="vo" orgName="vo" />
<ns0:variable name="zos" orgName="zos" />
<ns0:variable name="votemper" orgName="thetao" />
<ns0:variable name="vozocrtx" orgName="uo" />
<ns0:variable name="vomecrty" orgName="vo" />
<ns0:variable name="sossheig" orgName="zos" />
<ns0:variable name="time_counter" orgName="time" />
<ns0:dimension name="time_counter" orgName="time" />
</ns0:netcdf>
This diff is collapsed.
Click to expand it.
inputs/namelist_cmems.bdy
View file @
05683532
...
...
@@ -51,7 +51,6 @@
!------------------------------------------------------------------------------
! CMEMS Data Source Configuration
!------------------------------------------------------------------------------
ln_use_cmems = .true.
ln_download_cmems = .false.
sn_cmems_dir = '/Users/thopri/Projects/PyNEMO/inputs/' ! where to download CMEMS input files (static and variable)
ln_download_static = .false.
...
...
@@ -96,14 +95,14 @@
! barotropic fields
ln_dyn3d = .false. ! boundary conditions for
! baroclinic velocities
ln_tra = .
fals
e. ! boundary conditions for T and S
ln_tra = .
tru
e. ! boundary conditions for T and S
ln_ice = .false. ! ice boundary condition
nn_rimwidth = 9 ! width of the relaxation zone
!------------------------------------------------------------------------------
! unstructured open boundaries tidal parameters
!------------------------------------------------------------------------------
ln_tide = .
tru
e. ! =T : produce bdy tidal conditions
ln_tide = .
fals
e. ! =T : produce bdy tidal conditions
sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo)
clname(1) = 'M2' ! constituent name
clname(2) = 'S2'
...
...
This diff is collapsed.
Click to expand it.
pynemo/nemo_bdy_dl_cmems.py
View file @
05683532
...
...
@@ -16,6 +16,7 @@ import glob
import
os
#local imports
from
pynemo.utils
import
cmems_errors
as
errors
from
pynemo.reader
import
factory
logger
=
logging
.
getLogger
(
__name__
)
# TODO: Fix double spacing issue on CMEMS download log entries.
...
...
This diff is collapsed.
Click to expand it.
pynemo/profile.py
View file @
05683532
...
...
@@ -521,53 +521,20 @@ def process_bdy(setup_filepath=0, mask_gui=False):
var_in
=
{}
for
g
in
range
(
len
(
grd
)):
var_in
[
grd
[
g
]]
=
[]
if
'use_cmems'
in
settings
:
if
settings
[
'use_cmems'
]
==
True
:
logger
.
info
(
'using CMEMS variable names......'
)
if
ln_tra
:
var_in
[
't'
].
extend
([
'thetao'
])
#var_in['t'].extend(['so'])
if
ln_dyn2d
or
ln_dyn3d
:
var_in
[
'u'
].
extend
([
'uo'
])
var_in
[
'v'
].
extend
([
'vo'
])
if
ln_tra
:
var_in
[
't'
].
extend
([
'votemper'
])
#, 'vosaline'])
if
ln_dyn2d
:
var_in
[
't'
].
extend
([
'zos'
])
if
ln_dyn2d
or
ln_dyn3d
:
var_in
[
'u'
].
extend
([
'vozocrtx'
])
var_in
[
'v'
].
extend
([
'vomecrty'
])
if
ln_
ice
:
var_in
[
't'
].
extend
([
's
iconc'
,
'sithick
'
])
if
ln_
dyn2d
:
var_in
[
't'
].
extend
([
's
ossheig
'
])
if
settings
[
'use_cmems'
]
==
False
:
logger
.
info
(
'using existing PyNEMO variable names.....'
)
if
ln_tra
:
var_in
[
't'
].
extend
([
'votemper'
,
'vosaline'
])
if
ln_ice
:
var_in
[
't'
].
extend
([
'iicethic'
,
'ileadfra'
,
'isnowthi'
])
if
ln_dyn2d
or
ln_dyn3d
:
var_in
[
'u'
].
extend
([
'vozocrtx'
])
var_in
[
'v'
].
extend
([
'vomecrty'
])
if
ln_dyn2d
:
var_in
[
't'
].
extend
([
'sossheig'
])
if
ln_ice
:
var_in
[
't'
].
extend
([
'iicethic'
,
'ileadfra'
,
'isnowthi'
])
if
'use_cmems'
not
in
settings
:
logger
.
info
(
'using existing PyNEMO variable names.....'
)
if
ln_tra
:
var_in
[
't'
].
extend
([
'votemper'
,
'vosaline'
])
if
ln_dyn2d
or
ln_dyn3d
:
var_in
[
'u'
].
extend
([
'vozocrtx'
])
var_in
[
'v'
].
extend
([
'vomecrty'
])
if
ln_dyn2d
:
var_in
[
't'
].
extend
([
'sossheig'
])
if
ln_ice
:
var_in
[
't'
].
extend
([
'iicethic'
,
'ileadfra'
,
'isnowthi'
])
# As variables are associated with grd there must be a filename attached
# to each variable
...
...
This diff is collapsed.
Click to expand it.
pynemo/reader/ncml.py
View file @
05683532
...
...
@@ -40,21 +40,7 @@ try:
except
ImportError
:
print
(
'Warning: Please make sure pyjnius is installed and jvm.dll/libjvm.so/libjvm.dylib is in the path'
)
import
sys
from
pynemo
import
nemo_bdy_setup
as
setup
try
:
Setup
=
setup
.
Setup
(
sys
.
argv
[
2
])
# default settings file
settings
=
Setup
.
settings
if
'use_cmems'
in
settings
:
if
settings
[
'use_cmems'
]
==
True
:
time_counter_const
=
"time"
if
settings
[
'use_cmems'
]
==
False
:
time_counter_const
=
"time_counter"
if
'use_cmems'
not
in
settings
:
time_counter_const
=
"time_counter"
del
settings
,
Setup
except
IndexError
:
time_counter_const
=
"time_counter"
time_counter_const
=
"time_counter"
class
Reader
(
object
):
""" This class is the high level of object for the NCML reader, from here using grid type
...
...
This diff is collapsed.
Click to expand it.
test_scripts/meta_data.py
View file @
05683532
...
...
@@ -7,7 +7,10 @@ Set of functions to download CMEMS files using FTP (for static mask data) and MO
from
netCDF4
import
Dataset
import
re
# list of datasets to check
datasets
=
[
"http://opendap4gws.jasmin.ac.uk/thredds/noc_msm/dodsC/pynemo_data/ORCA025-N206_19791101d05T.nc"
,
datasets
=
[
"/Users/thopri/Projects/PyNEMO/inputs/subset_2017-01-01_2017-01-31_T.nc"
,
"/Users/thopri/Projects/PyNEMO/inputs/subset_2017-01-01_2017-01-31_U.nc"
,
"/Users/thopri/Projects/PyNEMO/inputs/subset_2017-01-01_2017-01-31_V.nc"
,
"http://opendap4gws.jasmin.ac.uk/thredds/noc_msm/dodsC/pynemo_data/ORCA025-N206_19791101d05T.nc"
,
"http://opendap4gws.jasmin.ac.uk/thredds/noc_msm/dodsC/pynemo_data/ORCA025-N206_19791101d05U.nc"
,
"http://opendap4gws.jasmin.ac.uk/thredds/noc_msm/dodsC/pynemo_data/ORCA025-N206_19791101d05V.nc"
,
"http://opendap4gws.jasmin.ac.uk/thredds/noc_msm/dodsC/pynemo_data/ORCA025-N206_19791101d05I.nc"
...
...
@@ -27,13 +30,12 @@ chk_list = {'temperature': ['temp'],
'SSH'
:
[
'surface'
,
'sea'
],
'depth'
:
[
'depth'
],
'time'
:
[
'time'
,
'counter'
],
'Ucomponent'
:
[
'zonal'
,
'current'
,
'eastward'
,
'uo'
],
'Vcomponent'
:
[
'meridional'
,
'current'
,
'northward'
,
'vo'
],
'windstress-i'
:
[
'i-axis'
],
'windstress-j'
:
[
'j-axis'
],
'latitude'
:
[
'latitude'
,
'nav_lat'
,
'lat'
,
'y'
],
'longitude'
:
[
'longitude'
,
'nav_lon'
,
'lon'
,
'x'
],
'depth'
:
[
'depth'
],
'Ucomponent'
:
[
'zonal'
,
'current'
],
'Vcomponent'
:
[
'meridional'
,
'current'
],
'windstress-i'
:[
'i-axis'
],
'windstress-j'
:[
'j-axis'
],
}
# function to use regex to find if string is in variable name or if not check long name. Case of string is ignored
...
...
@@ -42,12 +44,16 @@ def data_chk(data, str, key):
for
i
in
range
(
len
(
str
)):
try
:
chk
=
re
.
search
(
str
[
i
],
data
[
key
].
name
,
re
.
IGNORECASE
)
if
chk
is
not
None
:
return
chk
if
chk
is
None
:
chk
=
re
.
search
(
str
[
i
],
data
[
key
].
long_name
,
re
.
IGNORECASE
)
return
chk
if
chk
is
not
None
:
return
chk
except
AttributeError
:
pass
i
=
0
meta_dataset
=
{}
...
...
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