Commit b5b10a4d authored by thopri's avatar thopri
Browse files

fixed issues with U and V currents when ln_dyn3d is set to true

...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
! (if ln_mask_file=.TRUE.) ! (if ln_mask_file=.TRUE.)
ln_dyn2d = .false. ! boundary conditions for ln_dyn2d = .false. ! boundary conditions for
! barotropic fields ! barotropic fields
ln_dyn3d = .false. ! boundary conditions for ln_dyn3d = .true. ! boundary conditions for
! baroclinic velocities ! baroclinic velocities
ln_tra = .true. ! boundary conditions for T and S ln_tra = .true. ! boundary conditions for T and S
ln_ice = .false. ! ice boundary condition ln_ice = .false. ! ice boundary condition
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
! unstructured open boundaries tidal parameters ! unstructured open boundaries tidal parameters
!------------------------------------------------------------------------------ !------------------------------------------------------------------------------
ln_tide = .true. ! =T : produce bdy tidal conditions ln_tide = .true. ! =T : produce bdy tidal conditions
sn_tide_model = 'tpxo' ! Name of tidal model (fes|tpxo) sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo)
clname(1) = 'M2' ! constituent name clname(1) = 'M2' ! constituent name
clname(2) = 'S2' clname(2) = 'S2'
clname(3) = 'O1' clname(3) = 'O1'
......
...@@ -14,7 +14,8 @@ def CreateBDYNetcdfFile(filename, N, I, J, K, rw, h, orig, fv, calendar, grd, va ...@@ -14,7 +14,8 @@ def CreateBDYNetcdfFile(filename, N, I, J, K, rw, h, orig, fv, calendar, grd, va
""" This method creates a template of bdy netcdf files. A common for """ This method creates a template of bdy netcdf files. A common for
T, I, U, V, E grid types. T, I, U, V, E grid types.
""" """
if var_nam == 'tide_data' or var_nam[0] == 'votemper' or var_nam[0] == 'vosaline': var_nams = ['tide_data','votemper','vosaline','vozocrtx','vomecrty','vobtcrty','vomecrty']
if var_nam[0] in var_nams:
logging.info('benchmark variables identified, using original variable names.......') logging.info('benchmark variables identified, using original variable names.......')
gridNames = ['T', 'I', 'U', 'V', 'E', 'Z'] # All possible grids gridNames = ['T', 'I', 'U', 'V', 'E', 'Z'] # All possible grids
...@@ -239,8 +240,8 @@ def CreateBDYNetcdfFile(filename, N, I, J, K, rw, h, orig, fv, calendar, grd, va ...@@ -239,8 +240,8 @@ def CreateBDYNetcdfFile(filename, N, I, J, K, rw, h, orig, fv, calendar, grd, va
logging.error('Unknown Grid') logging.error('Unknown Grid')
ncid.close() ncid.close()
var_nams = ['thetao','so','zos','uo','vo']
if var_nam[0] == 'thetao' or var_nam[0] == 'so' or var_nam[0] == 'uo' or var_nam[0] == 'vo': if var_nam[0] in var_nams:
logging.info('CMEMS variables identified, using default CMEMS variables.....') logging.info('CMEMS variables identified, using default CMEMS variables.....')
gridNames = ['T', 'I', 'U', 'V', 'E', 'Z'] # All possible grids gridNames = ['T', 'I', 'U', 'V', 'E', 'Z'] # All possible grids
......
...@@ -18,7 +18,7 @@ def write_data_to_file(filename, variable_name, data): ...@@ -18,7 +18,7 @@ def write_data_to_file(filename, variable_name, data):
ncid = Dataset(filename, 'a', clobber=False, format='NETCDF4') ncid = Dataset(filename, 'a', clobber=False, format='NETCDF4')
count = data.shape count = data.shape
three_dim_variables = ['votemper', 'vosaline', 'N1p', 'N3n', 'N5s','thetao','so','uo','vo'] three_dim_variables = ['votemper', 'vosaline', 'N1p', 'N3n', 'N5s','thetao','so','uo','vo','vobtcrtx','vozocrtx','vobtcrty','vomecrty']
two_dim_variables = ['sossheig', 'vobtcrtx', 'vobtcrty', 'iicethic', 'ileadfra', 'isnowthi','zos'] two_dim_variables = ['sossheig', 'vobtcrtx', 'vobtcrty', 'iicethic', 'ileadfra', 'isnowthi','zos']
if variable_name in three_dim_variables: if variable_name in three_dim_variables:
......
...@@ -52,7 +52,7 @@ class Depth: ...@@ -52,7 +52,7 @@ class Depth:
# Check inputs # Check inputs
# FIX ME? Errors for wrong obj arg len. probably better to work around # FIX ME? Errors for wrong obj arg len. probably better to work around
print(settings) self.logger.info(settings)
if settings['sco']: if settings['sco']:
# hc = ... FIX ME?? # hc = ... FIX ME??
# Depth of water column at t-point # Depth of water column at t-point
......
...@@ -531,8 +531,8 @@ def process_bdy(setup_filepath=0, mask_gui=False): ...@@ -531,8 +531,8 @@ def process_bdy(setup_filepath=0, mask_gui=False):
var_in['t'].extend(['votemper', 'vosaline']) var_in['t'].extend(['votemper', 'vosaline'])
if ln_dyn2d or ln_dyn3d: if ln_dyn2d or ln_dyn3d:
var_in['u'].extend(['vozocrtx', 'vomecrty']) var_in['u'].extend(['vozocrtx'])
var_in['v'].extend(['vozocrtx', 'vomecrty']) var_in['v'].extend(['vomecrty'])
if ln_dyn2d: if ln_dyn2d:
var_in['t'].extend(['sossheig']) var_in['t'].extend(['sossheig'])
...@@ -546,8 +546,8 @@ def process_bdy(setup_filepath=0, mask_gui=False): ...@@ -546,8 +546,8 @@ def process_bdy(setup_filepath=0, mask_gui=False):
var_in['t'].extend(['votemper', 'vosaline']) var_in['t'].extend(['votemper', 'vosaline'])
if ln_dyn2d or ln_dyn3d: if ln_dyn2d or ln_dyn3d:
var_in['u'].extend(['vozocrtx', 'vomecrty']) var_in['u'].extend(['vozocrtx'])
var_in['v'].extend(['vozocrtx', 'vomecrty']) var_in['v'].extend(['vomecrty'])
if ln_dyn2d: if ln_dyn2d:
var_in['t'].extend(['sossheig']) var_in['t'].extend(['sossheig'])
......
...@@ -10,12 +10,13 @@ import os ...@@ -10,12 +10,13 @@ import os
from pynemo.reader.ncml import Reader as NcMLReader from pynemo.reader.ncml import Reader as NcMLReader
from pynemo.reader.ncml import NcMLFile from pynemo.reader.ncml import NcMLFile
from pynemo.reader.directory import Reader as DirectoryReader from pynemo.reader.directory import Reader as DirectoryReader
import logging
from netCDF4 import Dataset from netCDF4 import Dataset
logger = logging.getLogger(__name__)
def GetReader(uri, t_adjust, reader_type=None): def GetReader(uri, t_adjust, reader_type=None):
if reader_type is None: if reader_type is None:
print(uri) logger.info(uri)
if uri.endswith(".ncml"): if uri.endswith(".ncml"):
reader_type = "NcML" reader_type = "NcML"
elif os.path.isdir(uri): elif os.path.isdir(uri):
......
screenshots/example_bdy_coords.png

265 KB

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