Skip to content

Commit

Permalink
Baseline test for routine "qc_orog_by_ramp".
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Jan 10, 2025
1 parent 8a35838 commit 2dc24d6
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/orog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E copy
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/C48.mx500.tile1.nc ${CMAKE_CURRENT_BINARY_DIR}/C48.mx500.tile1.nc)

# Note, the "qc_orog_by_ramp" test expects this file.
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/topography.antarctica.ramp.lowres.nc ${CMAKE_CURRENT_BINARY_DIR}/topography.antarctica.ramp.30s.nc)

add_executable(ftst_ll2xyz ftst_ll2xyz.F90)
add_test(NAME orog-ftst_ll2xyz COMMAND ftst_ll2xyz)
target_link_libraries(ftst_ll2xyz orog_lib)
Expand Down Expand Up @@ -94,3 +98,7 @@ target_link_libraries(ftst_read_mdl_grid_file orog_lib)
add_executable(ftst_read_mask ftst_read_mask.F90)
add_test(NAME orog-ftst_read_mask COMMAND ftst_read_mask)
target_link_libraries(ftst_read_mask orog_lib)

add_executable(ftst_qc_orog_by_ramp ftst_qc_orog_by_ramp.F90)
add_test(NAME orog-ftst_qc_orog_by_ramp COMMAND ftst_qc_orog_by_ramp)
target_link_libraries(ftst_qc_orog_by_ramp orog_lib)
Binary file not shown.
97 changes: 97 additions & 0 deletions tests/orog/ftst_qc_orog_by_ramp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
program qc_orog_ramp

! Test routine "qc_orog_by_ramp", which adjusts
! the global terrain in the vicinity of Antarctica
! using 'RAMP' data.
!
! In OPS, the global data is 30-sec with dimensions
! 43200 x 21600. The RAMP data is 30-sec with dimension
! 43201 x 3601. For this test, reduced versions of
! both grids are used: global - 9x7; RAMP 10x5.
!
! Author George Gayno NCEP/EMC

use io_utils, only : qc_orog_by_ramp

implicit none

! Dimensions of the global grid.

integer, parameter :: imn = 9
integer, parameter :: jmn = 7

integer :: i, j

! The terrain height (zavg) and land mask (zslm)
! of the global grid.

integer :: zavg(imn,jmn)
integer :: zslm(imn,jmn)

! The expected values for a successful test.

integer :: zavg_expected(imn,jmn)
integer :: zslm_expected(imn,jmn)

print*,'- Starting test of qc_orog_by_ramp.'

! Initialize the global grid to all ocean.

zslm = 0 ! water mask
zavg = 0 ! sea level

! These global grid points are outside the 'ramp' grid,
! so they should not change.

zslm_expected(:,6:7) = 0
zavg_expected(:,6:7) = 0

! These global grid points are located within the 'ramp'
! grid. For this test, the first two rows of the 'ramp'
! data have non-zero terrain. So, rows 1 and 2 of the global
! grid will become land, located above sea level. Rows
! 3,4 and 5 of the RAMP data are ocean. So, rows 3,4 and
! 5 of the global grid will remain ocean.

zslm_expected(:,3:5) = 0 ! ocean mask
zavg_expected(:,3:5) = 0 ! terrain height

zslm_expected(:,1:2) = 1 ! becomes land

zavg_expected(1,1) = 5 ! acquires non-zero terrain.
zavg_expected(2,1) = 5
zavg_expected(3,1) = 5
zavg_expected(4,1) = 5
zavg_expected(5,1) = 5
zavg_expected(6,1) = 4
zavg_expected(7,1) = 4
zavg_expected(8,1) = 3
zavg_expected(9,1) = 3

zavg_expected(1,2) = 2
zavg_expected(2,2) = 2
zavg_expected(3,2) = 3
zavg_expected(4,2) = 2
zavg_expected(5,2) = 2
zavg_expected(6,2) = 2
zavg_expected(7,2) = 1
zavg_expected(8,2) = 1
zavg_expected(9,2) = 0 ! Note: this 'ramp' point has non-zero terrain of
! 0.14, which rounds down to zero.

! Note: The location of the RAMP data is set in the routine.

call qc_orog_by_ramp(imn, jmn, zavg, zslm)

do i = 1, imn
do j = 1, jmn
if (zavg(i,j) /= zavg_expected(i,j)) stop 4
if (zslm(i,j) /= zslm_expected(i,j)) stop 8
enddo
enddo

print*,"OK"

print*,"SUCCESS"

end program qc_orog_ramp

0 comments on commit 2dc24d6

Please sign in to comment.