From cd6a6b9dc64156d6df5913bdeed57d47e6be01fe Mon Sep 17 00:00:00 2001 From: Luca Bertagna Date: Thu, 19 Dec 2024 12:51:33 -0700 Subject: [PATCH 1/3] EAMxx: reorg query-cf-database utility * Moved to its own folder * Do not add scripts subdir when building EAMxx * Move data/*yaml in query-cf-database folder --- components/eamxx/CMakeLists.txt | 3 --- components/eamxx/scripts/README.md | 2 +- .../eamxx/scripts/{ => query-cf-database}/CMakeLists.txt | 7 ++++--- .../query-cf-database}/cf-scream-name-table.yaml | 0 .../query-cf-database}/cf-standard-name-table.yaml | 0 .../eamxx/scripts/{ => query-cf-database}/cf-xml-to-yaml | 0 .../scripts/{ => query-cf-database}/query-cf-database.cpp | 0 7 files changed, 5 insertions(+), 7 deletions(-) rename components/eamxx/scripts/{ => query-cf-database}/CMakeLists.txt (67%) rename components/eamxx/{data => scripts/query-cf-database}/cf-scream-name-table.yaml (100%) rename components/eamxx/{data => scripts/query-cf-database}/cf-standard-name-table.yaml (100%) rename components/eamxx/scripts/{ => query-cf-database}/cf-xml-to-yaml (100%) rename components/eamxx/scripts/{ => query-cf-database}/query-cf-database.cpp (100%) diff --git a/components/eamxx/CMakeLists.txt b/components/eamxx/CMakeLists.txt index 693b8ae8a094..1119a3f031f7 100644 --- a/components/eamxx/CMakeLists.txt +++ b/components/eamxx/CMakeLists.txt @@ -584,9 +584,6 @@ if (NOT DEFINED ENV{SCREAM_FAKE_ONLY}) ${CMAKE_CURRENT_BINARY_DIR}/src/scream_config.h F90_FILE ${CMAKE_CURRENT_BINARY_DIR}/src/scream_config.f) - # Build any tools in the scripts/ dir. - add_subdirectory(scripts) - # Generate scream_config.h and scream_config.f include (EkatUtils) EkatConfigFile(${CMAKE_CURRENT_SOURCE_DIR}/src/scream_config.h.in diff --git a/components/eamxx/scripts/README.md b/components/eamxx/scripts/README.md index 0bcb8d79e6a1..d139ca7fcf44 100644 --- a/components/eamxx/scripts/README.md +++ b/components/eamxx/scripts/README.md @@ -80,7 +80,7 @@ This tool is not used in our core testing tools and goes through long periods of (IE there are no active ongoing porting efforts). It is likely this tool will not work exactly as expected if it has not been run in a while or is being used on a package on which it has not been used before. -## cf-xml-to-yaml +## query-cf-database/cf-xml-to-yaml Given an XML file containing the CF conventions for standardized field names (https://cfconventions.org/standard-names.html), this tool generates a YAML diff --git a/components/eamxx/scripts/CMakeLists.txt b/components/eamxx/scripts/query-cf-database/CMakeLists.txt similarity index 67% rename from components/eamxx/scripts/CMakeLists.txt rename to components/eamxx/scripts/query-cf-database/CMakeLists.txt index 377452229b9d..912007606024 100644 --- a/components/eamxx/scripts/CMakeLists.txt +++ b/components/eamxx/scripts/query-cf-database/CMakeLists.txt @@ -1,8 +1,8 @@ -# Generate the source file for the CF validator and build it. +# Build the CF validator tool -set (CF_STANDARD_NAME_FILE "${PROJECT_SOURCE_DIR}/data/cf-standard-name-table.yaml" +set (CF_STANDARD_NAME_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cf-standard-name-table.yaml" CACHE STRING "Location of the cf standard name yaml table") -set (CF_SCREAM_NAME_FILE "${PROJECT_SOURCE_DIR}/data/cf-scream-name-table.yaml" +set (CF_SCREAM_NAME_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cf-scream-name-table.yaml" CACHE STRING "Location of the scream-specific cf name yaml table") add_executable(query-cf-database query-cf-database.cpp) @@ -10,5 +10,6 @@ target_compile_definitions(query-cf-database PUBLIC CF_STANDARD_NAME_FILE=${CF_STANDARD_NAME_FILE} CF_SCREAM_NAME_FILE=${CF_SCREAM_NAME_FILE}) +find_package (ekat HINTS ${EKAT_ROOT}) find_package (yaml-cpp HINTS ${YAML_CPP_ROOT}) target_link_libraries(query-cf-database ekat yaml-cpp) diff --git a/components/eamxx/data/cf-scream-name-table.yaml b/components/eamxx/scripts/query-cf-database/cf-scream-name-table.yaml similarity index 100% rename from components/eamxx/data/cf-scream-name-table.yaml rename to components/eamxx/scripts/query-cf-database/cf-scream-name-table.yaml diff --git a/components/eamxx/data/cf-standard-name-table.yaml b/components/eamxx/scripts/query-cf-database/cf-standard-name-table.yaml similarity index 100% rename from components/eamxx/data/cf-standard-name-table.yaml rename to components/eamxx/scripts/query-cf-database/cf-standard-name-table.yaml diff --git a/components/eamxx/scripts/cf-xml-to-yaml b/components/eamxx/scripts/query-cf-database/cf-xml-to-yaml similarity index 100% rename from components/eamxx/scripts/cf-xml-to-yaml rename to components/eamxx/scripts/query-cf-database/cf-xml-to-yaml diff --git a/components/eamxx/scripts/query-cf-database.cpp b/components/eamxx/scripts/query-cf-database/query-cf-database.cpp similarity index 100% rename from components/eamxx/scripts/query-cf-database.cpp rename to components/eamxx/scripts/query-cf-database/query-cf-database.cpp From 3fe9539e0c79e05e3f3f815ce31b02f77ba1ead7 Mon Sep 17 00:00:00 2001 From: Luca Bertagna Date: Thu, 19 Dec 2024 13:20:06 -0700 Subject: [PATCH 2/3] EAM: removed stale code in buildnml The folder eamxx/data no longer exists, and did not contain any input data for EAM in the first place --- components/eam/cime_config/buildnml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/components/eam/cime_config/buildnml b/components/eam/cime_config/buildnml index a86cd0fc17d9..beea61fd215f 100755 --- a/components/eam/cime_config/buildnml +++ b/components/eam/cime_config/buildnml @@ -233,29 +233,6 @@ def buildnml(case, caseroot, compname): safe_copy(os.path.join(eamconf_dir, "atm_in"), os.path.join(rundir, "atm_in{}".format(inst_string))) safe_copy(os.path.join(eamconf_dir, "drv_flds_in"), os.path.join(rundir, "drv_flds_in")) - # ----------------------------------------------------- - # copy scream input data - # ----------------------------------------------------- - - with SharedArea(): - scream_data_dir = os.path.join(case.get_value("SRCROOT"), "components/eamxx/data") - for item in os.listdir(scream_data_dir): - tgt_dir = os.path.join(din_loc_root, "atm/cam/physprops") - tgt_path = os.path.join(tgt_dir, item) - if not os.path.isdir(tgt_dir): - try: - os.makedirs(tgt_dir) - except OSError: - pass # lost the race - - try: - fd = os.open(tgt_path, os.O_CREAT | os.O_EXCL) - # If we get to this line, we won the race - os.close(fd) - safe_copy(os.path.join(scream_data_dir, item), tgt_path) - except OSError: - pass # lost the race - ############################################################################### def _main_func(): ############################################################################### From a166b4579f05ecbb7fe2264d9719f06eddf315f0 Mon Sep 17 00:00:00 2001 From: Luca Bertagna Date: Fri, 20 Dec 2024 09:10:53 -0700 Subject: [PATCH 3/3] EAMxx: fix md linting of README --- components/eamxx/scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eamxx/scripts/README.md b/components/eamxx/scripts/README.md index d139ca7fcf44..bcff04a11cd2 100644 --- a/components/eamxx/scripts/README.md +++ b/components/eamxx/scripts/README.md @@ -83,7 +83,7 @@ has not been run in a while or is being used on a package on which it has not be ## query-cf-database/cf-xml-to-yaml Given an XML file containing the CF conventions for standardized field names -(https://cfconventions.org/standard-names.html), this tool generates a YAML +(which can be found [here](https://cfconventions.org/standard-names.html)), this tool generates a YAML file with the same information. This tool is not used in our core testing tools, but it is extremely simple and not coupled to anything else in the repo,