Commit 602269e8 authored by thopri's avatar thopri
Browse files

fixed units issue and tide test output bug

parent 0e3ad301
......@@ -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)
......
......@@ -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')
......
......@@ -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'][:]
......
......@@ -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 cm
# 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]
......
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