From 254b8ce2ce53d6d99aca8125b504667a8591d9a2 Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Wed, 16 Oct 2024 17:01:10 +0000
Subject: [PATCH 01/16] Updating module files for building with current spack
 stack

---
 CMakeLists.txt                         |  6 ++-
 modulefiles/ufs_common.lua             | 32 +++++++++++++++
 modulefiles/ufs_derecho.intel.lua      | 30 ++++++++++++++
 modulefiles/ufs_gaea.intel.lua         | 33 ++++++++++++++++
 modulefiles/ufs_hera.intel.lua         | 26 ++++++++++++
 modulefiles/ufs_hera.intelllvm.lua     | 33 ++++++++++++++++
 modulefiles/ufs_hercules.intel.lua     | 26 ++++++++++++
 modulefiles/ufs_hercules.intelllvm.lua | 30 ++++++++++++++
 modulefiles/ufs_orion.intel.lua        | 29 ++++++++++++++
 modulefiles/ufs_wcoss2.intel.lua       | 55 ++++++++++++++++++++++++++
 10 files changed, 298 insertions(+), 2 deletions(-)
 create mode 100644 modulefiles/ufs_common.lua
 create mode 100644 modulefiles/ufs_derecho.intel.lua
 create mode 100644 modulefiles/ufs_gaea.intel.lua
 create mode 100644 modulefiles/ufs_hera.intel.lua
 create mode 100644 modulefiles/ufs_hera.intelllvm.lua
 create mode 100644 modulefiles/ufs_hercules.intel.lua
 create mode 100644 modulefiles/ufs_hercules.intelllvm.lua
 create mode 100644 modulefiles/ufs_orion.intel.lua
 create mode 100644 modulefiles/ufs_wcoss2.intel.lua

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a99c58..1a5e6b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,11 +2,13 @@
 cmake_minimum_required(VERSION 3.5)
 
 # set compiler
-if(NOT DEFINED ENV{CMAKE_Fortran_COMPILER})
+if(NOT DEFINED ENV{FC})
   message(FATAL_ERROR "CMAKE_Fortran_COMPILER is not defined")
 endif()
 
