CABLE-LSM / benchcab

Tool for evaluation of CABLE land surface model
https://benchcab.readthedocs.io/en/latest/
Apache License 2.0
2 stars 4 forks source link

Add patch remove feature #125

Closed SeanBryan51 closed 1 year ago

SeanBryan51 commented 1 year ago

Currently, benchcab does not support removing namelist parameters from the base namelist file. For example, legacy CABLE branches may not be compatible with a namelist parameter in the base namelist file.

This change adds a patch_remove key which will remove a given set of namelist parameters for a specific branch.

Fixes #92

codecov[bot] commented 1 year ago

Codecov Report

Merging #125 (093bedf) into master (309adca) will increase coverage by 0.21%. Report is 4 commits behind head on master. The diff coverage is 95.08%.

@@            Coverage Diff             @@
##           master     #125      +/-   ##
==========================================
+ Coverage   88.26%   88.47%   +0.21%     
==========================================
  Files          27       27              
  Lines        1474     1527      +53     
==========================================
+ Hits         1301     1351      +50     
- Misses        173      176       +3     
Files Changed Coverage Δ
tests/common.py 88.57% <ø> (ø)
benchcab/fluxsite.py 83.13% <84.21%> (ø)
benchcab/benchcab.py 33.91% <100.00%> (ø)
benchcab/config.py 100.00% <100.00%> (ø)
benchcab/repository.py 98.61% <100.00%> (+0.01%) :arrow_up:
benchcab/workdir.py 100.00% <100.00%> (ø)
tests/test_config.py 100.00% <100.00%> (ø)
tests/test_fluxsite.py 100.00% <100.00%> (ø)
tests/test_workdir.py 100.00% <100.00%> (ø)
SeanBryan51 commented 1 year ago

Integration tests

Test patch remove feature:

#!/bin/bash
bench_example_dir='bench_example_test_patch_remove'
rm -rf $bench_example_dir
git clone git@github.com:CABLE-LSM/bench_example.git $bench_example_dir
cd $bench_example_dir
git reset --hard 6287539e96fc8ef36dc578201fbf9847314147fb
cat > config.yaml << EOL
project: tm70

experiment: AU-Tum

realisations: [
  {
    path: "trunk",
  },
  {
    path: "branches/Users/mm3972/CABLE_GW_into_trunk_version2",
    revision: 9571,
    build_script: offline/build.ksh,
    patch_remove: {
      cable: {
        soilparmnew: nil
      }
    }
  }
]

modules: [
  intel-compiler/2021.1.1,
  netcdf/4.7.4,
  openmpi/4.1.0
]

science_configurations:
  - cable:
      cable_user:
        CONSISTENCY_CHECK: False
EOL
benchcab run -v

Job standard output:

Running fluxsite tasks...
Running task AU-Tum_2002-2017_OzFlux_Met_R1_S0... CABLE standard output saved in /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/tasks/AU-Tum_2002-2017_OzFlux_Met_R1_S0/out.txt
./cable cable.nml
Adding attributes to output file: /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/outputs/AU-Tum_2002-2017_OzFlux_Met_R1_S0_out.nc
Running task AU-Tum_2002-2017_OzFlux_Met_R0_S0... CABLE standard output saved in /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/tasks/AU-Tum_2002-2017_OzFlux_Met_R0_S0/out.txt
./cable cable.nml
Adding attributes to output file: /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/outputs/AU-Tum_2002-2017_OzFlux_Met_R0_S0_out.nc
Successfully ran fluxsite tasks

Running comparison tasks...
Comparing files AU-Tum_2002-2017_OzFlux_Met_R0_S0_out.nc and AU-Tum_2002-2017_OzFlux_Met_R1_S0_out.nc bitwise...
nccmp -df /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/outputs/AU-Tum_2002-2017_OzFlux_Met_R0_S0_out.nc /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/outputs/AU-Tum_2002-2017_OzFlux_Met_R1_S0_out.nc
Failure: files AU-Tum_2002-2017_OzFlux_Met_R0_S0_out.nc AU-Tum_2002-2017_OzFlux_Met_R1_S0_out.nc differ. Results of diff have been written to /scratch/tm70/sb8430/benchcab_integration_tests/bench_example_test_patch_remove/runs/fluxsite/analysis/bitwise-comparisons/AU-Tum_2002-2017_OzFlux_Met_S0_R0_R1.txt
Successfully ran comparison tasks

======================================================================================
                  Resource Usage on 2023-08-08 12:14:45:
   Job Id:             92172069.gadi-pbs
   Project:            tm70
   Exit Status:        0
   Service Units:      1.18
   NCPUs Requested:    18                     NCPUs Used: 18              
                                           CPU Time Used: 00:03:13        
   Memory Requested:   30.0GB                Memory Used: 1.72GB          
   Walltime requested: 06:00:00            Walltime Used: 00:01:58        
   JobFS requested:    100.0MB                JobFS used: 0B              
======================================================================================