Skip to content

Commit

Permalink
Detect duplicate vertical levels in chgres_cube. (#767)
Browse files Browse the repository at this point in the history
Quit with an error message when a GRIB2 file contains duplicate vertical levels.

Fixes #763.
  • Loading branch information
LarissaReames-NOAA authored Feb 2, 2023
1 parent 56123a8 commit dca00a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sorc/chgres_cube.fd/atm_input_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2154,13 +2154,19 @@ subroutine read_input_atm_grib2_file(localpet)

call quicksort(rlevs,1,lev_input)

do i = 1, lev_input
do i = 1, lev_input
if (isnative) then
write(slevs(i), '(i6)') nint(rlevs(i))
slevs(i) = trim(slevs(i)) // " hybrid"
if (i>1) then
if (any(slevs(1:i-1)==slevs(i))) call error_handler("Duplicate vertical level entries found.",1)
endif
else
write(slevs(i), '(f11.2)') rlevs(i)
slevs(i) = trim(slevs(i)) // " Pa"
if (i>1) then
if (any(slevs(1:i-1)==slevs(i))) call error_handler("Duplicate vertical level entries found.",1)
endif
endif
enddo

Expand Down

0 comments on commit dca00a3

Please sign in to comment.