Adding a heap of NOAA packages for UFS. (#25542)

* Adding a heap of NOAA packages for UFS.

Adding the Unified Forecast System (UFS) and all of the packages
it depends on.

* Fixing style tests.

* Removing the package CMAKE_BUILD_TYPE override.

* Removing compiler specs from `cmake_args()`.
This commit is contained in:
Timothy Brown 2021-08-23 10:55:36 -06:00 committed by GitHub
parent 2971a630b8
commit 6e68792ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 853 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bacio(CMakePackage):
"""The bacio ibrary performs binary I/O for the NCEP models, processing
unformatted byte-addressable data records, and transforming the little
endian files and big endian files."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-bacio"
url = "https://github.com/NOAA-EMC/NCEPLIBS-bacio/archive/refs/tags/v2.4.1.tar.gz"
maintainers = ['t-brown']
version('2.4.1', sha256='7b9b6ba0a288f438bfba6a08b6e47f8133f7dba472a74ac56a5454e2260a7200')

View File

@ -0,0 +1,19 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bufr(CMakePackage):
"""The NOAA bufr library contains subroutines, functions and other utilities
that can be used to read (decode) and write (encode) data in BUFR, which
is a WMO standard format for the exchange of meteorological data."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-bufr"
url = "https://github.com/NOAA-EMC/NCEPLIBS-bufr/archive/refs/tags/bufr_v11.5.0.tar.gz"
maintainers = ['t-brown']
version('11.5.0', sha256='d154839e29ef1fe82e58cf20232e9f8a4f0610f0e8b6a394b7ca052e58f97f43')

View File

@ -0,0 +1,20 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Crtm(CMakePackage):
"""The Community Radiative Transfer Model (CRTM) package.
The CRTM is composed of four important modules for gaseous transmittance,
surface emission and reflection, cloud and aerosol absorption and
scattering, and a solver for a radiative transfer."""
homepage = "https://www.jcsda.org/jcsda-project-community-radiative-transfer-model"
url = "https://github.com/NOAA-EMC/EMC_crtm/archive/refs/tags/v2.3.0.tar.gz"
maintainers = ['t-brown']
version('2.3.0', sha256='3e2c87ae5498c33dd98f9ede5c39e33ee7f298c7317b12adeb552e3a572700ce')

View File

@ -0,0 +1,22 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class G2(CMakePackage):
"""Utilities for coding/decoding GRIB2 messages. This library contains
Fortran 90 decoder/encoder routines for GRIB edition 2, as well as
indexing/searching utility routines."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-g2"
url = "https://github.com/NOAA-EMC/NCEPLIBS-g2/archive/refs/tags/v3.4.3.tar.gz"
maintainers = ['t-brown']
version('3.4.3', sha256='679ea99b225f08b168cbf10f4b29f529b5b011232f298a5442ce037ea84de17c')
depends_on('jasper')
depends_on('libpng')

View File

@ -0,0 +1,17 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class G2tmpl(CMakePackage):
"""Utilities for GRIB2 templates."""
homepage = "https://github.com/NOAA-EMC/NCEPLIBS-g2tmpl"
url = "https://github.com/NOAA-EMC/NCEPLIBS-g2tmpl/archive/refs/tags/v1.10.0.tar.gz"
maintainers = ['t-brown']
version('1.10.0', sha256='dcc0e40b8952f91d518c59df7af64e099131c17d85d910075bfa474c8822649d')

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Gfsio(CMakePackage):
"""The GFSIO library provides an API to convert GFS Gaussian output into
grib output."""
homepage = "https://github.com/NOAA-EMC/NCEPLIBS-gfsio"
url = "https://github.com/NOAA-EMC/NCEPLIBS-gfsio/archive/refs/tags/v1.4.1.tar.gz"
maintainers = ['t-brown']
version('1.4.1', sha256='eab106302f520600decc4f9665d7c6a55e7b4901fab6d9ef40f29702b89b69b1')

View File

@ -0,0 +1,21 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ip(CMakePackage):
"""The NCEP general interpolation library (iplib) contains Fortran 90
subprograms to be used for interpolating between nearly all grids used at
NCEP."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-ip"
url = "https://github.com/NOAA-EMC/NCEPLIBS-ip/archive/refs/tags/v3.3.3.tar.gz"
maintainers = ['t-brown']
version('3.3.3', sha256='d5a569ca7c8225a3ade64ef5cd68f3319bcd11f6f86eb3dba901d93842eb3633')
depends_on('sp')

View File

@ -0,0 +1,21 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ip2(CMakePackage):
"""The NCEP general interpolation library 2 (ip2lib) contains Fortran 90
subprograms to be used for interpolating between nearly all grids used at
NCEP."""
homepage = "https://github.com/NOAA-EMC/NCEPLIBS-ip2"
url = "https://github.com/NOAA-EMC/NCEPLIBS-ip2/archive/refs/tags/v1.1.2.tar.gz"
maintainers = ['t-brown']
version('1.1.2', sha256='73c6beec8fd463ec7ccba3633d8c5d53d385c43d507367efde918c2db0af42ab')
depends_on('sp')

View File

@ -0,0 +1,350 @@
--- a/CMakeModules/Modules/FindNetCDF.cmake 2021-07-26 07:16:22.760999830 -0600
+++ b/CMakeModules/Modules/FindNetCDF.cmake 2021-05-21 09:22:26.000000000 -0600
@@ -0,0 +1,347 @@
+# (C) Copyright 2011- ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+# Try to find NetCDF includes and library.
+# Supports static and shared libaries and allows each component to be found in sepearte prefixes.
+#
+# This module defines
+#
+# - NetCDF_FOUND - System has NetCDF
+# - NetCDF_INCLUDE_DIRS - the NetCDF include directories
+# - NetCDF_VERSION - the version of NetCDF
+# - NetCDF_CONFIG_EXECUTABLE - the netcdf-config executable if found
+# - NetCDF_PARALLEL - Boolean True if NetCDF4 has parallel IO support via hdf5 and/or pnetcdf
+# - NetCDF_HAS_PNETCDF - Boolean True if NetCDF4 has pnetcdf support
+#
+# Deprecated Defines
+# - NetCDF_LIBRARIES - [Deprecated] Use NetCDF::NetCDF_<LANG> targets instead.
+#
+#
+# Following components are available:
+#
+# - C - C interface to NetCDF (netcdf)
+# - CXX - CXX4 interface to NetCDF (netcdf_c++4)
+# - Fortran - Fortran interface to NetCDF (netcdff)
+#
+# For each component the following are defined:
+#
+# - NetCDF_<comp>_FOUND - whether the component is found
+# - NetCDF_<comp>_LIBRARIES - the libraries for the component
+# - NetCDF_<comp>_LIBRARY_SHARED - Boolean is true if libraries for component are shared
+# - NetCDF_<comp>_INCLUDE_DIRS - the include directories for specified component
+# - NetCDF::NetCDF_<comp> - target of component to be used with target_link_libraries()
+#
+# The following paths will be searched in order if set in CMake (first priority) or environment (second priority)
+#
+# - NetCDF_ROOT - root of NetCDF installation
+# - NetCDF_PATH - root of NetCDF installation
+#
+# The search process begins with locating NetCDF Include headers. If these are in a non-standard location,
+# set one of the following CMake or environment variables to point to the location:
+#
+# - NetCDF_INCLUDE_DIR or NetCDF_${comp}_INCLUDE_DIR
+# - NetCDF_INCLUDE_DIRS or NetCDF_${comp}_INCLUDE_DIR
+#
+# Notes:
+#
+# - Use "NetCDF::NetCDF_<LANG>" targets only. NetCDF_LIBRARIES exists for backwards compatibility and should not be used.
+# - These targets have all the knowledge of include directories and library search directories, and a single
+# call to target_link_libraries will provide all these transitive properties to your target. Normally all that is
+# needed to build and link against NetCDF is, e.g.:
+# target_link_libraries(my_c_tgt PUBLIC NetCDF::NetCDF_C)
+# - "NetCDF" is always the preferred naming for this package, its targets, variables, and environment variables
+# - For compatibility, some variables are also set/checked using alternate names NetCDF4, NETCDF, or NETCDF4
+# - Environments relying on these older environment variable names should move to using a "NetCDF_ROOT" environment variable
+# - Preferred component capitalization follows the CMake LANGUAGES variables: i.e., C, Fortran, CXX
+# - For compatibility, alternate capitalizations are supported but should not be used.
+# - If no components are defined, all components will be searched
+#
+
+list( APPEND _possible_components C CXX Fortran )
+
+## Include names for each component
+set( NetCDF_C_INCLUDE_NAME netcdf.h )
+set( NetCDF_CXX_INCLUDE_NAME netcdf )
+set( NetCDF_Fortran_INCLUDE_NAME netcdf.mod )
+
+## Library names for each component
+set( NetCDF_C_LIBRARY_NAME netcdf )
+set( NetCDF_CXX_LIBRARY_NAME netcdf_c++4 )
+set( NetCDF_Fortran_LIBRARY_NAME netcdff )
+
+## Enumerate search components
+foreach( _comp ${_possible_components} )
+ string( TOUPPER "${_comp}" _COMP )
+ set( _arg_${_COMP} ${_comp} )
+ set( _name_${_COMP} ${_comp} )
+endforeach()
+
+set( _search_components C)
+foreach( _comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS} )
+ string( TOUPPER "${_comp}" _COMP )
+ set( _arg_${_COMP} ${_comp} )
+ list( APPEND _search_components ${_name_${_COMP}} )
+ if( NOT _name_${_COMP} )
+ message(SEND_ERROR "Find${CMAKE_FIND_PACKAGE_NAME}: COMPONENT ${_comp} is not a valid component. Valid components: ${_possible_components}" )
+ endif()
+endforeach()
+list( REMOVE_DUPLICATES _search_components )
+
+## Search hints for finding include directories and libraries
+foreach( _comp IN ITEMS "_" "_C_" "_Fortran_" "_CXX_" )
+ foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF )
+ foreach( _var IN ITEMS ROOT PATH )
+ list(APPEND _search_hints ${${_name}${_comp}${_var}} $ENV{${_name}${_comp}${_var}} )
+ list(APPEND _include_search_hints
+ ${${_name}${_comp}INCLUDE_DIR} $ENV{${_name}${_comp}INCLUDE_DIR}
+ ${${_name}${_comp}INCLUDE_DIRS} $ENV{${_name}${_comp}INCLUDE_DIRS} )
+ endforeach()
+ endforeach()
+endforeach()
+#Old-school HPC module env variable names
+foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF )
+ foreach( _comp IN ITEMS "_C" "_Fortran" "_CXX" )
+ list(APPEND _search_hints ${${_name}} $ENV{${_name}})
+ list(APPEND _search_hints ${${_name}${_comp}} $ENV{${_name}${_comp}})
+ endforeach()
+endforeach()
+
+## Find headers for each component
+set(NetCDF_INCLUDE_DIRS)
+set(_new_search_components)
+foreach( _comp IN LISTS _search_components )
+ if(NOT ${PROJECT_NAME}_NetCDF_${_comp}_FOUND)
+ list(APPEND _new_search_components ${_comp})
+ endif()
+ find_file(NetCDF_${_comp}_INCLUDE_FILE
+ NAMES ${NetCDF_${_comp}_INCLUDE_NAME}
+ DOC "NetCDF ${_comp} include directory"
+ HINTS ${_include_search_hints} ${_search_hints}
+ PATH_SUFFIXES include include/netcdf
+ )
+ mark_as_advanced(NetCDF_${_comp}_INCLUDE_FILE)
+ message(DEBUG "NetCDF_${_comp}_INCLUDE_FILE: ${NetCDF_${_comp}_INCLUDE_FILE}")
+ if( NetCDF_${_comp}_INCLUDE_FILE )
+ get_filename_component(NetCDF_${_comp}_INCLUDE_FILE ${NetCDF_${_comp}_INCLUDE_FILE} ABSOLUTE)
+ get_filename_component(NetCDF_${_comp}_INCLUDE_DIR ${NetCDF_${_comp}_INCLUDE_FILE} DIRECTORY)
+ list(APPEND NetCDF_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR})
+ endif()
+endforeach()
+if(NetCDF_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES NetCDF_INCLUDE_DIRS)
+endif()
+set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIRS}" CACHE STRING "NetCDF Include directory paths" FORCE)
+
+## Find n*-config executables for search components
+foreach( _comp IN LISTS _search_components )
+ if( _comp MATCHES "^(C)$" )
+ set(_conf "c")
+ elseif( _comp MATCHES "^(Fortran)$" )
+ set(_conf "f")
+ elseif( _comp MATCHES "^(CXX)$" )
+ set(_conf "cxx4")
+ endif()
+ find_program( NetCDF_${_comp}_CONFIG_EXECUTABLE
+ NAMES n${_conf}-config
+ HINTS ${NetCDF_INCLUDE_DIRS} ${_include_search_hints} ${_search_hints}
+ PATH_SUFFIXES bin Bin ../bin ../../bin
+ DOC "NetCDF n${_conf}-config helper" )
+ message(DEBUG "NetCDF_${_comp}_CONFIG_EXECUTABLE: ${NetCDF_${_comp}_CONFIG_EXECUTABLE}")
+endforeach()
+
+set(_C_libs_flag --libs)
+set(_Fortran_libs_flag --flibs)
+set(_CXX_libs_flag --libs)
+set(_C_includes_flag --includedir)
+set(_Fortran_includes_flag --includedir)
+set(_CXX_includes_flag --includedir)
+function(netcdf_config exec flag output_var)
+ set(${output_var} False PARENT_SCOPE)
+ if( exec )
+ execute_process( COMMAND ${exec} ${flag} RESULT_VARIABLE _ret OUTPUT_VARIABLE _val)
+ if( _ret EQUAL 0 )
+ string( STRIP ${_val} _val )
+ set( ${output_var} ${_val} PARENT_SCOPE )
+ endif()
+ endif()
+endfunction()
+
+## Detect additional package properties
+netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel4 _val)
+if( NOT _val MATCHES "^(yes|no)$" )
+ netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel _val)
+endif()
+if( _val MATCHES "^(yes)$" )
+ set(NetCDF_PARALLEL TRUE CACHE STRING "NetCDF has parallel IO capability via pnetcdf or hdf5." FORCE)
+else()
+ set(NetCDF_PARALLEL FALSE CACHE STRING "NetCDF has no parallel IO capability." FORCE)
+endif()
+
+if(NetCDF_PARALLEL)
+ find_package(MPI REQUIRED)
+endif()
+
+## Find libraries for each component
+set( NetCDF_LIBRARIES )
+foreach( _comp IN LISTS _search_components )
+ string( TOUPPER "${_comp}" _COMP )
+
+ find_library( NetCDF_${_comp}_LIBRARY
+ NAMES ${NetCDF_${_comp}_LIBRARY_NAME}
+ DOC "NetCDF ${_comp} library"
+ HINTS ${NetCDF_${_comp}_INCLUDE_DIRS} ${_search_hints}
+ PATH_SUFFIXES lib64 lib ../lib64 ../lib ../../lib64 ../../lib )
+ mark_as_advanced( NetCDF_${_comp}_LIBRARY )
+ get_filename_component(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} ABSOLUTE)
+ set(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} CACHE STRING "NetCDF ${_comp} library" FORCE)
+ message(DEBUG "NetCDF_${_comp}_LIBRARY: ${NetCDF_${_comp}_LIBRARY}")
+
+ if( NetCDF_${_comp}_LIBRARY )
+ if( NetCDF_${_comp}_LIBRARY MATCHES ".a$" )
+ set( NetCDF_${_comp}_LIBRARY_SHARED FALSE )
+ set( _library_type STATIC)
+ else()
+ list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARY} )
+ set( NetCDF_${_comp}_LIBRARY_SHARED TRUE )
+ set( _library_type SHARED)
+ endif()
+ endif()
+
+ #Use nc-config to set per-component LIBRARIES variable if possible
+ netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_libs_flag} _val )
+ if( _val )
+ set( NetCDF_${_comp}_LIBRARIES ${_val} )
+ if(NOT NetCDF_${_comp}_LIBRARY_SHARED AND NOT NetCDF_${_comp}_FOUND) #Static targets should use nc_config to get a proper link line with all necessary static targets.
+ list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} )
+ endif()
+ else()
+ set( NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARY} )
+ if(NOT NetCDF_${_comp}_LIBRARY_SHARED)
+ message(SEND_ERROR "Unable to properly find NetCDF. Found static libraries at: ${NetCDF_${_comp}_LIBRARY} but could not run nc-config: ${NetCDF_CONFIG_EXECUTABLE}")
+ endif()
+ endif()
+
+ #Use nc-config to set per-component INCLUDE_DIRS variable if possible
+ netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_includes_flag} _val )
+ if( _val )
+ string( REPLACE " " ";" _val ${_val} )
+ set( NetCDF_${_comp}_INCLUDE_DIRS ${_val} )
+ else()
+ set( NetCDF_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} )
+ endif()
+
+ if( NetCDF_${_comp}_LIBRARIES AND NetCDF_${_comp}_INCLUDE_DIRS )
+ set( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND TRUE )
+ if (NOT TARGET NetCDF::NetCDF_${_comp})
+ add_library(NetCDF::NetCDF_${_comp} ${_library_type} IMPORTED)
+ set_target_properties(NetCDF::NetCDF_${_comp} PROPERTIES
+ IMPORTED_LOCATION ${NetCDF_${_comp}_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_${_comp}_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} )
+ if( NOT _comp MATCHES "^(C)$" )
+ target_link_libraries(NetCDF::NetCDF_${_comp} INTERFACE NetCDF::NetCDF_C)
+ endif()
+ if(MPI_${_comp}_FOUND)
+ target_link_libraries(NetCDF::NetCDF_${_comp} INTERFACE MPI::MPI_${_comp})
+ endif()
+ endif()
+ endif()
+endforeach()
+if(NetCDF_LIBRARIES AND NetCDF_${_comp}_LIBRARY_SHARED)
+ list(REMOVE_DUPLICATES NetCDF_LIBRARIES)
+endif()
+set(NetCDF_LIBRARIES "${NetCDF_LIBRARIES}" CACHE STRING "NetCDF library targets" FORCE)
+
+## Find version via netcdf-config if possible
+if (NetCDF_INCLUDE_DIRS)
+ if( NetCDF_C_CONFIG_EXECUTABLE )
+ netcdf_config( ${NetCDF_C_CONFIG_EXECUTABLE} --version _vers )
+ if( _vers )
+ string(REGEX REPLACE ".* ((([0-9]+)\\.)+([0-9]+)).*" "\\1" NetCDF_VERSION "${_vers}" )
+ endif()
+ else()
+ foreach( _dir IN LISTS NetCDF_INCLUDE_DIRS)
+ if( EXISTS "${_dir}/netcdf_meta.h" )
+ file(STRINGS "${_dir}/netcdf_meta.h" _netcdf_version_lines
+ REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)")
+ string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}")
+ string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}")
+ string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}")
+ string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}")
+ set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}")
+ unset(_netcdf_version_major)
+ unset(_netcdf_version_minor)
+ unset(_netcdf_version_patch)
+ unset(_netcdf_version_note)
+ unset(_netcdf_version_lines)
+ endif()
+ endforeach()
+ endif()
+endif ()
+
+## Finalize find_package
+include(FindPackageHandleStandardArgs)
+
+if(NOT NetCDF_FOUND OR _new_search_components)
+ find_package_handle_standard_args( ${CMAKE_FIND_PACKAGE_NAME}
+ REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES
+ VERSION_VAR NetCDF_VERSION
+ HANDLE_COMPONENTS )
+endif()
+
+foreach( _comp IN LISTS _search_components )
+ if( NetCDF_${_comp}_FOUND )
+ #Record found components to avoid duplication in NetCDF_LIBRARIES for static libraries
+ set(NetCDF_${_comp}_FOUND ${NetCDF_${_comp}_FOUND} CACHE BOOL "NetCDF ${_comp} Found" FORCE)
+ #Set a per-package, per-component found variable to communicate between multiple calls to find_package()
+ set(${PROJECT_NAME}_NetCDF_${_comp}_FOUND True)
+ endif()
+endforeach()
+
+if( ${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY AND _new_search_components)
+ message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME} defines targets:" )
+ message( STATUS " - NetCDF_VERSION [${NetCDF_VERSION}]")
+ message( STATUS " - NetCDF_PARALLEL [${NetCDF_PARALLEL}]")
+ foreach( _comp IN LISTS _new_search_components )
+ string( TOUPPER "${_comp}" _COMP )
+ message( STATUS " - NetCDF_${_comp}_CONFIG_EXECUTABLE [${NetCDF_${_comp}_CONFIG_EXECUTABLE}]")
+ if( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND )
+ get_filename_component(_root ${NetCDF_${_comp}_INCLUDE_DIR}/.. ABSOLUTE)
+ if( NetCDF_${_comp}_LIBRARY_SHARED )
+ message( STATUS " - NetCDF::NetCDF_${_comp} [SHARED] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ")
+ else()
+ message( STATUS " - NetCDF::NetCDF_${_comp} [STATIC] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ")
+ endif()
+ endif()
+ endforeach()
+endif()
+
+foreach( _prefix NetCDF NetCDF4 NETCDF NETCDF4 ${CMAKE_FIND_PACKAGE_NAME} )
+ set( ${_prefix}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} )
+ set( ${_prefix}_LIBRARIES ${NetCDF_LIBRARIES})
+ set( ${_prefix}_VERSION ${NetCDF_VERSION} )
+ set( ${_prefix}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND} )
+ set( ${_prefix}_CONFIG_EXECUTABLE ${NetCDF_CONFIG_EXECUTABLE} )
+ set( ${_prefix}_PARALLEL ${NetCDF_PARALLEL} )
+
+ foreach( _comp ${_search_components} )
+ string( TOUPPER "${_comp}" _COMP )
+ set( _arg_comp ${_arg_${_COMP}} )
+ set( ${_prefix}_${_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} )
+ set( ${_prefix}_${_COMP}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} )
+ set( ${_prefix}_${_arg_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} )
+
+ set( ${_prefix}_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} )
+ set( ${_prefix}_${_COMP}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} )
+ set( ${_prefix}_${_arg_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} )
+
+ set( ${_prefix}_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} )
+ set( ${_prefix}_${_COMP}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} )
+ set( ${_prefix}_${_arg_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} )
+ endforeach()
+endforeach()

