Skip to content

Commit

Permalink
added tests and test data
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed May 31, 2024
1 parent 730836f commit 1369a23
Show file tree
Hide file tree
Showing 87 changed files with 160,769 additions and 28 deletions.
87 changes: 80 additions & 7 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ endfunction()
# function copies such a data file to the build directory.
function(copy_test_data name)
message(STATUS "Copying test file ${name}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${name}"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
file(COPY "${CMAKE_SOURCE_DIR}/tests/data/${name}"
DESTINATION ${CMAKE_BINARY_DIR}/tests/data
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
endfunction()

Expand Down Expand Up @@ -83,11 +83,24 @@ if(FTP_TEST_FILES)
# These are the test data files.
set(FTP_FILES WW3_Regional_US_West_Coast_20220718_0000.grib2
WW3_Regional_US_East_Coast_20220717_0600.grib2
gep19.t00z.pgrb2a.0p50_bcf144 geavg.t00z.pgrb2a.0p50_mecomf144
gec00.t00z.pgrb2a.0p50.f144 gegfs.t00z.pgrb2a.0p50.f144
gegfs.t00z.pgrb2a.0p50_mef144 gep19.t00z.pgrb2a.0p50.f144
gdas.t12z.pgrb2.1p00.anl.grib2 blend.t19z.core.f001.co.grib2
aqm.t12z.max_8hr_o3.227.grib2 seaice.t00z.grb.grib2)
gep19.t00z.pgrb2a.0p50_bcf144
geavg.t00z.pgrb2a.0p50_mecomf144
gec00.t00z.pgrb2a.0p50.f144
gegfs.t00z.pgrb2a.0p50.f144
gegfs.t00z.pgrb2a.0p50_mef144
gep19.t00z.pgrb2a.0p50.f144
gdas.t12z.pgrb2.1p00.anl.grib2
blend.t19z.core.f001.co.grib2
aqm.t12z.max_8hr_o3.227.grib2
seaice.t00z.grb.grib2
cmc_geavg.t12z.pgrb2a.0p50.f000
flxf2022111712.01.2022111712.grb2
GLOBAL.grib2.2022103000.0000
hiresw.t00z.arw_5km.f00.hi.grib2
naefs_ge10pt.t12z.pgrb2a.0p50_bcf003
rap.t00z.awp130pgrbf00.grib2
sgx_nwps_CG3_20221117_1200.grib2
)

# User may also ask for large test file.
if(FTP_LARGE_TEST_FILES)
Expand Down Expand Up @@ -208,3 +221,63 @@ foreach(kind ${kinds})
endif()
endforeach()

# Tests that use grib utilities
if (BUILD_UTILS)
if (BUILD_WITH_W3EMC)
# This fortran test is for the internals of degrib2.
add_executable(test_degrib2_int test_degrib2_int.F90 ${CMAKE_SOURCE_DIR}/utils/prlevel.F90
${CMAKE_SOURCE_DIR}/utils/prvtime.F90)
target_link_libraries(test_degrib2_int PUBLIC ${PROJECT_NAME}_4)
add_test(NAME test_degrib2_int COMMAND test_degrib2_int)

gu_test(run_cnvgrib_tests)
gu_test(run_copygb_tests)
gu_test(run_copygb2_tests2)
gu_test(run_degrib2_tests)
gu_test(run_grbindex_tests)
gu_test(run_grb2index_tests)

copy_test_data(ref_copygb2_test_gdaswave_2.ip.grib2.degrib2)
copy_test_data(ref_copygb2_test_gdaswave.degrib2.txt)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib2)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.ip.grib2)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib1)
copy_test_data(ref_gdaswave_2.idx)
copy_test_data(ref_gdaswave.degrib2.txt)
copy_test_data(ref_gdaswave_grib1_inventory.txt)
copy_test_data(ref_gdaswave.grb2index.idx)
copy_test_data(ref_gdaswave.grb2index.idx2)
copy_test_data(ref_gdaswave.grbindex.grib1.idx)
copy_test_data(ref_gdaswave_2.grib1.idx)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib2.idx)
copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000_2.grib2.idx)
copy_test_data(ref_gfs.landmask.grib1)
copy_test_data(ref_grid_172.landmask.grib1)
copy_test_data(ref_grid_220.landmask.grib1)
copy_test_data(tocgrib2.nml)
copy_test_data(tocgrib2_bad.nml)

if(G2C_COMPARE)
find_program(G2C_COMPARE g2c_compare)
gu_test(run_copygb2_tests)
else()
message(STATUS "g2c_compare not found.")
endif()

if (FTP_TEST_FILES)
# Copy this inventory from the test directory. It's the expected
# inventory for one of the FTP files, after conversion to GRIB1.
copy_test_data(ref_test_WW3_West.grib1.inventory.txt)
copy_test_data(ref_test_WW3_West.grib2.idx)
gu_test(run_util_ftp_tests)
gu_test(run_degrib2_ftp_tests)
if(FTP_LARGE_TEST_FILES)
gu_test(run_degrib2_large_file_tests)
endif()
if(FTP_EXTRA_TEST_FILES)
gu_test(run_degrib2_extra_file_tests)
gu_test(run_tocgrib2_tests)
endif()
endif()
endif()
endif()
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1369a23

Please sign in to comment.