Skip to content

Commit

Permalink
added cmake code for staging rtofs input files
Browse files Browse the repository at this point in the history
  • Loading branch information
givelberg committed Jun 6, 2024
1 parent 821dd36 commit e34f552
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 34 deletions.
5 changes: 2 additions & 3 deletions utils/obsproc/applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion utils/obsproc/applications/gdas_obsprovider2ioda.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
20 changes: 1 addition & 19 deletions utils/obsproc/rtofs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
53 changes: 42 additions & 11 deletions utils/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e34f552

Please sign in to comment.