-set(CMAKE_Fortran_COMPILER $ENV{CMAKE_Fortran_COMPILER})
+set(CMAKE_Fortran_COMPILER $ENV{FC})
+set(CMAKE_C_COMPILER $ENV{CC})
+set(CMAKE_CXX_COMPILER $ENV{CXX})
 
 # set the project name and version
 project(NEXUS
diff --git a/modulefiles/ufs_common.lua b/modulefiles/ufs_common.lua
new file mode 100644
index 0000000..3c7ddbc
--- /dev/null
+++ b/modulefiles/ufs_common.lua
@@ -0,0 +1,32 @@
+whatis("Description: UFS build environment common libraries")
+
+help([[Load UFS Model common libraries]])
+
+local ufs_modules = {
+  {["jasper"]          = "2.0.32"},
+  {["zlib"]            = "1.2.13"},
+  {["libpng"]          = "1.6.37"},
+  {["hdf5"]            = "1.14.0"},
+  {["netcdf-c"]        = "4.9.2"},
+  {["netcdf-fortran"]  = "4.6.1"},
+  {["parallelio"]      = "2.5.10"},
+  {["esmf"]            = "8.6.0"},
+  {["fms"]             = "2024.01"},
+  {["bacio"]           = "2.4.1"},
+  {["crtm"]            = "2.4.0"},
+  {["g2"]              = "3.5.1"},
+  {["g2tmpl"]          = "1.13.0"},
+  {["ip"]              = "4.3.0"},
+  {["sp"]              = "2.5.0"},
+  {["w3emc"]           = "2.10.0"},
+  {["gftl-shared"]     = "1.6.1"},
+  {["mapl"]            = "2.40.3-esmf-8.6.0"},
+  {["scotch"]          = "7.0.4"},
+}
+
+for i = 1, #ufs_modules do
+  for name, default_version in pairs(ufs_modules[i]) do
+    local env_version_name = string.gsub(name, "-", "_") .. "_ver"
+    load(pathJoin(name, os.getenv(env_version_name) or default_version))
+  end
+end
\ No newline at end of file
diff --git a/modulefiles/ufs_derecho.intel.lua b/modulefiles/ufs_derecho.intel.lua
new file mode 100644
index 0000000..e3bc52f
--- /dev/null
+++ b/modulefiles/ufs_derecho.intel.lua
@@ -0,0 +1,30 @@
+help([[
+loads UFS Model prerequisites for NOAA Parallelworks/Intel
+]])
+
+setenv("LMOD_TMOD_FIND_FIRST","yes")
+prepend_path("MODULEPATH", "/glade/work/epicufsrt/contrib/spack-stack/derecho/modulefiles")
+load("ecflow/5.8.4")
+load("mysql/8.0.33")
+
+setenv("LMOD_TMOD_FIND_FIRST","yes")
+prepend_path("MODULEPATH", "/lustre/desc1/scratch/epicufsrt/contrib/modulefiles_extra")
+prepend_path("MODULEPATH", "/glade/work/epicufsrt/contrib/spack-stack/derecho/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
+
+unload("ncarcompilers")
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.10.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_cray_mpich_ver=os.getenv("stack-cray-mpich_ver") or "8.1.25"
+load(pathJoin("stack-cray-mpich", stack_cray_mpich_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+stack_python_ver=os.getenv("stack_python_ver") or "3.10.13"
+load(pathJoin("stack-python", stack_python_ver))
+
+setenv("CMAKE_Platform", "derecho.intel")
+load("ufs-weather-model-env")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_gaea.intel.lua b/modulefiles/ufs_gaea.intel.lua
new file mode 100644
index 0000000..5014c19
--- /dev/null
+++ b/modulefiles/ufs_gaea.intel.lua
@@ -0,0 +1,33 @@
+help([[
+  This module loads libraries required for building and running UFS Weather Model 
+  on the NOAA RDHPC machine Gaea C5 using Intel-2023.1.0.
+]])
+
+whatis([===[Loads libraries needed for building the UFS Weather Model on Gaea ]===])
+
+prepend_path("MODULEPATH", "/ncrc/proj/epic/spack-stack/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2023.1.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_cray_mpich_ver=os.getenv("stack_cray_mpich_ver") or "8.1.25"
+load(pathJoin("stack-cray-mpich", stack_cray_mpich_ver))
+
+stack_python_ver=os.getenv("stack_python_ver") or "3.10.13"
+load(pathJoin("stack-python", stack_python_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+unload("darshan-runtime")
+unload("cray-libsci")
+
+setenv("CC","cc")
+setenv("CXX","CC")
+setenv("FC","ftn")
+setenv("CMAKE_Platform","gaea.intel")
\ No newline at end of file
diff --git a/modulefiles/ufs_hera.intel.lua b/modulefiles/ufs_hera.intel.lua
new file mode 100644
index 0000000..d4c61c0
--- /dev/null
+++ b/modulefiles/ufs_hera.intel.lua
@@ -0,0 +1,26 @@
+help([[
+loads UFS Model prerequisites for Hera/Intel
+]])
+
+prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.5.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_impi_ver=os.getenv("stack_impi_ver") or "2021.5.1"
+load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+setenv("CC", "mpiicc")
+setenv("CXX", "mpiicpc")
+setenv("FC", "mpiifort")
+setenv("CMAKE_Platform", "hera.intel")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_hera.intelllvm.lua b/modulefiles/ufs_hera.intelllvm.lua
new file mode 100644
index 0000000..213135d
--- /dev/null
+++ b/modulefiles/ufs_hera.intelllvm.lua
@@ -0,0 +1,33 @@
+help([[
+loads UFS Model prerequisites for Hera/IntelLLVM
+]])
+
+prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/upp-addon-env/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.5.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_impi_ver=os.getenv("stack_impi_ver") or "2021.5.1"
+load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver))
+
+load("gnu")
+load("intel/2023.2.0")
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+setenv("I_MPI_CC", "icx")
+setenv("I_MPI_CXX", "icpx")
+setenv("I_MPI_FC", "ifx")
+
+setenv("CC", "mpicc")
+setenv("CXX", "mpiicpc")
+setenv("FC", "mpifc")
+setenv("CMAKE_Platform", "hera.intel")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_hercules.intel.lua b/modulefiles/ufs_hercules.intel.lua
new file mode 100644
index 0000000..087939b
--- /dev/null
+++ b/modulefiles/ufs_hercules.intel.lua
@@ -0,0 +1,26 @@
+help([[
+loads UFS Model prerequisites for Hercules/Intel
+]])
+
+prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/hercules/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.9.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_impi_ver=os.getenv("stack_impi_ver") or "2021.9.0"
+load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+setenv("CC", "mpiicc")
+setenv("CXX", "mpiicpc")
+setenv("FC", "mpiifort")
+setenv("CMAKE_Platform", "hercules.intel")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_hercules.intelllvm.lua b/modulefiles/ufs_hercules.intelllvm.lua
new file mode 100644
index 0000000..f0b509e
--- /dev/null
+++ b/modulefiles/ufs_hercules.intelllvm.lua
@@ -0,0 +1,30 @@
+help([[
+loads UFS Model prerequisites for Hercules/IntelLLVM
+]])
+
+prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/hercules/spack-stack-1.6.0/envs/upp-addon-env/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.9.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_impi_ver=os.getenv("stack_impi_ver") or "2021.9.0"
+load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+setenv("I_MPI_CC", "icx")
+setenv("I_MPI_CXX", "icpx")
+setenv("I_MPI_F90", "ifx")
+
+setenv("CC", "mpiicc")
+setenv("CXX", "mpiicpc")
+setenv("FC", "mpiifort")
+setenv("CMAKE_Platform", "hercules.intel")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_orion.intel.lua b/modulefiles/ufs_orion.intel.lua
new file mode 100644
index 0000000..556e0a5
--- /dev/null
+++ b/modulefiles/ufs_orion.intel.lua
@@ -0,0 +1,29 @@
+help([[
+loads UFS Model prerequisites for Orion/Intel
+]])
+
+prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/orion/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
+
+stack_intel_ver=os.getenv("stack_intel_ver") or "2021.9.0"
+load(pathJoin("stack-intel", stack_intel_ver))
+
+stack_impi_ver=os.getenv("stack_impi_ver") or "2021.9.0"
+load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.23.1"
+load(pathJoin("cmake", cmake_ver))
+
+load("ufs_common")
+
+-- HDF5 needed for LM4
+hdf5_ver=os.getenv("hdf5_ver") or "1.14.0"
+load(pathJoin("hdf5", hdf5_ver))
+nccmp_ver=os.getenv("nccmp_ver") or "1.9.0.1"
+load(pathJoin("nccmp", nccmp_ver))
+
+setenv("CC", "mpiicc")
+setenv("CXX", "mpiicpc")
+setenv("FC", "mpiifort")
+setenv("CMAKE_Platform", "orion.intel")
+
+whatis("Description: UFS build environment")
\ No newline at end of file
diff --git a/modulefiles/ufs_wcoss2.intel.lua b/modulefiles/ufs_wcoss2.intel.lua
new file mode 100644
index 0000000..a825af6
--- /dev/null
+++ b/modulefiles/ufs_wcoss2.intel.lua
@@ -0,0 +1,55 @@
+help([[
+loads UFS Model prerequisites on Cactus and Dogwood
+]])
+
+-- First, look for libraries in "prod" space
+PrgEnv_intel_ver=os.getenv("PrgEnv_intel_ver") or "8.1.0"
+load(pathJoin("PrgEnv-intel", PrgEnv_intel_ver))
+
+intel_ver=os.getenv("intel_ver") or "19.1.3.304"
+load(pathJoin("intel", intel_ver))
+
+craype_ver=os.getenv("craype_ver") or "2.7.13"
+load(pathJoin("craype", craype_ver))
+
+cray_mpich_ver=os.getenv("cray_mpich_ver") or "8.1.12"
+load(pathJoin("cray-mpich", cray_mpich_ver))
+
+cmake_ver=os.getenv("cmake_ver") or "3.20.2"
+load(pathJoin("cmake", cmake_ver))
+
+local ufs_modules = {
+  {["jasper"]      = "2.0.25"},
+  {["zlib"]        = "1.2.11"},
+  {["libpng"]      = "1.6.37"},
+  {["hdf5-C"]      = "1.14.0"},
+  {["netcdf-C"]    = "4.9.2"},
+  {["pio-C"]       = "2.5.10"},
+  {["esmf-C"]      = "8.6.0"},
+  {["fms"]         = "2024.01"},
+  {["bacio"]       = "2.4.1"},
+  {["crtm"]        = "2.4.0"},
+  {["g2"]          = "3.5.1"},
+  {["g2tmpl"]      = "1.13.0"},
+  {["ip"]          = "4.0.0"},
+  {["sp"]          = "2.3.3"},
+  {["w3emc"]       = "2.12.0"},
+  {["gftl-shared"] = "1.6.1"},
+  {["mapl-C"]      = "2.40.3"},
+  {["pnetcdf-C"]   = "1.12.2"},
+  {["scotch"]      = "7.0.4"},
+}
+
+for i = 1, #ufs_modules do
+  for name, default_version in pairs(ufs_modules[i]) do
+    local env_version_name = string.gsub(name, "-", "_") .. "_ver"
+    load(pathJoin(name, os.getenv(env_version_name) or default_version))
+  end
+end
+
+setenv("CC", "cc")
+setenv("CXX", "CC")
+setenv("FC", "ftn")
+setenv("CMAKE_Platform", "wcoss2")
+
+whatis("Description: UFS build environment")
\ No newline at end of file

From 5048098391082b54eba094ff0f4de4882714ea8f Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Wed, 16 Oct 2024 17:37:14 +0000
Subject: [PATCH 02/16] adding generic linux module build

---
 modulefiles/ufs_linux.gnu   | 37 +++++++++++++++++++++++++++++++++++++
 modulefiles/ufs_linux.intel | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 modulefiles/ufs_linux.gnu
 create mode 100644 modulefiles/ufs_linux.intel

diff --git a/modulefiles/ufs_linux.gnu b/modulefiles/ufs_linux.gnu
new file mode 100644
index 0000000..34e325e
--- /dev/null
+++ b/modulefiles/ufs_linux.gnu
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#%Module######################################################################
+##
+##    UFS prerequisites: Linux (tested: Ubuntu) with gcc/gfortran compilers
+
+echo "Setting environment variables for UFS Model on Linux with gcc/gfortran"
+
+##
+## load programming environment: compiler, flags, paths
+##
+export CC=${CC:-mpicc}
+export CXX=${CXX:-mpicxx}
+export F77=${F77:-mpif77}
+export F90=${F90:-mpif90}
+export FC=${FC:-mpif90}
+
+##
+## set up variables for ../cmake/configure_linux.gnu.cmake
+##
+export CMAKE_Platform=linux.gnu
+
+##
+## use own NetCDF library
+##
+export NETCDF=${NETCDF:-/home/builder/opt}
+
+##
+## use pre-compiled EMSF library for above compiler / MPI combination
+##
+export ESMFMKFILE=${ESMFMKFILE:-/home/builder/opt/lib/esmf.mk}
+
+##
+## NCEP libraries (need to download and build manually, see doc/README_{UBUNTU,CENTOS,...}.txt and https://github.com/NCAR/NCEPlibs)
+##
+export NCEPLIBS_DIR=${NCEPLIBS_DIR:-/home/builder/opt}
+export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
\ No newline at end of file
diff --git a/modulefiles/ufs_linux.intel b/modulefiles/ufs_linux.intel
new file mode 100644
index 0000000..674dd76
--- /dev/null
+++ b/modulefiles/ufs_linux.intel
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#%Module######################################################################
+##
+##    UFS prerequisites: Linux (tested: Ubuntu) with gcc/gfortran compilers
+
+echo "Setting environment variables for UFS Model on Linux with gcc/gfortran"
+
+##
+## load programming environment: compiler, flags, paths
+##
+export CC=${CC:-mpicc}
+export CXX=${CXX:-mpicxx}
+export F77=${F77:-mpif77}
+export F90=${F90:-mpif90}
+export FC=${FC:-mpif90}
+
+##
+## set up variables for ../cmake/configure_linux.intel.cmake
+##
+export CMAKE_Platform=linux.intel
+
+##
+## use own NetCDF library
+##
+export NETCDF=${NETCDF:-/home/builder/opt}
+
+##
+## use pre-compiled EMSF library for above compiler / MPI combination
+##
+export ESMFMKFILE=${ESMFMKFILE:-/home/builder/opt/lib/esmf.mk}
+
+##
+## NCEP libraries (need to download and build manually, see doc/README_{UBUNTU,CENTOS,...}.txt and https://github.com/NCAR/NCEPlibs)
+##
+export NCEPLIBS_DIR=${NCEPLIBS_DIR:-/home/builder/opt}
+export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
\ No newline at end of file

From ee5f5388416a78172ff1f61756a30cd0adc49627 Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Thu, 17 Oct 2024 19:01:01 +0000
Subject: [PATCH 03/16] remove whitespace

---
 CMakeLists.txt | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20b3a3f..e0182ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,10 @@
 # Check environment
 cmake_minimum_required(VERSION 3.5)
 
+# set the project name and version
+project(NEXUS
+        VERSION 0.2.0
+        LANGUAGES Fortran)
 
 # set compiler
 if(NOT DEFINED ENV{FC})
@@ -11,11 +15,6 @@ set(CMAKE_Fortran_COMPILER $ENV{FC})
 set(CMAKE_C_COMPILER $ENV{CC})
 set(CMAKE_CXX_COMPILER $ENV{CXX})
 
-# set the project name and version
-project(NEXUS
-        VERSION 0.2.0
-        LANGUAGES Fortran)
-
 # Include local macros
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
 

From a721ee732d673cfa4485d672a4d45df66866b5b0 Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Thu, 17 Oct 2024 19:04:45 +0000
Subject: [PATCH 04/16] precommit issues

---
 modulefiles/ufs_common.lua             |  2 +-
 modulefiles/ufs_derecho.intel.lua      |  2 +-
 modulefiles/ufs_gaea.intel.lua         |  4 +--
 modulefiles/ufs_hera.intel.lua         |  2 +-
 modulefiles/ufs_hera.intelllvm.lua     |  2 +-
 modulefiles/ufs_hercules.intel.lua     |  2 +-
 modulefiles/ufs_hercules.intelllvm.lua |  2 +-
 modulefiles/ufs_linux.gnu              |  2 +-
 modulefiles/ufs_linux.intel            |  2 +-
 modulefiles/ufs_orion.intel.lua        |  2 +-
 modulefiles/ufs_wcoss2.intel.lua       |  2 +-
 modulefiles/wcoss_dell_p3              | 34 --------------------------
 12 files changed, 12 insertions(+), 46 deletions(-)
 delete mode 100644 modulefiles/wcoss_dell_p3

diff --git a/modulefiles/ufs_common.lua b/modulefiles/ufs_common.lua
index 3c7ddbc..062fa38 100644
--- a/modulefiles/ufs_common.lua
+++ b/modulefiles/ufs_common.lua
@@ -29,4 +29,4 @@ for i = 1, #ufs_modules do
     local env_version_name = string.gsub(name, "-", "_") .. "_ver"
     load(pathJoin(name, os.getenv(env_version_name) or default_version))
   end
-end
\ No newline at end of file
+end
diff --git a/modulefiles/ufs_derecho.intel.lua b/modulefiles/ufs_derecho.intel.lua
index e3bc52f..f858670 100644
--- a/modulefiles/ufs_derecho.intel.lua
+++ b/modulefiles/ufs_derecho.intel.lua
@@ -27,4 +27,4 @@ load(pathJoin("stack-python", stack_python_ver))
 setenv("CMAKE_Platform", "derecho.intel")
 load("ufs-weather-model-env")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_gaea.intel.lua b/modulefiles/ufs_gaea.intel.lua
index 5014c19..8c21dfa 100644
--- a/modulefiles/ufs_gaea.intel.lua
+++ b/modulefiles/ufs_gaea.intel.lua
@@ -1,5 +1,5 @@
 help([[
-  This module loads libraries required for building and running UFS Weather Model 
+  This module loads libraries required for building and running UFS Weather Model
   on the NOAA RDHPC machine Gaea C5 using Intel-2023.1.0.
 ]])
 
@@ -30,4 +30,4 @@ unload("cray-libsci")
 setenv("CC","cc")
 setenv("CXX","CC")
 setenv("FC","ftn")
-setenv("CMAKE_Platform","gaea.intel")
\ No newline at end of file
+setenv("CMAKE_Platform","gaea.intel")
diff --git a/modulefiles/ufs_hera.intel.lua b/modulefiles/ufs_hera.intel.lua
index d4c61c0..feaa88e 100644
--- a/modulefiles/ufs_hera.intel.lua
+++ b/modulefiles/ufs_hera.intel.lua
@@ -23,4 +23,4 @@ setenv("CXX", "mpiicpc")
 setenv("FC", "mpiifort")
 setenv("CMAKE_Platform", "hera.intel")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_hera.intelllvm.lua b/modulefiles/ufs_hera.intelllvm.lua
index 213135d..49e9f2b 100644
--- a/modulefiles/ufs_hera.intelllvm.lua
+++ b/modulefiles/ufs_hera.intelllvm.lua
@@ -30,4 +30,4 @@ setenv("CXX", "mpiicpc")
 setenv("FC", "mpifc")
 setenv("CMAKE_Platform", "hera.intel")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_hercules.intel.lua b/modulefiles/ufs_hercules.intel.lua
index 087939b..455ea4d 100644
--- a/modulefiles/ufs_hercules.intel.lua
+++ b/modulefiles/ufs_hercules.intel.lua
@@ -23,4 +23,4 @@ setenv("CXX", "mpiicpc")
 setenv("FC", "mpiifort")
 setenv("CMAKE_Platform", "hercules.intel")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_hercules.intelllvm.lua b/modulefiles/ufs_hercules.intelllvm.lua
index f0b509e..5fb97a5 100644
--- a/modulefiles/ufs_hercules.intelllvm.lua
+++ b/modulefiles/ufs_hercules.intelllvm.lua
@@ -27,4 +27,4 @@ setenv("CXX", "mpiicpc")
 setenv("FC", "mpiifort")
 setenv("CMAKE_Platform", "hercules.intel")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_linux.gnu b/modulefiles/ufs_linux.gnu
index 34e325e..fd1f49e 100644
--- a/modulefiles/ufs_linux.gnu
+++ b/modulefiles/ufs_linux.gnu
@@ -34,4 +34,4 @@ export ESMFMKFILE=${ESMFMKFILE:-/home/builder/opt/lib/esmf.mk}
 ## NCEP libraries (need to download and build manually, see doc/README_{UBUNTU,CENTOS,...}.txt and https://github.com/NCAR/NCEPlibs)
 ##
 export NCEPLIBS_DIR=${NCEPLIBS_DIR:-/home/builder/opt}
-export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
\ No newline at end of file
+export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
diff --git a/modulefiles/ufs_linux.intel b/modulefiles/ufs_linux.intel
index 674dd76..6e47862 100644
--- a/modulefiles/ufs_linux.intel
+++ b/modulefiles/ufs_linux.intel
@@ -34,4 +34,4 @@ export ESMFMKFILE=${ESMFMKFILE:-/home/builder/opt/lib/esmf.mk}
 ## NCEP libraries (need to download and build manually, see doc/README_{UBUNTU,CENTOS,...}.txt and https://github.com/NCAR/NCEPlibs)
 ##
 export NCEPLIBS_DIR=${NCEPLIBS_DIR:-/home/builder/opt}
-export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
\ No newline at end of file
+export CMAKE_PREFIX_PATH=${NCEPLIBS_DIR}
diff --git a/modulefiles/ufs_orion.intel.lua b/modulefiles/ufs_orion.intel.lua
index 556e0a5..d6e25ef 100644
--- a/modulefiles/ufs_orion.intel.lua
+++ b/modulefiles/ufs_orion.intel.lua
@@ -26,4 +26,4 @@ setenv("CXX", "mpiicpc")
 setenv("FC", "mpiifort")
 setenv("CMAKE_Platform", "orion.intel")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/ufs_wcoss2.intel.lua b/modulefiles/ufs_wcoss2.intel.lua
index a825af6..983365d 100644
--- a/modulefiles/ufs_wcoss2.intel.lua
+++ b/modulefiles/ufs_wcoss2.intel.lua
@@ -52,4 +52,4 @@ setenv("CXX", "CC")
 setenv("FC", "ftn")
 setenv("CMAKE_Platform", "wcoss2")
 
-whatis("Description: UFS build environment")
\ No newline at end of file
+whatis("Description: UFS build environment")
diff --git a/modulefiles/wcoss_dell_p3 b/modulefiles/wcoss_dell_p3
deleted file mode 100644
index 8ca322d..0000000
--- a/modulefiles/wcoss_dell_p3
+++ /dev/null
@@ -1,34 +0,0 @@
-#%Module######################################################################
-##
-##    NEXUS Prerequisites: Venus and Mars (WCOSS Dell)
-
-proc ModulesHelp {} {
-  puts stderr "\tcit - loads modules required for building and running NEXUS on the Dell side of WCOSS"
-}
-
-module-whatis "loads NEXUS prerequisites on Venus and Mars"
-
-## clean up environment ---------------------------------------------------
-module purge
-
-module load ips/18.0.5.274
-module load impi/18.0.1
-module load lsf/10.1
-
-## load hpc-stack ---------------------------------------------------------
-module use /usrx/local/nceplibs/dev/hpc-stack/libs/hpc-stack/modulefiles/stack
-module load hpc/1.1.0
-module load hpc-ips/18.0.5.274
-module load hpc-impi/18.0.1
-
-## load esmf / netcdf -----------------------------------------------------
-module load hdf5/1.10.6
-module load netcdf/4.7.4
-module load esmf/8_2_0
-
-## cmake environment ------------------------------------------------------
-module load cmake/3.20.0
-setenv CMAKE_C_COMPILER mpiicc
-setenv CMAKE_CXX_COMPILER mpiicpc
-setenv CMAKE_Fortran_COMPILER mpiifort
-setenv CMAKE_Platform wcoss_dell_p3

From b1481f229aaff0e43de2911b72c4ed7b40faf39c Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Thu, 17 Oct 2024 19:49:05 +0000
Subject: [PATCH 05/16] remoe old files

---
 modulefiles/hera.intel  | 30 ------------------------------
 modulefiles/orion.intel | 32 --------------------------------
 2 files changed, 62 deletions(-)
 delete mode 100644 modulefiles/hera.intel
 delete mode 100644 modulefiles/orion.intel

diff --git a/modulefiles/hera.intel b/modulefiles/hera.intel
deleted file mode 100644
index c3dfab4..0000000
--- a/modulefiles/hera.intel
+++ /dev/null
@@ -1,30 +0,0 @@
-#%Module######################################################################
-##
-##    NEXUS Prerequisites: Hera/Intel
-
-proc ModulesHelp {} {
-  puts stderr "\tcit - loads modules required for building and running NEXUS on Hera/Intel"
-}
-
-module-whatis "loads NEXUS prerequisites for Hera/Intel"
-
-## clean up environment ---------------------------------------------------
-module purge
-
-## load hpc-stack
-module use /scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack
-module load hpc/1.1.0
-module load hpc-intel/18.0.5.274
-module load hpc-impi/2018.0.4
-
-## load esmf / netcdf -----------------------------------------------------
-module load hdf5/1.10.6
-module load netcdf/4.7.4
-module load esmf/8_2_0
-
-## cmake environment ------------------------------------------------------
-module load cmake/3.20.1
-setenv CMAKE_C_COMPILER mpiicc
-setenv CMAKE_CXX_COMPILER mpiicpc
-setenv CMAKE_Fortran_COMPILER mpiifort
-setenv CMAKE_Platform hera.intel
diff --git a/modulefiles/orion.intel b/modulefiles/orion.intel
deleted file mode 100644
index 51487c3..0000000
--- a/modulefiles/orion.intel
+++ /dev/null
@@ -1,32 +0,0 @@
-#%Module######################################################################
-##
-##    NEXUS Prerequisites: Orion/Intel
-
-proc ModulesHelp {} {
-  puts stderr "\tcit - loads modules required for building and running NEXUS on Orion/Intel"
-}
-
-module-whatis "loads NEXUS prerequisites for Orion/Intel"
-
-## clean up environment ---------------------------------------------------
-module purge
-
-module load contrib noaatools
-
-## load hpc-stack ---------------------------------------------------------
-module use /apps/contrib/NCEP/libs/hpc-stack/modulefiles/stack
-module load hpc/1.1.0
-module load hpc-intel/2018.4
-module load hpc-impi/2018.4
-
-## load esmf / netcdf -----------------------------------------------------
-module load hdf5/1.10.6
-module load netcdf/4.7.4
-module load esmf/8_2_0
-
-## cmake environment ------------------------------------------------------
-module load cmake/3.18.1
-setenv CMAKE_C_COMPILER mpiicc
-setenv CMAKE_CXX_COMPILER mpiicpc
-setenv CMAKE_Fortran_COMPILER mpiifort
-setenv CMAKE_Platform orion.intel

From 7d4caf91047108342fdadb4009e609ed86835ecf Mon Sep 17 00:00:00 2001
From: bbakernoaa <barry.baker@noaa.gov>
Date: Fri, 18 Oct 2024 01:08:36 +0000
Subject: [PATCH 06/16] remove FC etc

---
 CMakeLists.txt | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0182ac..a4aecc1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,10 +11,6 @@ if(NOT DEFINED ENV{FC})
   message(FATAL_ERROR "CMAKE_Fortran_COMPILER is not defined")
 endif()
 
-set(CMAKE_Fortran_COMPILER $ENV{FC})
-set(CMAKE_C_COMPILER $ENV{CC})
-set(CMAKE_CXX_COMPILER $ENV{CXX})
-
 # Include local macros
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
 

From af46dd68cc5316cc0f58eb402a0055676a10dd2a Mon Sep 17 00:00:00 2001
From: Barry Baker <bbakernoaa@users.noreply.github.com>
Date: Fri, 18 Oct 2024 11:32:26 -0400
Subject: [PATCH 07/16] Update CMakeLists.txt

Co-authored-by: Zachary Moon <zmoon92@gmail.com>
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4aecc1..135f0c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Check environment
 cmake_minimum_required(VERSION 3.5)
 
-# set the project name and version
+# Set the project name and version
 project(NEXUS
         VERSION 0.2.0
         LANGUAGES Fortran)

From c3e6bacad5bb1256b87692e77c7acc32aa389447 Mon Sep 17 00:00:00 2001
From: Barry Baker <bbakernoaa@users.noreply.github.com>
Date: Fri, 18 Oct 2024 11:32:41 -0400
Subject: [PATCH 08/16] Update CMakeLists.txt

Co-authored-by: Zachary Moon <zmoon92@gmail.com>
---
 CMakeLists.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 135f0c1..cf22830 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,9 +6,15 @@ project(NEXUS
         VERSION 0.2.0
         LANGUAGES Fortran)
 
-# set compiler
+# FC should be used to set compiler
 if(NOT DEFINED ENV{FC})
-  message(FATAL_ERROR "CMAKE_Fortran_COMPILER is not defined")
+  message(WARNING "FC is not set. You may want to use it to specify a specific compiler.")
+else()
+  if("$ENV{FC}" STREQUAL "")
+    message(WARNING "FC is set to empty string. You may want to use it to specify a specific compiler.")
+  else()
+    message(STATUS "FC is set: '${FC}'")
+  endif()
 endif()
 
 # Include local macros

From 252aa4317f0945b52ba24b2958b8623592223327 Mon Sep 17 00:00:00 2001
From: Barry Baker <bbakernoaa@users.noreply.github.com>
Date: Fri, 18 Oct 2024 11:38:00 -0400
Subject: [PATCH 09/16] Update ufs_common.lua

---
 modulefiles/ufs_common.lua | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/modulefiles/ufs_common.lua b/modulefiles/ufs_common.lua
index 062fa38..aa6702f 100644
--- a/modulefiles/ufs_common.lua
+++ b/modulefiles/ufs_common.lua
@@ -11,17 +11,6 @@ local ufs_modules = {
   {["netcdf-fortran"]  = "4.6.1"},
   {["parallelio"]      = "2.5.10"},
   {["esmf"]            = "8.6.0"},
-  {["fms"]             = "2024.01"},
-  {["bacio"]           = "2.4.1"},
-  {["crtm"]            = "2.4.0"},
-  {["g2"]              = "3.5.1"},
-  {["g2tmpl"]          = "1.13.0"},
-  {["ip"]              = "4.3.0"},
-  {["sp"]              = "2.5.0"},
-  {["w3emc"]           = "2.10.0"},
-  {["gftl-shared"]     = "1.6.1"},
-  {["mapl"]            = "2.40.3-esmf-8.6.0"},
-  {["scotch"]          = "7.0.4"},
 }
 
 for i = 1, #ufs_modules do

From bafd32da8d1c81e284f02bc0223b9c83baf2a689 Mon Sep 17 00:00:00 2001
From: zmoon <zmoon92@gmail.com>
Date: Thu, 24 Oct 2024 18:11:13 -0500
Subject: [PATCH 10/16] Update readme with UFS module file info

and remove most of the Ubuntu instructions
---
 README.md | 69 +++++++++++--------------------------------------------
 1 file changed, 13 insertions(+), 56 deletions(-)

diff --git a/README.md b/README.md
index 332f87a..d2966ec 100644
--- a/README.md
+++ b/README.md
@@ -23,15 +23,19 @@ pre-commit install --install-hooks
 
 ### Setup
 
-#### NOAA Hera
+#### Supported UFS machines
 
-Use the official setup.
+UFS spack-stack module files are included for Hera, WCOSS2, Orion, etc.
 ```
 module use ./modulefiles
-module load hera.intel
 ```
 
-Input data:
+Then, on Hera, for example:
+```
+module load ufs_hera.intel
+```
+
+Hera input data:
 ```
 /scratch1/NCEPDEV/rstprod/nexus_emissions
 ```
@@ -41,6 +45,7 @@ Input data:
 
 #### GMU Hopper
 
+Custom modules.
 ```
 . /groups/ESS3/zmoon/nexus/env5
 ```
@@ -52,58 +57,10 @@ Input data:
 
 #### Ubuntu
 
-Tested with Ubuntu 22.04.
-Using GCC v12 available via `apt`.
-
-Dependencies:
-```bash
-sudo apt install build-essential gfortran-12 libnetcdf-dev libnetcdff-dev liblapack-dev libopenblas-dev mpi-default-dev mpi-default-bin
-```
-
-Build ESMF and prepare for NEXUS build:
-```bash
-v="8.3.1"  # ESMF
-gcc="12"
-esmf_base=$HOME/esmf
-
-export ESMF_DIR=${esmf_base}/${v}-gcc-${gcc}
-cd $esmf_base
-mkdir -p $ESMF_DIR
-wget https://github.com/esmf-org/esmf/archive/refs/tags/v${v}.tar.gz
-tar xzvf v${v}.tar.gz --directory=/tmp && mv /tmp/esmf-${v}/* $ESMF_DIR
-
-export ESMF_COMPILER=gfortran
-export ESMF_LAPACK=netlib
-export ESMF_COMM=mpi
-export ESMF_PIO=internal
-export ESMF_NETCDF=nc-config
-
-export OMPI_FC=gfortran-${gcc}
-export OMPI_CC=gcc-${gcc}
-export OMPI_CXX=g++-${gcc}
-export ESMF_F90COMPILER=mpifort
-export ESMF_CCOMPILER=mpicc
-export ESMF_CXXCOMPILER=mpic++
-export ESMF_F90LINKER=/usr/bin/ld
-export ESMF_CLINKER=/usr/bin/ld
-export ESMF_CXXLINKER=/usr/bin/ld
-
-cd $ESMF_DIR
-make lib
-
-# Location of the corresponding `esmf.mk` is needed for CMake to find the lib later
-# You can find these with, e.g., `find . -name 'esmf.mk' -exec realpath {} \;`,
-# but it should be the following:
-ESMFMKFILE=${ESMF_DIR}/lib/libO/Linux.gfortran.64.mpi.default/esmf.mk
-
-# For NEXUS
-export CMAKE_Fortran_COMPILER=$ESMF_F90COMPILER
-```
-
-To build NEXUS, at least these env vars should be set:
-- `ESMFMKFILE`
-- `OMPI_FC`
-- `CMAKE_Fortran_COMPILER`
+See https://github.com/zmoon/gha-esmf for examples of how to build ESMF,
+or follow the steps to download and use a pre-built ESMF.
+
+Remember to set `ESMFMKFILE` to point to the `esmf.mk` file of your ESMF build.
 
 ### Build
 

From 6b7c815e940b2f5531bff188559f06b793d5db6b Mon Sep 17 00:00:00 2001
From: zmoon <zmoon92@gmail.com>
Date: Fri, 25 Oct 2024 11:13:17 -0500
Subject: [PATCH 11/16] Set CMake policy 0074

telling it to ignore _ROOT variables
since we have special find scripts for those

on WCOSS2, it was warning about these being set for NetCDF and ESMF
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf22830..164f47c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,9 @@
-# Check environment
 cmake_minimum_required(VERSION 3.5)
 
+if(POLICY CMP0074)
+  cmake_policy(SET CMP0074 OLD)
+endif()
+
 # Set the project name and version
 project(NEXUS
         VERSION 0.2.0

From d1abbadab528f1f88321d1da6bd8f004e9da7704 Mon Sep 17 00:00:00 2001
From: Barry Baker <bbakernoaa@users.noreply.github.com>
Date: Wed, 30 Oct 2024 19:37:26 -0400
Subject: [PATCH 12/16] Update modulefiles/ufs_gaea.intel.lua

Co-authored-by: Zachary Moon <zmoon92@gmail.com>
---
 modulefiles/ufs_gaea.intel.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modulefiles/ufs_gaea.intel.lua b/modulefiles/ufs_gaea.intel.lua
index 8c21dfa..126c7ff 100644
--- a/modulefiles/ufs_gaea.intel.lua
+++ b/modulefiles/ufs_gaea.intel.lua
@@ -7,7 +7,7 @@ whatis([===[Loads libraries needed for building the UFS Weather Model on Gaea ]=
 
 prepend_path("MODULEPATH", "/ncrc/proj/epic/spack-stack/spack-stack-1.6.0/envs/fms-2024.01/install/modulefiles/Core")
 
-stack_intel_ver=os.getenv("stack_intel_ver") or "2023.1.0"
+stack_intel_ver=os.getenv("stack_intel_ver") or "2023.2.0"
 load(pathJoin("stack-intel", stack_intel_ver))
 
 stack_cray_mpich_ver=os.getenv("stack_cray_mpich_ver") or "8.1.25"

From b91b8782de552497a0bdaca66b829ac672426b54 Mon Sep 17 00:00:00 2001
From: Barry Baker <bbakernoaa@users.noreply.github.com>
Date: Wed, 30 Oct 2024 19:37:42 -0400
Subject: [PATCH 13/16] Update modulefiles/ufs_gaea.intel.lua

Co-authored-by: Zachary Moon <zmoon92@gmail.com>
---
 modulefiles/ufs_gaea.intel.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modulefiles/ufs_gaea.intel.lua b/modulefiles/ufs_gaea.intel.lua
index 126c7ff..834c8fc 100644
--- a/modulefiles/ufs_gaea.intel.lua
+++ b/modulefiles/ufs_gaea.intel.lua
@@ -10,7 +10,7 @@ prepend_path("MODULEPATH", "/ncrc/proj/epic/spack-stack/spack-stack-1.6.0/envs/f
 stack_intel_ver=os.getenv("stack_intel_ver") or "2023.2.0"
 load(pathJoin("stack-intel", stack_intel_ver))
 
-stack_cray_mpich_ver=os.getenv("stack_cray_mpich_ver") or "8.1.25"
+stack_cray_mpich_ver=os.getenv("stack_cray_mpich_ver") or "8.1.28"
 load(pathJoin("stack-cray-mpich", stack_cray_mpich_ver))
 
 stack_python_ver=os.getenv("stack_python_ver") or "3.10.13"

From 9be36a7233e91ad358d351664551325b11f6f28c Mon Sep 17 00:00:00 2001
From: Zachary Moon <zmoon92@gmail.com>
Date: Fri, 1 Nov 2024 12:02:55 -0400
Subject: [PATCH 14/16] gha-esmf moved to ARL org

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d2966ec..73debcf 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ Input data:
 
 #### Ubuntu
 
-See https://github.com/zmoon/gha-esmf for examples of how to build ESMF,
+See https://github.com/noaa-oar-arl/gha-esmf for examples of how to build ESMF,
 or follow the steps to download and use a pre-built ESMF.
 
 Remember to set `ESMFMKFILE` to point to the `esmf.mk` file of your ESMF build.

From 08547f8c6d114454326e2d132c6acfd76d1b1092 Mon Sep 17 00:00:00 2001
From: zmoon <zmoon92@gmail.com>
Date: Fri, 1 Nov 2024 11:14:47 -0500
Subject: [PATCH 15/16] Try unsetting WCOSS vars instead

---
 CMakeLists.txt                   | 4 ----
 modulefiles/ufs_wcoss2.intel.lua | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 164f47c..837c034 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,5 @@
 cmake_minimum_required(VERSION 3.5)
 
-if(POLICY CMP0074)
-  cmake_policy(SET CMP0074 OLD)
-endif()
-
 # Set the project name and version
 project(NEXUS
         VERSION 0.2.0
diff --git a/modulefiles/ufs_wcoss2.intel.lua b/modulefiles/ufs_wcoss2.intel.lua
index 983365d..cbd99d0 100644
--- a/modulefiles/ufs_wcoss2.intel.lua
+++ b/modulefiles/ufs_wcoss2.intel.lua
@@ -52,4 +52,8 @@ setenv("CXX", "CC")
 setenv("FC", "ftn")
 setenv("CMAKE_Platform", "wcoss2")
 
+-- Avoid CMake Policy CMP0074 warning when using our Find*.cmake scripts
+unsetenv("NetCDF_ROOT")
+unsetenv("ESMF_ROOT")
+
 whatis("Description: UFS build environment")

From 1d57259d36cd5ae85011463b56aafd1438b0b48b Mon Sep 17 00:00:00 2001
From: zmoon <zachary.moon@noaa.gov>
Date: Fri, 1 Nov 2024 16:48:23 +0000
Subject: [PATCH 16/16] Print `$ENV{FC}`

note it seems CMake compiler discovery modifies this result
from command to full path
---
 CMakeLists.txt | 2 +-
 HEMCO          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 837c034..ba57036 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ else()
   if("$ENV{FC}" STREQUAL "")
     message(WARNING "FC is set to empty string. You may want to use it to specify a specific compiler.")
   else()
-    message(STATUS "FC is set: '${FC}'")
+    message(STATUS "FC is set: '$ENV{FC}'")
   endif()
 endif()
 
diff --git a/HEMCO b/HEMCO
index 4e81881..4a66bae 160000
--- a/HEMCO
+++ b/HEMCO
@@ -1 +1 @@
-Subproject commit 4e818813da35bf76dbcee2da6ecc598b9c89b1a7
+Subproject commit 4a66bae48f33e6dc22cda5ec9d4633192dee2f73