View File

@ -0,0 +1,49 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class NcepPost(CMakePackage):
"""The NCEP Post Processor is a software package designed
to generate useful products from raw model output."""
homepage = "https://github.com/NOAA-EMC/EMC_post"
url = "https://github.com/NOAA-EMC/EMC_post/archive/refs/tags/upp_v10.0.8.tar.gz"
maintainers = ['t-brown']
version('10.0.8', sha256='b3b27d03250450159a8261c499d57168bdd833790c1c80c854d081fe37aaab47')
variant('wrf-io', default=True, description='Enable WRF I/O.')
depends_on('bacio')
depends_on('crtm')
depends_on('g2')
depends_on('g2tmpl')
depends_on('gfsio')
depends_on('ip')
depends_on('jasper')
depends_on('libpng')
depends_on('mpi')
depends_on('netcdf-c')
depends_on('netcdf-fortran')
depends_on('nemsio')
depends_on('sfcio')
depends_on('sigio')
depends_on('sp')
depends_on('w3emc')
depends_on('w3nco')
depends_on('w3nco')
depends_on('wrf-io', when='+wrf-io')
depends_on('zlib')
patch('cmake_findnetcdf.patch')
def cmake_args(self):
args = []
if '+wrf-io' in self.spec:
args.append('-DBUILD_WITH_WRFIO:BOOL=ON')
return args

