Commit 8341942c authored by thopri's avatar thopri
Browse files

added try except block to provide useful error for time counter discprency

parent ee8706f3
......@@ -56,7 +56,7 @@
ln_mask_file = .false. ! =T : read mask from file
cn_mask_file = 'mask.nc' ! name of mask file
! (if ln_mask_file=.TRUE.)
ln_dyn2d = .true. ! boundary conditions for
ln_dyn2d = .false. ! boundary conditions for
! barotropic fields
ln_dyn3d = .false. ! boundary conditions for
! baroclinic velocities
......
......@@ -844,14 +844,22 @@ class Extract:
for v in self.var_nam:
intfn = interp1d(time_counter, self.d_bdy[v][year]['data'][:,:,:], axis=0,
bounds_error=True)
self.d_bdy[v][year]['data'] = intfn(np.arange(time_000, time_end, 86400))
try:
self.d_bdy[v][year]['data'] = intfn(np.arange(time_000, time_end, 86400))
except ValueError as e:
logging.error('Value error in time_counter, does time horizon in data and bdy file match?')
raise ValueError('Value error in time_counter, does time horizon in data and bdy file match?') from e
else:
for v in self.var_nam:
for t in range(dstep):
intfn = interp1d(time_counter[t::dstep],
self.d_bdy[v].data[t::dstep,:,:], axis=0, bounds_error=True)
self.d_bdy[v].data[t::dstep,:,:] = intfn(np.arange(time_000,
time_end, 86400))
try:
self.d_bdy[v].data[t::dstep, :, :] = intfn(np.arange(time_000,time_end, 86400))
except ValueError as e:
logging.error('Value error in time_counter, does time horizon in data and bdy file match?')
raise ValueError('Value error in time_counter, does time horizon in data and bdy file match?') from e
self.time_counter = time_counter
def write_out(self, year, month, ind, unit_origin):
......
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