Commit 05683532 authored by thopri's avatar thopri
Browse files

removed CMEMS specifc tracer varable names, NCML remppaing now used

parent ae85fb8e
......@@ -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>
......@@ -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 = .false. ! boundary conditions for T and S
ln_tra = .true. ! 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 = .true. ! =T : produce bdy tidal conditions
ln_tide = .false. ! =T : produce bdy tidal conditions
sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo)
clname(1) = 'M2' ! constituent name
clname(2) = 'S2'
......
......@@ -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.
......
......@@ -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(['siconc', 'sithick'])
if ln_dyn2d:
var_in['t'].extend(['sossheig'])
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
......
......@@ -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
......
......@@ -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 = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment