From 4610610e7dd566c72462fcc535faa6cda4e9cdde Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 7 Jan 2022 11:34:07 -0500 Subject: [PATCH 1/7] add option to build with GTG code or stubs --- CMakeLists.txt | 1 + sorc/ncep_post.fd/CMakeLists.txt | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff311e9d0..fdaf87d5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") option(OPENMP "use OpenMP threading" ON) option(BUILD_POSTEXEC "Build NCEPpost executable" ON) option(BUILD_WITH_WRFIO "Build NCEPpost with WRF-IO library" OFF) +option(BUILD_WITH_GTG "Build NCEPpost with NCAR/GTG" OFF) option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF) if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 8dc6fae37..3c8a96008 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -137,6 +137,20 @@ list(APPEND LIB_SRC xml_perl_data.f ZENSUN.f) +list(APPEND GTG_LIB_SRC + gtg_algo.F90 + gtg_compute.F90 + gtg_config.F90 + gtg_ctlblk.F90 + gtg_filter.F90 + gtg_indices.F90 + gtg_smoothseams.F90) + +if(BUILD_WITH_GTG) + list(TRANSFORM GTG_LIB_SRC PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/../post_gtg.fd/) + list(APPEND LIB_SRC ${GTG_LIB_SRC}) +endif() + list(APPEND EXE_SRC ASSIGNNEMSIOVAR.f GETNEMSNDSCATTER.f From 85138f060146a3f99414b30b953c9da753c021e5 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 7 Jan 2022 11:58:37 -0500 Subject: [PATCH 2/7] make IP optional depending on GTG option. --- .gitignore | 4 ++-- CMakeLists.txt | 4 +++- sorc/ncep_post.fd/CMakeLists.txt | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2dc827ccf..c9d3f6e12 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ # USE CAUTION WHEN ADDING WILDCARDS, as some builds use different filename # # conventions than others # ############################################################################## -build/ -install/ +build*/ +install*/ *.[aox] *.mod diff --git a/CMakeLists.txt b/CMakeLists.txt index fdaf87d5b..8100dd0d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,9 @@ find_package(bacio REQUIRED) find_package(crtm REQUIRED) find_package(g2 REQUIRED) find_package(g2tmpl REQUIRED) -find_package(ip REQUIRED) +if(BUILD_WITH_GTG) + find_package(ip REQUIRED) +endif() if(BUILD_POSTEXEC) find_package(nemsio REQUIRED) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 3c8a96008..7c6e145d6 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -214,10 +214,14 @@ target_link_libraries(${LIBNAME} PUBLIC crtm::crtm g2::g2_4 g2tmpl::g2tmpl - ip::ip_4 MPI::MPI_Fortran NetCDF::NetCDF_Fortran) +if(BUILD_WITH_GTG) + target_link_libraries(${LIBNAME} PUBLIC + ip::ip_4) +endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(${LIBNAME} PUBLIC OpenMP::OpenMP_Fortran) endif() From 766d0afd01c467a83c1fedb9c54a7773243702ed Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 7 Jan 2022 12:22:18 -0500 Subject: [PATCH 3/7] GTG code depends on a file that only resides in the gtg repo --- sorc/ncep_post.fd/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 7c6e145d6..7027fcec5 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -147,10 +147,13 @@ list(APPEND GTG_LIB_SRC gtg_smoothseams.F90) if(BUILD_WITH_GTG) + list(APPEND GTG_LIB_SRC + map_routines.F90) list(TRANSFORM GTG_LIB_SRC PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/../post_gtg.fd/) - list(APPEND LIB_SRC ${GTG_LIB_SRC}) endif() +list(APPEND LIB_SRC ${GTG_LIB_SRC}) + list(APPEND EXE_SRC ASSIGNNEMSIOVAR.f GETNEMSNDSCATTER.f From 0c10383f337c5ef73902d8dec9bf532203592053 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 7 Jan 2022 12:39:23 -0500 Subject: [PATCH 4/7] fix a big boo-boo --- sorc/ncep_post.fd/CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 7027fcec5..80b25804e 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -63,13 +63,6 @@ list(APPEND LIB_SRC GPVS.f grib2_module.f GRIDSPEC.f - gtg_algo.F90 - gtg_compute.F90 - gtg_config.F90 - gtg_ctlblk.F90 - gtg_filter.F90 - gtg_indices.F90 - gtg_smoothseams.F90 ICAOHEIGHT.f kinds_mod.F LFMFLD.f From c6f9c0334619cb5d46ce74742528cf799388b01b Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sun, 9 Jan 2022 08:09:27 -0500 Subject: [PATCH 5/7] move sorc/post_gtg.fd to sorc/ncep_post.fd/post_gtg.fd and update build path to GTG --- .gitmodules | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 2 +- sorc/{ => ncep_post.fd}/post_gtg.fd | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename sorc/{ => ncep_post.fd}/post_gtg.fd (100%) diff --git a/.gitmodules b/.gitmodules index 2c09fa095..6e171e583 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "sorc/post_gtg.fd"] - path = sorc/post_gtg.fd + path = sorc/ncep_post.fd/post_gtg.fd url = https://github.com/NCAR/UPP_GTG update = none diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 80b25804e..ebf659075 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -142,7 +142,7 @@ list(APPEND GTG_LIB_SRC if(BUILD_WITH_GTG) list(APPEND GTG_LIB_SRC map_routines.F90) - list(TRANSFORM GTG_LIB_SRC PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/../post_gtg.fd/) + list(TRANSFORM GTG_LIB_SRC PREPEND post_gtg.fd/) endif() list(APPEND LIB_SRC ${GTG_LIB_SRC}) diff --git a/sorc/post_gtg.fd b/sorc/ncep_post.fd/post_gtg.fd similarity index 100% rename from sorc/post_gtg.fd rename to sorc/ncep_post.fd/post_gtg.fd From da1a313f79e5b749fa8350d0d8e73d290f9a4859 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sun, 9 Jan 2022 17:15:19 -0500 Subject: [PATCH 6/7] correct the name of the submodule. fix mixed indents --- .gitmodules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6e171e583..742a824df 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ -[submodule "sorc/post_gtg.fd"] - path = sorc/ncep_post.fd/post_gtg.fd - url = https://github.com/NCAR/UPP_GTG - update = none +[submodule "post_gtg.fd"] + path = sorc/ncep_post.fd/post_gtg.fd + url = https://github.com/NCAR/UPP_GTG + update = none From dc3186267a9dedf447239cc73fb7374fd2c5237f Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sun, 9 Jan 2022 17:43:45 -0500 Subject: [PATCH 7/7] move map_routines.F90 into the GTG src list --- sorc/ncep_post.fd/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ebf659075..5fba419fc 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -69,7 +69,6 @@ list(APPEND LIB_SRC LFMFLD_GFS.f LOOKUP.f machine.f - map_routines.F90 MAPSSLP.f MASKS_mod.f MDL2AGL.f @@ -137,11 +136,10 @@ list(APPEND GTG_LIB_SRC gtg_ctlblk.F90 gtg_filter.F90 gtg_indices.F90 - gtg_smoothseams.F90) + gtg_smoothseams.F90 + map_routines.F90) if(BUILD_WITH_GTG) - list(APPEND GTG_LIB_SRC - map_routines.F90) list(TRANSFORM GTG_LIB_SRC PREPEND post_gtg.fd/) endif()