From 2c7ab45d1d6a963506264cd5a3e5360140bcdc8e Mon Sep 17 00:00:00 2001 From: Bin Xiao Date: Sun, 30 Sep 2018 19:41:08 +0800 Subject: [PATCH 1/2] bug fixed in 2 files: 1, fms_io.F90, kind=8 allow very large file size definitions. 2, fixed bugs in fregrid.c for vector regriding functionality. --- src/shared/fms/fms_io.F90 | 2 +- src/tools/fregrid/fregrid.c | 56 +++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/shared/fms/fms_io.F90 b/src/shared/fms/fms_io.F90 index 0cbd885f19..9270a9f811 100644 --- a/src/shared/fms/fms_io.F90 +++ b/src/shared/fms/fms_io.F90 @@ -2594,7 +2594,7 @@ subroutine save_default_restart(fileObj,restartpath) character(len=336) :: restartpath ! The restart file path (dir/file). character(len=8) :: suffix ! A suffix (like _2) that is appended to the name of files after the first. - integer :: var_sz, size_in_file ! The size in bytes of each variable and of the variables already in a file. + integer(kind=8) :: var_sz, size_in_file ! The size in bytes of each variable and of the variables already in a file. integer :: unit ! The mpp unit of the open file. real, dimension(max_axis_size) :: axisdata integer, dimension(max_axes) :: id_x_axes, siz_x_axes diff --git a/src/tools/fregrid/fregrid.c b/src/tools/fregrid/fregrid.c index 564815791a..781152ebf0 100644 --- a/src/tools/fregrid/fregrid.c +++ b/src/tools/fregrid/fregrid.c @@ -686,7 +686,12 @@ int main(int argc, char* argv[]) set_mosaic_data_file(ntiles_out, mosaic_out, dir_out, file2_out, output_file[1]); } - for(n=0; nvar[l].kstart; level_z <= scalar_in->var[l].kend; level_z++) { - if(test_case) - get_test_input_data(test_case, test_param, ntiles_in, scalar_in, grid_in, bound_T, opcode); - else - get_input_data(ntiles_in, scalar_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); + if(test_case) get_test_input_data(test_case, test_param, ntiles_in, scalar_in, grid_in, bound_T, opcode); + else get_input_data(ntiles_in, scalar_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); allocate_field_data(ntiles_out, scalar_out, grid_out, 1); if( opcode & BILINEAR ) do_scalar_bilinear_interp(interp, l, ntiles_in, grid_in, grid_out, scalar_in, scalar_out, finer_step, fill_missing); @@ -834,27 +837,32 @@ int main(int argc, char* argv[]) /* then interp vector field */ for(l=0; l0) continue; + /*if( !u_in[n].var[l].has_taxis && m>0) continue;*/ + if( !u_in->var[l].has_taxis && m>0) continue; level_t = m + u_in->var[l].lstart; - get_input_data(ntiles_in, u_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); - get_input_data(ntiles_in, v_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); - allocate_field_data(ntiles_out, u_out, grid_out, u_in[n].var[l].nz); - allocate_field_data(ntiles_out, v_out, grid_out, u_in[n].var[l].nz); - if( opcode & BILINEAR ) - do_vector_bilinear_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, finer_step, fill_missing); - else - do_vector_conserve_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, opcode); - - write_field_data(ntiles_out, u_out, grid_out, l, level_z, level_n, m); - write_field_data(ntiles_out, v_out, grid_out, l, level_z, level_n, m); - for(n=0; nvar[l].nn; level_n++) { + for(level_z=u_in->var[l].kstart; level_z <= u_in->var[l].kend; level_z++){ + get_input_data(ntiles_in, u_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); + get_input_data(ntiles_in, v_in, grid_in, bound_T, l, level_z, level_n, level_t, extrapolate, stop_crit); + allocate_field_data(ntiles_out, u_out, grid_out, u_in->var[l].nz); + allocate_field_data(ntiles_out, v_out, grid_out, u_in->var[l].nz); + if( opcode & BILINEAR ) + do_vector_bilinear_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, finer_step, fill_missing); + else + do_vector_conserve_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, opcode); + + write_field_data(ntiles_out, u_out, grid_out, l, level_z, level_n, m); + write_field_data(ntiles_out, v_out, grid_out, l, level_z, level_n, m); + for(n=0; n Date: Wed, 7 Aug 2019 16:48:07 +0800 Subject: [PATCH 2/2] Update fms_io.F90 --- src/shared/fms/fms_io.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/fms/fms_io.F90 b/src/shared/fms/fms_io.F90 index 9270a9f811..f8f700017d 100644 --- a/src/shared/fms/fms_io.F90 +++ b/src/shared/fms/fms_io.F90 @@ -2594,7 +2594,7 @@ subroutine save_default_restart(fileObj,restartpath) character(len=336) :: restartpath ! The restart file path (dir/file). character(len=8) :: suffix ! A suffix (like _2) that is appended to the name of files after the first. - integer(kind=8) :: var_sz, size_in_file ! The size in bytes of each variable and of the variables already in a file. + integer(LONG_KIND) :: var_sz, size_in_file ! The size in bytes of each variable and of the variables already in a file. integer :: unit ! The mpp unit of the open file. real, dimension(max_axis_size) :: axisdata integer, dimension(max_axes) :: id_x_axes, siz_x_axes