Skip to content

Commit

Permalink
Merge pull request #622 from uramirez8707/AOCC_fms2io
Browse files Browse the repository at this point in the history
Changes needed to get fms2io unit tests to run with AOCC
  • Loading branch information
thomas-robinson authored Nov 16, 2020
2 parents 7d1a441 + 22ddca2 commit 9e58dfb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions fms2_io/fms_netcdf_domain_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -556,21 +556,21 @@ subroutine save_domain_restart(fileobj, unlim_dim_level)
fileobj%restart_vars(i)%data2d, is_decomposed)
if (is_decomposed) then
call register_variable_attribute(fileobj, fileobj%restart_vars(i)%varname, &
"checksum", chksum, str_len=len(chksum))
"checksum", chksum(1:len(chksum)), str_len=len(chksum))
endif
elseif (associated(fileobj%restart_vars(i)%data3d)) then
chksum = compute_global_checksum(fileobj, fileobj%restart_vars(i)%varname, &
fileobj%restart_vars(i)%data3d, is_decomposed)
if (is_decomposed) then
call register_variable_attribute(fileobj, fileobj%restart_vars(i)%varname, &
"checksum", chksum, str_len=len(chksum))
"checksum", chksum(1:len(chksum)), str_len=len(chksum))
endif
elseif (associated(fileobj%restart_vars(i)%data4d)) then
chksum = compute_global_checksum(fileobj, fileobj%restart_vars(i)%varname, &
fileobj%restart_vars(i)%data4d, is_decomposed)
if (is_decomposed) then
call register_variable_attribute(fileobj, fileobj%restart_vars(i)%varname, &
"checksum", chksum, str_len=len(chksum))
"checksum", chksum(1:len(chksum)), str_len=len(chksum))
endif
endif
enddo
Expand Down Expand Up @@ -643,7 +643,7 @@ subroutine restore_domain_state(fileobj, unlim_dim_level)
if (variable_att_exists(fileobj, fileobj%restart_vars(i)%varname, "checksum") .and. &
is_decomposed) then
call get_variable_attribute(fileobj, fileobj%restart_vars(i)%varname, &
"checksum", chksum_in_file)
"checksum", chksum_in_file(1:len(chksum_in_file)))
if (.not. string_compare(trim(adjustl(chksum_in_file)), trim(adjustl(chksum)))) then
call error("checksum attribute does not match data in file.")
endif
Expand Down
10 changes: 6 additions & 4 deletions test_fms/fms2_io/atmosphere_restart_file_test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ subroutine atmosphere_restart_file(domain, nz, nt, debug_flag)
character(len=256) :: att
character(len=256), dimension(:), allocatable :: buffer
character(len=256), dimension(:), allocatable :: buffer2
character(len=256) :: str_buffer
character(len=256) :: str_buffer2
logical :: debug
integer :: err
integer :: i
Expand Down Expand Up @@ -304,12 +306,12 @@ subroutine atmosphere_restart_file(domain, nz, nt, debug_flag)
call mpp_error(fatal, "Did not read in strings correctly.")
endif
enddo
call read_data(fileobj, "strings", buffer2(1), corner=ndims)
if (trim(buffer2(1)) .ne. trim(buffer(ndims))) then
call read_data(fileobj, "strings", str_buffer, corner=ndims)
if (trim(str_buffer) .ne. trim(buffer(ndims))) then
call mpp_error(fatal, "Scalar from array of strings read failed.")
endif
call read_data(fileobj, "filename", buffer2(ndims))
if (trim(buffer2(ndims)) .ne. "file1.nc") then
call read_data(fileobj, "filename", str_buffer2)
if (trim(str_buffer2) .ne. "file1.nc") then
call mpp_error(fatal, "Did not read in filename variable correctly.")
endif
deallocate(buffer)
Expand Down
10 changes: 6 additions & 4 deletions test_fms/fms2_io/test_atmosphere_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ program test_atmosphere_io
integer(kind=int64) :: chksum
character(len=256), dimension(:), allocatable :: string_buffer
character(len=256), dimension(:), allocatable :: string_buffer2
character(len=256) :: string_buffer3
character(len=256) :: string_buffer4
integer :: i
integer :: ndims
integer, dimension(:), allocatable :: dim_sizes
Expand Down Expand Up @@ -407,12 +409,12 @@ program test_atmosphere_io
call mpp_error(fatal, "Did not read in strings correctly.")
endif
enddo
call read_data(fileobj, "var3", string_buffer2(1), corner=ndims)
if (trim(string_buffer2(1)) .ne. trim(string_buffer(ndims))) then
call read_data(fileobj, "var3", string_buffer3, corner=ndims)
if (trim(string_buffer3) .ne. trim(string_buffer(ndims))) then
call mpp_error(fatal, "Scalar from array of strings read failed.")
endif
call read_data(fileobj, "var2", string_buffer2(ndims))
if (trim(string_buffer2(ndims)) .ne. "file1.nc") then
call read_data(fileobj, "var2", string_buffer4)
if (trim(string_buffer4) .ne. "file1.nc") then
call mpp_error(fatal, "Did not read in filename variable correctly.")
endif
deallocate(string_buffer)
Expand Down

0 comments on commit 9e58dfb

Please sign in to comment.