View File

@ -0,0 +1,23 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Nemsio(CMakePackage):
"""The NOAA Environmental Modeling System I/O (NEMSIO) library. The
basic functions it provides are to read and write data sets for all the
NEMS applications."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-nemsio"
url = "https://github.com/NOAA-EMC/NCEPLIBS-nemsio/archive/refs/tags/v2.5.2.tar.gz"
maintainers = ['t-brown']
version('2.5.2', sha256='c59e9379969690de8d030cbf4bbbbe3726faf13c304f3b88b0f6aec1496d2c08')
depends_on('bacio')
depends_on('mpi')
depends_on('w3nco')

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sfcio(CMakePackage):
"""The SFCIO library provides an API to read the NCEP Spectral model surface
files."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-sfcio"
url = "https://github.com/NOAA-EMC/NCEPLIBS-sfcio/archive/refs/tags/v1.4.1.tar.gz"
maintainers = ['t-brown']
version('1.4.1', sha256='d9f900cf18ec1a839b4128c069b1336317ffc682086283443354896746b89c59')

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sigio(CMakePackage):
"""The SIGIO library provides an Application Program Interface for performing
I/O on the sigma restart file of the global spectral model."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-sigio"
url = "https://github.com/NOAA-EMC/NCEPLIBS-sigio/archive/refs/tags/v2.3.2.tar.gz"
maintainers = ['t-brown']
version('2.3.2', sha256='333f3cf3a97f97103cbafcafc2ad89b24faa55b1332a98adc1637855e8a5b613')

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sp(CMakePackage):
"""The spectral transform library splib contains FORTRAN subprograms to be
used for a variety of spectral transform functions."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-sp"
url = "https://github.com/NOAA-EMC/NCEPLIBS-sp/archive/refs/tags/v2.3.3.tar.gz"
maintainers = ['t-brown']
version('2.3.3', sha256='c0d465209e599de3c0193e65671e290e9f422f659f1da928505489a3edeab99f')

