Skip to content

Commit

Permalink
Fixing string formatting for error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaxmonsky committed Aug 22, 2023
1 parent 7b5c375 commit 3381e15
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/physics/utils/physics_data.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module physics_data

use ccpp_kinds, only: kind_phys
use shr_kind_mod, only: cl=>shr_kind_cl

implicit none
private
Expand Down Expand Up @@ -165,6 +166,7 @@ subroutine read_field_2d(file, std_name, var_names, timestep, buffer, mark_as_re
character(len=std_name_len) :: found_name
type(var_desc_t) :: vardesc
character(len=*), parameter :: subname = 'read_field_2d: '
character(len=cl) :: strerr

if (present(mark_as_read)) then
mark_as_read_local = mark_as_read
Expand Down Expand Up @@ -201,9 +203,9 @@ subroutine read_field_2d(file, std_name, var_names, timestep, buffer, mark_as_re
varname=trim(found_name), &
msg=subname//'NaN found in '//trim(found_name))
else
call endrun(subname//'Unable to properly check the found variable "'//trim(found_name)//'" in the IC file. '// &
'Please double-check if the variable exists in the file, '// &
'and that the file is not corrupted or damaged.')
write(strerr,*) subname//'Unable to properly check the found variable "', trim(found_name), '" in the IC file. &
&Please double-check if the variable exists in the file and that the file is not corrupted or damaged.'
call endrun(strerr)
end if
else if (.not. error_on_not_found_local) then
if (masterproc) then
Expand Down Expand Up @@ -252,6 +254,7 @@ subroutine read_field_3d(file, std_name, var_names, vcoord_name, &
character(len=std_name_len) :: found_name
type(var_desc_t) :: vardesc
character(len=*), parameter :: subname = 'read_field_3d: '
character(len=cl) :: strerr

if (present(mark_as_read)) then
mark_as_read_local = mark_as_read
Expand Down Expand Up @@ -291,14 +294,15 @@ subroutine read_field_3d(file, std_name, var_names, vcoord_name, &
if (mark_as_read_local) then
call mark_as_read_from_file(std_name)
end if

if (var_found_local) then
call shr_assert_in_domain(buffer, is_nan=.false., &
varname=trim(found_name), &
msg=subname//'NaN found in '//trim(found_name))
else
call endrun(subname//'Unable to properly check the found variable "'//trim(found_name)//'" in the IC file. '// &
'Please double-check if the variable exists in the file, '// &
'and that the file is not corrupted or damaged.')
write(strerr,*) subname//'Unable to properly check the found variable "', trim(found_name), '" in the IC file. &
&Please double-check if the variable exists in the file and that the file is not corrupted or damaged.'
call endrun(strerr)
end if
else if (.not. error_on_not_found_local) then
if (masterproc) then
Expand Down

0 comments on commit 3381e15

Please sign in to comment.