Skip to content

Commit

Permalink
add error handling for standard name calls
Browse files Browse the repository at this point in the history
  • Loading branch information
peverwhee committed Feb 4, 2025
1 parent 1340ae6 commit f641bf9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions schemes/sima_diagnostics/sima_state_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ subroutine sima_state_diagnostics_init(const_props, errmsg, errflg)
const_found = .false.
do const_idx = 1, size(const_props)
call const_props(const_idx)%standard_name(standard_name, errflg, errmsg)
if (errflg /= 0) then
return
end if
do name_idx = 1, size(const_std_names)
if (trim(standard_name) == trim(const_std_names(name_idx))) then
call history_add_field(trim(const_diag_names(name_idx)), trim(const_std_names(name_idx)), 'lev', 'avg', 'kg kg-1', mixing_ratio='wet')
Expand All @@ -99,6 +102,9 @@ subroutine sima_state_diagnostics_init(const_props, errmsg, errflg)
do const_idx = 1, size(const_props)
if (.not. const_found(const_idx)) then
call const_props(const_idx)%standard_name(standard_name, errflg, errmsg)
if (errflg /= 0) then
return
end if
! truncate the standard name if necessary
diagnostic_name = standard_name
call const_props(const_idx)%units(units, errflg, errmsg)
Expand Down Expand Up @@ -205,6 +211,9 @@ subroutine sima_state_diagnostics_run(ps, psdry, phis, T, u, v, dse, omega, &
const_found = .false.
do const_idx = 1, size(const_props)
call const_props(const_idx)%standard_name(standard_name, errflg, errmsg)
if (errflg /= 0) then
return
end if
do name_idx = 1, size(const_std_names)
if (trim(standard_name) == trim(const_std_names(name_idx))) then
call history_out_field(trim(const_diag_names(name_idx)), const_array(:,:,const_idx))
Expand All @@ -223,6 +232,9 @@ subroutine sima_state_diagnostics_run(ps, psdry, phis, T, u, v, dse, omega, &
do const_idx = 1, size(const_props)
if (.not. const_found(const_idx)) then
call const_props(const_idx)%standard_name(standard_name, errflg, errmsg)
if (errflg /= 0) then
return
end if
diagnostic_name = standard_name
call history_out_field(trim(diagnostic_name), const_array(:,:,const_idx))
end if
Expand Down

0 comments on commit f641bf9

Please sign in to comment.