View File

@ -0,0 +1,39 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class UfsUtils(CMakePackage):
"""The UFS Utilities package contains programs set up the model grid and
create coldstart initial conditions.
"""
homepage = "https://noaa-emcufs-utils.readthedocs.io/en/latest/"
url = "https://github.com/NOAA-EMC/UFS_UTILS/archive/refs/tags/ufs_utils_1_6_0.tar.gz"
maintainers = ['t-brown']
version('1_6_0', sha256='829ba4b50162e4202f96ec92a65b9fa824f71db65d2b63b70822db07d061cd92')
depends_on('bacio')
depends_on('esmf')
depends_on('g2')
depends_on('hdf5')
depends_on('ip')
depends_on('jasper')
depends_on('libpng')
depends_on('nemsio')
depends_on('netcdf-c')
depends_on('netcdf-fortran')
depends_on('sfcio')
depends_on('sigio')
depends_on('sp')
depends_on('w3nco')
depends_on('wgrib2')
depends_on('zlib')
def setup_build_environment(self, env):
env.set('ESMFMKFILE', join_path(self.spec['esmf'].prefix.lib, 'esmf.mk'))

View File

@ -0,0 +1,94 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class UfsWeatherModel(CMakePackage):
"""The Unified Forecast System (UFS) Weather Model (WM) is a prognostic
model that can be used for short- and medium-range research and
operational forecasts, as exemplified by its use in the operational Global
Forecast System (GFS) of the National Oceanic and Atmospheric
Administration (NOAA)."""
homepage = "https://ufs-weather-model.readthedocs.io/en/latest/"
url = "https://github.com/ufs-community/ufs-weather-model/archive/refs/tags/ufs-v1.1.0.tar.gz"
git = "https://github.com/ufs-community/ufs-weather-model.git"
maintainers = ['t-brown']
version('2.0.0', tag='ufs-v2.0.0', submodules=True)
version('1.1.0', tag='ufs-v1.1.0', submodules=True)
variant('32bit', default=True, description='Enable 32-bit single precision arithmetic in dycore')
variant('avx2', default=False, description='Enable AVX2 instructions')
variant('ccpp', default=True, description='Enable the Common Community Physics Package (CCPP))')
variant('ccpp_suites', default='FV3_GFS_v15p2,FV3_RRFS_v1alpha',
description='CCPP suites to compile',
values=('FV3_GFS_v15p2',
'FV3_RRFS_v1alpha',
'FV3_GFS_v15p2,FV3_RRFS_v1alpha'),
multi=True)
variant('inline_post', default=False, description='Compile post processing inline')
variant('multi_gases', default=False, description='Enable multi gases in physics routines')
variant('openmp', default=True, description='Enable OpenMP')
variant('parallel_netcdf', default=True, description='Enable parallel I/O in netCDF')
variant('quad_precision', default=False,
description='Enable quad precision for certain grid metric terms in dycore')
variant('simdmultiarch', default=False, description='Enable multi-target SIMD instruction sets')
depends_on('bacio')
depends_on('esmf@:8.0.0')
depends_on('mpi')
depends_on('nemsio')
depends_on('netcdf-c')
depends_on('netcdf-fortran')
depends_on('sp')
depends_on('w3emc')
depends_on('w3nco')
def setup_build_environment(self, env):
spec = self.spec
env.set('CMAKE_C_COMPILER', spec['mpi'].mpicc)
env.set('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx)
env.set('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc)
env.set('ESMFMKFILE', join_path(spec['esmf'].prefix.lib, 'esmf.mk'))
env.set('CCPP_SUITES', ','.join(
[x for x in spec.variants['ccpp_suites'].value if x]))
if spec.platform == 'linux' and spec.satisfies('%intel'):
env.set('CMAKE_Platform', 'linux.intel')
elif spec.platform == 'linux' and spec.satisfies('%gcc'):
env.set('CMAKE_Platform', 'linux.gnu')
elif spec.platform == 'darwin' and spec.satisfies('%gcc'):
env.set('CMAKE_Platform', 'macosx.gnu')
else:
msg = "The host system {0} and compiler {0} "
msg += "are not supported by UFS."
raise InstallError(msg.format(spec.platform, self.compiler.name))
def cmake_args(self):
from_variant = self.define_from_variant
args = [from_variant('32BIT', '32bit'),
from_variant('AVX2', 'avx2'),
from_variant('CCPP', 'ccpp'),
from_variant('INLINE_POST', 'inline_post'),
from_variant('MULTI_GASES', 'multi_gases'),
from_variant('OPENMP', 'openmp'),
from_variant('PARALLEL_NETCDF', 'parallel_netcdf'),
from_variant('QUAD_PRECISION', 'quad_precision'),
from_variant('SIMDMULTIARCH', 'simdmultiarch'),
]
return args
@run_after('install')
def install_additional_files(self):
mkdirp(prefix.bin)
ufs_src = join_path(self.build_directory, 'NEMS.exe')
ufs_dst = join_path(prefix.bin, "ufs_weather_model")
install(ufs_src, ufs_dst)
set_executable(ufs_dst)

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class W3emc(CMakePackage):
"""This library contains Fortran 90 decoder/encoder routines for GRIB
edition 1 with EMC changes."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-w3emc/"
url = "https://github.com/NOAA-EMC/NCEPLIBS-w3emc/archive/refs/tags/v2.9.0.tar.gz"
maintainers = ['t-brown']
version('2.9.0', sha256='994f59635ab91e34e96cab5fbaf8de54389d09461c7bac33b3104a1187e6c98a')

View File

@ -0,0 +1,18 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class W3nco(CMakePackage):
"""This library contains Fortran 90 decoder/encoder routines for GRIB
edition 1 with NCO changes."""
homepage = "https://noaa-emc.github.io/NCEPLIBS/NCEPLIBS-w3nco/"
url = "https://github.com/NOAA-EMC/NCEPLIBS-w3nco/archive/refs/tags/v2.4.1.tar.gz"
maintainers = ['t-brown']
version('2.4.1', sha256='48b06e0ea21d3d0fd5d5c4e7eb50b081402567c1bff6c4abf4fd4f3669070139')

View File

@ -0,0 +1,29 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Wgrib2(CMakePackage):
"""The wgrib2 package functionality for interacting with, reading,
writing, and manipulating GRIB2 files."""
homepage = "https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2"
url = "https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/archive/refs/tags/v2.0.8-cmake-v6.tar.gz"
maintainers = ['t-brown']
version('2.0.8-cmake-v6', sha256='745cd008b4ce0245ea44247733e57e2b9ec6c5205d171d457e18d0ff8f87172d')
depends_on('ip2')
depends_on('jasper')
depends_on('libpng')
depends_on('netcdf-c')
depends_on('netcdf-fortran')
depends_on('sp')
def cmake_args(self):
args = ['-DUSE_IPOLATES=3', '-DUSE_SPECTRAL=BOOL:ON']
return args

View File

@ -0,0 +1,22 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class WrfIo(CMakePackage):
"""The WRFIO package is a lightweight WRF-IO API library for Unified
Post Processor (UPP). It reads wrf forecasts (WRF state plus
diagnostics)."""
homepage = "https://noaa-emc.github.io/NCEPLIBS-wrf_io"
url = "https://github.com/NOAA-EMC/NCEPLIBS-wrf_io/archive/refs/tags/v1.2.0.tar.gz"
maintainers = ['t-brown']
version('1.2.0', sha256='000cf5294a2c68460085258186e1f36c86d3d0d9c433aa969a0f92736b745617')
depends_on('netcdf-c')
depends_on('netcdf-fortran')