Commit de201180 authored by Lars Ackermann's avatar Lars Ackermann

adapt ocean pism coupling to new 2D fesom output

parent 4dcfdd11
......@@ -134,30 +134,41 @@ time_out = FID.variables['time'][0:no_timesteps]
#
# Full hydrographic fields
#
for itime in np.arange(0, no_timesteps, 1, dtype=np.int32):
##time_out[itime] = FID.variables['time'][itime]
time_read = time_out[itime]
# Some information
print('* TIME('+str(itime)+') = '+str(time_read))
ilevel = -1
for depth in mesh.zlevs:
#
# Check shape of input file to process old (2D array) and new (3D array) FESOM files
#
print('FID.variables[args.FESOM_VARIABLE[0]][itime, ilevel].shape',
FID.variables[args.FESOM_VARIABLE[0]].shape)
if len(FID.variables[args.FESOM_VARIABLE[0]].shape) == 2:
for itime in np.arange(0, no_timesteps, 1, dtype=np.int32):
##time_out[itime] = FID.variables['time'][itime]
time_read = time_out[itime]
# Some information
idepth = np.int(depth)
print('* depth='+str(idepth)+' ('+str(depth)+\
') ++ time('+str(itime)+') = '+str(time_read))
#
# Prepare data for final netcdf output
#
ilevel = ilevel + 1
flag_verbose=False
level_data, elem_no_nan = \
pf.get_data(FID.variables[args.FESOM_VARIABLE[0]][itime, :], mesh, idepth, flag_verbose)
level_data[np.where(np.isnan(level_data))] = NAN_REPLACE
TempFields_out[itime, ilevel, :] = level_data
print('* TIME('+str(itime)+') = '+str(time_read))
ilevel = -1
for depth in mesh.zlevs:
# Some information
idepth = np.int(depth)
print('* depth='+str(idepth)+' ('+str(depth)+\
') ++ time('+str(itime)+') = '+str(time_read))
#
# Prepare data for final netcdf output
#
ilevel = ilevel + 1
flag_verbose=False
level_data, elem_no_nan = \
pf.get_data(FID.variables[args.FESOM_VARIABLE[0]][itime, :], mesh, idepth, flag_verbose)
level_data[np.where(np.isnan(level_data))] = NAN_REPLACE
TempFields_out[itime, ilevel, :] = level_data
elif len(FID.variables[args.FESOM_VARIABLE[0]].shape) == 3:
TempFields_out = FID.variables[args.FESOM_VARIABLE[0]][:]
else:
print('Wrong shape of input file: ', FID)
# ----------------------------------------------------------------
#
......
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