From e34f55231d9c904d93863112348fc9513e761958 Mon Sep 17 00:00:00 2001 From: Edward Givelberg Date: Thu, 6 Jun 2024 13:22:54 -0500 Subject: [PATCH] added cmake code for staging rtofs input files --- utils/obsproc/applications/CMakeLists.txt | 5 +- .../applications/gdas_obsprovider2ioda.h | 1 - utils/obsproc/rtofs/CMakeLists.txt | 20 +------ utils/test/CMakeLists.txt | 53 +++++++++++++++---- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/utils/obsproc/applications/CMakeLists.txt b/utils/obsproc/applications/CMakeLists.txt index f03631855..99b517aa2 100644 --- a/utils/obsproc/applications/CMakeLists.txt +++ b/utils/obsproc/applications/CMakeLists.txt @@ -10,6 +10,5 @@ target_compile_features( gdas_obsprovider2ioda.x PUBLIC cxx_std_17) target_link_libraries( gdas_obsprovider2ioda.x PUBLIC oops ioda NetCDF::NetCDF_CXX) -# to be used when rtofs is a static library: -# link_directories(${CMAKE_SOURCE_DIR}/rtofs) -# target_link_libraries( gdas_obsprovider2ioda.x PRIVATE rtofs) +link_directories(${CMAKE_SOURCE_DIR}/rtofs) +target_link_libraries(gdas_obsprovider2ioda.x PRIVATE rtofs) diff --git a/utils/obsproc/applications/gdas_obsprovider2ioda.h b/utils/obsproc/applications/gdas_obsprovider2ioda.h index eb53fce0b..ac08b19c6 100644 --- a/utils/obsproc/applications/gdas_obsprovider2ioda.h +++ b/utils/obsproc/applications/gdas_obsprovider2ioda.h @@ -36,7 +36,6 @@ namespace gdasapp { Ghrsst2Ioda conv2ioda(fullConfig, this->getComm()); conv2ioda.writeToIoda(); } else if (provider == "RTOFStmp") { - // RTOFSInSitu conv2ioda(fullConfig, this->getComm()); RTOFSTemperature conv2ioda(fullConfig, this->getComm()); conv2ioda.writeToIoda(); } else if (provider == "RTOFSsal") { diff --git a/utils/obsproc/rtofs/CMakeLists.txt b/utils/obsproc/rtofs/CMakeLists.txt index 25f22474f..d524b22a3 100644 --- a/utils/obsproc/rtofs/CMakeLists.txt +++ b/utils/obsproc/rtofs/CMakeLists.txt @@ -1,13 +1,3 @@ -# message("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR") -# message("Current source directory: ${CMAKE_CURRENT_SOURCE_DIR}") -# message("Current binary directory: ${CMAKE_CURRENT_BINARY_DIR}") -# message("CMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}") -# message("C_INCLUDE_PATH=${C_INCLUDE_PATH}") -# message("CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}") -# message("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR") - -# include_directories(${CMAKE_SOURCE_DIR}) - set( rtofs_src_files RTOFSDataFile.h @@ -27,18 +17,10 @@ list( add_library(rtofs STATIC ${rtofs_src_files} ) -# ecbuild_add_library( - # TARGET rtofs - # TYPE STATIC - # SOURCES ${rtofs_src_files} -# ) target_compile_features( rtofs PUBLIC cxx_std_17 ) -target_link_libraries( rtofs PUBLIC oops ioda NetCDF::NetCDF_CXX ) - -# target_link_libraries(rtofs PUBLIC oops) -target_include_directories( rtofs PUBLIC ${oops_INCLUDE_DIRS} ) +target_link_libraries(rtofs PUBLIC oops ioda NetCDF::NetCDF_CXX) diff --git a/utils/test/CMakeLists.txt b/utils/test/CMakeLists.txt index 3eee8010d..87c8ffd00 100644 --- a/utils/test/CMakeLists.txt +++ b/utils/test/CMakeLists.txt @@ -70,26 +70,57 @@ ecbuild_add_test( TARGET test_gdasapp_util_ghrsst2ioda LIBS gdas-utils WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/obsproc) -#TODO: -# add binary files for the test -# Test the RTOFS in Situ converter -# ecbuild_add_test( TARGET test_gdasapp_util_rtofsinsitu - # COMMAND ${CMAKE_BINARY_DIR}/bin/gdas_obsprovider2ioda.x - # ARGS "../testinput/gdas_rtofsinsitu.yaml" - # LIBS gdas-utils - # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/obsproc) - -ecbuild_add_test( TARGET test_gdasapp_util_rtofstmp + + +# copy rtofs binary input files to the testing area +# and generate the tests +execute_process( + COMMAND hostname + OUTPUT_VARIABLE HOSTNAME OUTPUT_STRIP_TRAILING_WHITESPACE +) + +set(RTOFS_INPUT_FILE1 "rtofsinsitu_2024032600.profile") +set(RTOFS_INPUT_FILE2 "rtofsinsitu_2024032700.profile") + +if (${HOSTNAME} MATCHES "^([Oo][rR]ion)") + set(RTOFS_FILES_PATH + "/work/noaa/da/marineda/gfs-marine/data/obs/ci/obs" + ) +endif() +if (${HOSTNAME} MATCHES "^(Hera)") + set(RTOFS_FILES_PATH + "/scratch1/NCEPDEV/da/common/ci/obs" + ) +endif() + +set(RTOFS_FILE1 "${RTOFS_FILES_PATH}/${RTOFS_INPUT_FILE1}") +set(RTOFS_FILE2 "${RTOFS_FILES_PATH}/${RTOFS_INPUT_FILE2}") +set(DESTINATION_DIR "${CMAKE_CURRENT_BINARY_DIR}/obsproc") + +if (EXISTS ${RTOFS_FILE1} AND EXISTS ${RTOFS_FILE2}) + message("Found RTOFS files; generating tests") + + file(COPY ${RTOFS_FILE1} DESTINATION ${DESTINATION_DIR}) + file(COPY ${RTOFS_FILE2} DESTINATION ${DESTINATION_DIR}) + + # Test the RTOFStmp to IODA converter + ecbuild_add_test( TARGET test_gdasapp_util_rtofstmp COMMAND ${CMAKE_BINARY_DIR}/bin/gdas_obsprovider2ioda.x ARGS "../testinput/gdas_rtofstmp.yaml" LIBS gdas-utils WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/obsproc) -ecbuild_add_test( TARGET test_gdasapp_util_rtofssal + # Test the RTOFSsal to IODA converter + ecbuild_add_test( TARGET test_gdasapp_util_rtofssal COMMAND ${CMAKE_BINARY_DIR}/bin/gdas_obsprovider2ioda.x ARGS "../testinput/gdas_rtofssal.yaml" LIBS gdas-utils WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/obsproc) +else() + message("Error: RTOFS input files not found; no test generated.") +endif() + + # Test the SMAP to IODA converter ecbuild_add_test( TARGET test_gdasapp_util_smap2ioda