Skip to content

Commit d455365

Browse files
Chris BlantonChris Blanton
authored andcommitted
#372 Add test to confirm split-ncvars single-file desired behavior
Also: update site config files for sw 2025.01
1 parent 6434c98 commit d455365

File tree

6 files changed

+65
-11
lines changed

6 files changed

+65
-11
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*.tar
44
*.gz
55
build.fre-nctools*
6-
build
6+
build*
77
_build
88
*.exe
99
*.1

site-configs/gfdl-ws/env.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3333

3434
# Variables to control versions used
35-
env_version=2024.02
36-
gcc_version=13.2.0
35+
env_version=2025.01
36+
gcc_version=13.3.0
3737
ncc_version=4.9.2
3838
ncf_version=4.6.1
39-
mpi_version=4.2.1
39+
mpi_version=4.2.3
4040

4141
# Ensure the base spack modules are first in MODULEPATH
4242
module remove-path MODULEPATH /app/spack/${env_version}/modulefiles/linux-rhel8-x86_64
4343
module prepend-path MODULEPATH /app/spack/${env_version}/modulefiles/linux-rhel8-x86_64
4444

45-
# bats, and python are needed for tests
46-
module load bats
45+
# python is needed for tests
4746
module load python
4847
module load nco
4948

site-configs/gfdl/env.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3333

3434
# Variables to control versions used
35-
env_version=2024.02
36-
gcc_version=13.2.0
35+
env_version=2025.01
36+
gcc_version=13.3.0
3737
ncc_version=4.9.2
3838
ncf_version=4.6.1
39-
mpi_version=4.2.1
39+
mpi_version=4.2.3
4040

4141
# Ensure the base spack modules are first in MODULEPATH
4242
module remove-path MODULEPATH /app/spack/${env_version}/modulefiles/linux-rhel8-x86_64
4343
module prepend-path MODULEPATH /app/spack/${env_version}/modulefiles/linux-rhel8-x86_64
4444

45-
# bats, and python are needed for tests
46-
module load bats
45+
# python is needed for tests
4746
module load python
4847
module load nco
4948

tests/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ TESTS = \
143143
plevel/plevel-nctypes \
144144
plevel/plevel-t \
145145
split_ncvars/split_ncvars \
146+
split_ncvars/split_ncvars-f \
146147
split_ncvars/split_ncvars-i \
147148
split_ncvars/split_ncvars-l \
148149
split_ncvars/split_ncvars-o \

tests/create_plevel_test_ncfile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ int main(int argc, char **argv) {
108108
check_err(nc_put_att_text(ncid, pfull_id, "long_name", 23, "ref full pressure level"), __LINE__);
109109
check_err(nc_put_att_text(ncid, pfull_id, "cartesian_axis", 1, "Z"), __LINE__);
110110
check_err(nc_put_att_text(ncid, pfull_id, "positive", 4, "down"), __LINE__);
111+
check_err(nc_put_att_text(ncid, pfull_id, "formula_terms", 6, "ps: ps"), __LINE__);
111112

112113
check_err(nc_def_var(ncid, "pk", NC_FLOAT, 1, &phalf_dim, &pk_id), __LINE__);
113114
check_err(nc_put_att_text(ncid, pk_id, "units", 6, "pascal"), __LINE__);

tests/split_ncvars/split_ncvars-f

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
3+
# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory
4+
5+
# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools).
6+
7+
# FRE-NCtools is free software: you can redistribute it and/or modify it under
8+
# the terms of the GNU Lesser General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or (at
10+
# your option) any later version.
11+
12+
# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT
13+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
# for more details.
16+
17+
# You should have received a copy of the GNU Lesser General Public
18+
# License along with FRE-NCTools. If not, see
19+
# <http://www.gnu.org/licenses/>.
20+
21+
if test "$VERBOSE" = yes
22+
then
23+
set -x
24+
command -v split_ncvars.pl --version
25+
fi
26+
27+
. ${srcdir=.}/init.sh; path_prepend_ ../../src
28+
29+
# Need to use the included list_ncvars.sh script. Otherwise,
30+
# split_ncvars will look for list_ncvars.sh in the installed bin
31+
# directory.
32+
export LIST_NCVARS=$(readlink -f ../../src/list_ncvars.sh)
33+
34+
# list_ncvars.sh needs to know where to find the built list_ncvars
35+
# executable.
36+
export PKGLIBEXECDIR=$(readlink -f ../../src)
37+
38+
# Use the test netCDF files from plevel
39+
${builddir=..}/create_plevel_test_ncfile || framework_failure_ "failed to create plevel test files"
40+
mkdir idir || framework_failure_ "failed to create idir"
41+
mv test_input.nc idir || framework_failure_ "failed to move test_input.nc to idir"
42+
43+
# Extract a static variable whose formula_terms contains a variable that contains time.
44+
# The output file should NOT contain time.
45+
split_ncvars.pl -v pfull -i idir test_input.nc -f output.nc || fail_ split_ncvars.pl test_input.nc failed
46+
47+
# Check that the output.nc file was created, that it has pfull in it, and does not have time in it
48+
test -f output.nc || fail_ output.nc not created
49+
if ncdump -v time output.nc
50+
then
51+
# Expected failure
52+
fail_ "output.nc incorrectly contains time"
53+
fi
54+
ncdump -v pfull output.nc || fail_ "output.nc does not contain output variable pfull"

0 commit comments

Comments
 (0)