summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorDom Heinzeller <dom.heinzeller@icloud.com>2023-01-17 01:47:14 -0700
committerGitHub <noreply@github.com>2023-01-17 09:47:14 +0100
commit9e845635ce4945f770e97418d006505ebbc865cf (patch)
treec1fd7f14e3dcdaefa3bff1ca5a2bf0118204df3d /var
parent184a75ec5467dd038539744de1ad6e08ec83f1d1 (diff)
downloadspack-9e845635ce4945f770e97418d006505ebbc865cf.tar.gz
spack-9e845635ce4945f770e97418d006505ebbc865cf.tar.bz2
spack-9e845635ce4945f770e97418d006505ebbc865cf.tar.xz
spack-9e845635ce4945f770e97418d006505ebbc865cf.zip
crtm: overhaul package, add crtm-fix (#34715)
Update crtm from JCSDA-EMC spack fork, add crtm-fix
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/crtm-fix/package.py81
-rw-r--r--var/spack/repos/builtin/packages/crtm/package.py46
2 files changed, 125 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/crtm-fix/package.py b/var/spack/repos/builtin/packages/crtm-fix/package.py
new file mode 100644
index 0000000000..48411ec5a2
--- /dev/null
+++ b/var/spack/repos/builtin/packages/crtm-fix/package.py
@@ -0,0 +1,81 @@
+# Copyright 2013-2022 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)
+
+import os
+
+from spack.package import *
+
+
+class CrtmFix(Package):
+ """CRTM coefficient files"""
+
+ homepage = "https://github.com/NOAA-EMC/crtm"
+ url = "ftp://ftp.ssec.wisc.edu/pub/s4/CRTM/fix_REL-2.3.0_emc.tgz"
+
+ maintainers = [
+ "BenjaminTJohnson",
+ "edwardhartnett",
+ "AlexanderRichert-NOAA",
+ "Hang-Lei-NOAA",
+ "climbfuji",
+ ]
+
+ version("2.4.0_emc", sha256="88d659ae5bc4434f7fafa232ff65b4c48442d2d1a25f8fc96078094fa572ac1a")
+ version("2.3.0_emc", sha256="1452af2d1d11d57ef3c57b6b861646541e7042a9b0f3c230f9a82854d7e90924")
+
+ variant("big_endian", default=True, description="Install big_endian fix files")
+ variant("little_endian", default=False, description="Install little endian fix files")
+ variant("netcdf", default=True, description="Install netcdf fix files")
+
+ conflicts("+big_endian", when="+little_endian", msg="big_endian and little_endian conflict")
+
+ def url_for_version(self, version):
+ url = "ftp://ftp.ssec.wisc.edu/pub/s4/CRTM/fix_REL-{}.tgz"
+ return url.format(version)
+
+ def install(self, spec, prefix):
+ spec = self.spec
+ mkdir(self.prefix.fix)
+
+ endian_dirs = []
+ if "+big_endian" in spec:
+ endian_dirs.append("Big_Endian")
+ elif "+little_endian" in spec:
+ endian_dirs.append("Little_Endian")
+
+ if "+netcdf" in spec:
+ endian_dirs.extend(["netcdf", "netCDF"])
+
+ fix_files = []
+ for d in endian_dirs:
+ fix_files = fix_files + find(".", "*/{}/*".format(d))
+
+ # Big_Endian amsua_metop-c.SpcCoeff.bin is incorrect
+ # Little_Endian amsua_metop-c_v2.SpcCoeff.bin is what it's supposed to be.
+ # Remove the incorrect file, and install it as noACC,, then install
+ # correct file under new name.
+ if "+big_endian" in spec and spec.version == Version("2.4.0_emc"):
+ remove_path = join_path(
+ os.getcwd(), "fix", "SpcCoeff", "Big_Endian", "amsua_metop-c.SpcCoeff.bin"
+ )
+ fix_files.remove(remove_path)
+
+ # This file is incorrect, install it as a different name.
+ install(
+ join_path("fix", "SpcCoeff", "Big_Endian", "amsua_metop-c.SpcCoeff.bin"),
+ join_path(self.prefix.fix, "amsua_metop-c.SpcCoeff.noACC.bin"),
+ )
+
+ # This "Little_Endian" file is actually the correct one.
+ install(
+ join_path("fix", "SpcCoeff", "Little_Endian", "amsua_metop-c_v2.SpcCoeff.bin"),
+ join_path(self.prefix.fix, "amsua_metop-c.SpcCoeff.bin"),
+ )
+
+ for f in fix_files:
+ install(f, self.prefix.fix)
+
+ def setup_run_environment(self, env):
+ env.set("CRTM_FIX", self.prefix.fix)
diff --git a/var/spack/repos/builtin/packages/crtm/package.py b/var/spack/repos/builtin/packages/crtm/package.py
index 7c36edb40e..3bafb0f081 100644
--- a/var/spack/repos/builtin/packages/crtm/package.py
+++ b/var/spack/repos/builtin/packages/crtm/package.py
@@ -13,13 +13,55 @@ class Crtm(CMakePackage):
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"
+ git = "https://github.com/JCSDA/crtm.git"
+ url = "https://github.com/JCSDA/crtm/archive/refs/tags/v2.3.0.tar.gz"
maintainers = [
+ "BenjaminTJohnson",
"t-brown",
"edwardhartnett",
"AlexanderRichert-NOAA",
"Hang-Lei-NOAA",
+ "climbfuji",
]
- version("2.3.0", sha256="3e2c87ae5498c33dd98f9ede5c39e33ee7f298c7317b12adeb552e3a572700ce")
+ variant(
+ "fix",
+ default=False,
+ description='Download CRTM coeffecient or "fix" files (several GBs).',
+ )
+ variant(
+ "build_type",
+ default="RelWithDebInfo",
+ description="CMake build type",
+ values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
+ )
+
+ depends_on("cmake@3.15:")
+ depends_on("git-lfs")
+ depends_on("netcdf-fortran", when="@2.4.0:")
+ depends_on("netcdf-fortran", when="@v2.3-jedi.4")
+ depends_on("netcdf-fortran", when="@v2.4-jedi.1")
+ depends_on("netcdf-fortran", when="@v2.4-jedi.2")
+
+ depends_on("crtm-fix@2.3.0_emc", when="@2.3.0 +fix")
+ depends_on("crtm-fix@2.4.0_emc", when="@2.4.0 +fix")
+
+ depends_on("ecbuild", type=("build"), when="@v2.3-jedi.4")
+ depends_on("ecbuild", type=("build"), when="@v2.4-jedi.1")
+ depends_on("ecbuild", type=("build"), when="@v2.4-jedi.2")
+
+ # ecbuild release v2.4.0 is broken
+ # add ecbuild dependency for next release with fix
+ # depends_on("ecbuild", when="@2.4.0:", type=("build"))
+
+ # REL-2.4.0_emc (v2.4.0 ecbuild does not work)
+ version("2.4.0", commit="5ddd0d6")
+ # Uses the tip of REL-2.3.0_emc branch
+ version("2.3.0", commit="99760e6")
+ # JEDI applications so far use these versions
+ # Branch release/crtm_jedi
+ version("v2.3-jedi.4", commit="bfede42")
+ # Branch release/crtm_jedi_v2.4.0
+ version("v2.4-jedi.1", commit="8222341")
+ version("v2.4-jedi.2", commit="62831cb")