Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding code to convert the 2-D Wave Height and Wind Gust fields between Extended Schimdt Gnomonic (ESG) grid and Rotated LatLon (RLL) grid for rrfs-based 3drtma #71

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ list(APPEND SUBLIST "PM")
list(APPEND SUBLIST "RADMON")
list(APPEND SUBLIST "REF2TTEN")
list(APPEND SUBLIST "RTMA_MINMAXTRH")
list(APPEND SUBLIST "RTMA_ESG_CONVERSION")
list(APPEND SUBLIST "UPDATE_BC")
list(APPEND SUBLIST "UPDATE_GVF")
list(APPEND SUBLIST "UPDATE_ICE")
Expand Down Expand Up @@ -86,6 +87,8 @@ find_package(gsi REQUIRED)
add_subdirectory(baselib/regional_esg_grid.fd)
add_subdirectory(baselib)

add_subdirectory(rtma_esg_conversion.fd/esg_lib.fd)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GangZhao-NOAA Is that ok to also put the add_subdirectory line to the following foreach loop as for other tools?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TingLei-NOAA
Hi Ting,

Technically I agree with you that, by adding a line as following,
list(APPEND SUBLIST "RTMA_ESG_CONVERSION.fd/ESG_LIB")
then the add_subdirectory line you mentioned -- "add_subdirectory(rtma_esg_conversion.fd/esg_lib.fd)" could be put into the following foreach loop.

However, as you also mentioned, that foreach loop is used to define each application tool (ie., the executables). As for the "rtma_esg_conversion.fd/esg_lib.fd", it is a library which some RRFS tools could depend on and link to , but not a application tool. So I would like to put this line "add_subdirectory(rtma_esg_conversion.fd/esg_lib.fd)" here together with the declarations of the other libraries (e.g., baselib, gsi lib, etc.).

Thank you!

-Gang

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gang, Thanks a lot for your explanation. I totally agree. This also follows the existing layout of this project.


foreach(X IN LISTS SUBLIST)
if(${${X}})
string(TOLOWER ${X} x)
Expand Down
51 changes: 51 additions & 0 deletions rtma_esg_conversion.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
list(APPEND src_rll2esg
mod_rtma_regrid.F90
rtma_regrid_rll2esg.F90)

add_executable(rtma_regrid_rll2esg.exe ${src_rll2esg})
target_link_libraries(rtma_regrid_rll2esg.exe PRIVATE ${PROJECT_NAME}::pesglib2
PRIVATE bacio::bacio_4
PRIVATE g2::g2_4
PRIVATE g2tmpl::g2tmpl
PRIVATE ip::ip_d
PRIVATE sp::sp_d
PRIVATE w3emc::w3emc_4
PRIVATE NetCDF::NetCDF_Fortran
PRIVATE MPI::MPI_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(rtma_regrid_rll2esg.exe PRIVATE OpenMP::OpenMP_Fortran)
endif()
list(APPEND ESG_CONVERSION_Targets rtma_regrid_rll2esg.exe)

list(APPEND src_esg2rll
mod_rtma_regrid.F90
rtma_regrid_esg2rll.F90)

add_executable(rtma_regrid_esg2rll.exe ${src_esg2rll})
target_link_libraries(rtma_regrid_esg2rll.exe PRIVATE ${PROJECT_NAME}::pesglib2
PRIVATE bacio::bacio_4
PRIVATE g2::g2_4
PRIVATE g2tmpl::g2tmpl
PRIVATE ip::ip_d
PRIVATE sp::sp_d
PRIVATE w3emc::w3emc_4
PRIVATE NetCDF::NetCDF_Fortran
PRIVATE MPI::MPI_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(rtma_regrid_esg2rll.exe PRIVATE OpenMP::OpenMP_Fortran)
endif()
list(APPEND ESG_CONVERSION_Targets rtma_regrid_esg2rll.exe)

# if(ip_VERSION GREATER_EQUAL 4.0.0)
# set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIP_V4")
# endif()
if(ip_VERSION LESS 4.0.0)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIP_V3")
endif()

install(
TARGETS ${ESG_CONVERSION_Targets}
EXPORT ${PROJECT_NAME}Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
28 changes: 28 additions & 0 deletions rtma_esg_conversion.fd/esg_lib.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
list(APPEND src_esg_lib
pkind.f90
pietc.f90
pietc_s.f90
pmat.f90
pmat2.f90
pmat4.f90
pmat5.f90
pfun.f90
psym2.f90
pesg.f90
pbswi.f90)

set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include")
add_library(pesglib2 STATIC ${src_esg_lib})
add_library(${PROJECT_NAME}::pesglib2 ALIAS pesglib2)
# target_link_libraries(pesglib2 PUBLIC ${PROJECT_NAME}::ncio)
set_target_properties(pesglib2 PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}")
target_include_directories(pesglib2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})

install(
TARGETS pesglib2
EXPORT ${PROJECT_NAME}Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
Loading
Loading