Skip to content

Commit

Permalink
Add flexpart-cosmo (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn authored Sep 19, 2023
1 parent 99b4c46 commit c6fc4a6
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
51 changes: 51 additions & 0 deletions repos/c2sm/packages/flexpart-cosmo/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2013-2020 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 *
from distutils.dir_util import copy_tree
from llnl.util.filesystem import working_dir


class FlexpartCosmo(MakefilePackage):
"""flexpart is a Lagrangian dispersion model"""

homepage = 'https://github.com/C2SM-RCM/flexpart'
git = 'ssh://[email protected]/C2SM-RCM/flexpart.git'

version('main', branch='main')

depends_on('eccodes +fortran')
depends_on('netcdf-fortran')

conflicts('%gcc@:10')
conflicts('%nvhpc')
conflicts('%pgi')
conflicts('%cce')

build_directory = 'src'

makefile_file = "Makefile.spack"

@property
def build_targets(self):
return ['ncf=yes', 'VERBOSE=1']

def setup_build_environment(self, env):
env.set('GRIB_API', self.spec['eccodes'].prefix)
env.set('NETCDF', self.spec['netcdf-fortran'].prefix)

def build(self, spec, prefix):

with working_dir(self.build_directory):
make('-f', self.makefile_file)

def install(self, spec, prefix):
mkdir(prefix.bin)
mkdir(prefix.share)
mkdir(prefix.share + '/test/')
mkdir(prefix.share + '/options/')
copy_tree('options/', prefix.share + '/options/')
install('bin/FLEXPART', prefix.bin)
7 changes: 7 additions & 0 deletions test/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def test_fdb(self):
def test_fdb_fortran(self):
spack_info('fdb-fortran')

def test_flexpart_cosmo(self):
spack_info('flexpart-cosmo')

def test_flexpart_fdb(self):
spack_info('flexpart-fdb')

Expand Down Expand Up @@ -286,6 +289,10 @@ def test_fdb(self):
def test_fdb_fortran(self):
spack_spec('fdb-fortran')

@pytest.mark.no_tsa # No compatible compiler available
def test_flexpart_cosmo(self):
spack_spec('flexpart-cosmo')

def test_flexpart_fdb(self):
spack_spec('flexpart-fdb')

Expand Down
7 changes: 7 additions & 0 deletions test/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ def test_install_latest(self):
spack_install_and_test('flexpart-ifs @meteoswiss-10')


@pytest.mark.no_tsa # No one uses spack for flexpart-cosmo on Tsa
class FlexpartCosmoTest(unittest.TestCase):

def test_install(self):
spack_install_and_test('flexpart-cosmo')


class GridToolsTest(unittest.TestCase):

def test_install_version_1_1_3_gcc(self):
Expand Down

0 comments on commit c6fc4a6

Please sign in to comment.