diff --git a/tests/ocean_merge/CMakeLists.txt b/tests/ocean_merge/CMakeLists.txt index 513f9fb57..6057e61a3 100644 --- a/tests/ocean_merge/CMakeLists.txt +++ b/tests/ocean_merge/CMakeLists.txt @@ -18,6 +18,9 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E copy execute_process( COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/data/oro.C48.tile1.nc ${CMAKE_CURRENT_BINARY_DIR}/oro.C48.tile1.nc) +execute_process( COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/data/C48.mx500.tile1.nc ${CMAKE_CURRENT_BINARY_DIR}/C48.mx500.tile1.nc) + add_executable(ftst_read_nml ftst_read_nml.F90) target_link_libraries(ftst_read_nml om_lib) @@ -27,6 +30,10 @@ target_link_libraries(ftst_merge om_lib) add_executable(ftst_read_lake_mask ftst_read_lake_mask.F90) target_link_libraries(ftst_read_lake_mask om_lib) +add_executable(ftst_read_ocean_frac ftst_read_ocean_frac.F90) +target_link_libraries(ftst_read_ocean_frac om_lib) + add_test(NAME ocean_merge-ftst_read_nml COMMAND ftst_read_nml) add_test(NAME ocean_merge-ftst_merge COMMAND ftst_merge) add_test(NAME ocean_merge-ftst_read_lake_mask COMMAND ftst_read_lake_mask) +add_test(NAME ocean_merge-ftst_read_ocean_frac COMMAND ftst_read_ocean_frac) diff --git a/tests/ocean_merge/data/C48.mx500.tile1.nc b/tests/ocean_merge/data/C48.mx500.tile1.nc new file mode 100644 index 000000000..d3999075f Binary files /dev/null and b/tests/ocean_merge/data/C48.mx500.tile1.nc differ diff --git a/tests/ocean_merge/ftst_read_ocean_frac.F90 b/tests/ocean_merge/ftst_read_ocean_frac.F90 new file mode 100644 index 000000000..ec35621ab --- /dev/null +++ b/tests/ocean_merge/ftst_read_ocean_frac.F90 @@ -0,0 +1,37 @@ +! Unit test for the read_ocean_frac routine. +! +! Reads a 6x5 version of the ocean mask file and +! checks values from the ocean fraction record. +! If differences exceed a threshold, then the test fails. +! + program read_ocean_info + + implicit none + + integer, parameter :: lon = 6 + integer, parameter :: lat = 5 + integer, parameter :: tile = 1 + + character(len=3) :: pth1="./" + character(len=3) :: atmres="C48" + character(len=5) :: ocnres="mx500" + + real, parameter :: thresh = 0.001 + real :: ocn_frac(lon,lat) + + print*,"Call routine read_ocean_frac." + + call read_ocean_frac(pth1,atmres,ocnres,tile,lon,lat,ocn_frac) + + print*,"Check records." + + if (abs(ocn_frac(1,1)-1.0) > thresh) stop 2 + if (abs(ocn_frac(6,5)-0.0) > thresh) stop 4 + if (abs(ocn_frac(4,5)-0.0917) > thresh) stop 6 + if (abs(ocn_frac(3,1)-0.162347) > thresh) stop 8 + + print*,"OK" + + print*,"SUCCESS" + + end program read_ocean_info