Skip to content

Conversation

@mpaiao
Copy link

@mpaiao mpaiao commented Feb 2, 2026

This pull request supersedes #12, as it is now compatible with egeon and jaci.

Goals of this pull request

  1. Make the configuration a bit more flexible, by using dash-like options for settings (as most Linux commands use).
  2. Temporarily allow previous versions of MONAN to run with the most recent scripts_CD-CT, by defining an optional flag -m12. This was done because NoahMP is not available in the most recent MONAN version, and it was relatively straightforward to isolate the code needed for older versions of MONAN. This does add the python scripts back because we need the functionality to group vertical levels, but we can remove this once feature/MONAN-757-NF is merged to the newest version.
  3. Refactor the scripts so instead of commenting/uncommenting, we can specify everything in script 0.run_all.bash and just call it multiple times for each step.

Main updates and refactoring:

  1. All bash scripts in scripts_CD-CT/scripts now use dash-based flags to specify the settings. For example, below is an example of the differences between the original and proposed call for script 3.run_model.bash:
  • Original:: ./3.run_model.bash GFS 1024002 2024010100 48
  • Proposed: ./3.run_model.bash -e GFS -r 1024002 -i 2024010100 -f 48 [...]
    The main advantage of the proposed is that it is more transparent, and also does not require any specific order for the arguments.
  1. Script 0.run_all.bash was rewritten such that all settings can be specified by editing the beginning of the script (as it used to be), or through the dash-based flags. This is the only script that has default settings. In addition, a new flag step (-s [0-4]) can be used to specify which step to run. Options are 1-4 for the numbered scripts, and 0 to run all steps. This change eliminates the need for commenting/uncommenting steps. Ultimately, the idea is for most users to call 0.run_all.bash only and use the step argument to control the steps, and let 0.run_all.bash parse arguments to the other numbered scripts.

  2. Multiple settings that were hardcoded across multiple scripts are now arguments:

  • -d OUTPUT_DIAG_INTERVAL: this specifies how frequently output variables should be generated.
  • -h: this prints the list of all options for each script.
  • -i INPUT_PATH: if provided, this replaces the default input data path with specific paths in setenv.bash. This can be useful when testing new datasets.
  • -l NLEV: the number of vertical levels
  • -v VARTABLE: if provided, the suffix for specific variable tables (e.g., OPER, GFS)
  • -z: this deletes all paths containing compiled code and output paths (sources, execs, datain, dataout and run.*)
  1. Script 2.pre_processing.bash now accepts an optionial flag for overwriting the static file (-o). If this flag is provided, the step will generate the static file again even if the file already exists. This option is relevant for when testing MONAN developments that change the contents of the static file (e.g., soil colour maps).

  2. All scripts were revised so all the standard resolutions (3, 10, 15, 24, 30, 60, 120 km) are consistent and supported in all steps. In addition, the number of grid cells when reprojecting MONAN's output to regular longitude/latitude grids was slightly revised in scripts 4.run_post.bash and make_template.bash. The original calculation assumed 1 degree ~ 100 km, which makes the reprojected grid a bit coarser than it needs to be. The new calculation uses the Earth's total surface area and the number of grid cells as follows:

  • Δ = sqrt[ 4 × π × ( 180 / π)2 / NumberOfGridCells ]
  • PointsPerDegree = round(1 / Δ)
  1. Most paths were defined multiple times across all scripts, sometimes using relative paths. This was causing some glitches. Following @marcelopaivaramos suggestion, paths are now set and exported on setenv.bash.

  2. A few minor additional bug fixes and edits for clarity.

Testing and caveats

All numbered scripts have been successfully tested on both Jaci and Egeon. For the tests I used the following MONAN versions:

Caveats:

  • The original feature/MONAN-757-NF will not work on Jaci because it lacks the compiler settings in MONAN's Makefile. My fork of feature/MONAN-757-NF is identical to the original one, except that it adds the specific compiler settings for Jaci.
  • I had to change the cdo version loaded by setenv_PBS_ian.bash from `` to cdo/2.5.4. The older module had trouble reading NetCDF. It looks like cdo was not used until I added back some commands for older versions of MONAN, so maybe this doesn't affect anything.
  • I only tested the intel compiler on Jaci.

mpaiao added 15 commits January 26, 2026 15:34
1. All bash scripts in scripts_CD-CT/scripts now use dash-based flags to specify the
   settings. For example, when the previous configuration for script 3.run_model.bash
   used to be:
   - Original:: ./3.run_model.bash GFS 1024002 2024010100 48
   - Proposed: ./3.run_model.bash -e GFS -r 1024002 -i 2024010100 -f 48 [...]
   The main advantage of the proposed is that it is more transparent, and also does not
   require any specific order for the arguments.

2. Multiple settings that were hardcoded across multiple scripts are now arguments:
   -d OUTPUT_DIAG_INTERVAL: this specifies how frequently output variables should be
      generated.
   -i INPUT_PATH: if provided, this replaces the default input data path with specific
      paths in setenv.bash. This can be useful when testing new datasets.
   -l NLEV: the number of vertical levels
   -v VARTABLE: if provided, the suffix for specific variable tables (e.g., OPER, GFS)
   -z: this deletes all paths containing compiled code and output paths
       (sources, execs, datain, dataout and run.*)

3. Script 0.run_all.bash was rewritten such that all settings can be specified by editing
   the beginning of the script (as it used to be), or through the dash-based flags. This
   is the only script that has default settings. In addition, a new flag step (-s [0-4])
   can be used to specify which step to run. Options are 1-4 for the numbered scripts,
   and 0 to run all steps. This change eliminates the need for commenting/uncommenting
   steps. Ultimately, the idea is for most users to call 0.run_all.bash only and use the
   step argument to control the steps, and let 0.run_all.bash parse arguments to the other
   numbered scripts.

4. Script 2.pre_processing.bash now accepts an optionial flag for overwriting the static
   file (-o). If this flag is provided, the step will generate the static file again even
   if the file already exists. This option is relevant for when testing MONAN developments
   that change the contents of the static file (e.g., soil colour maps).

5. All scripts were revised so all the standard resolutions (10, 15, 24, 120 km) were
   consistent and supported in all steps. In addition, the number of grid cells when
   reprojecting MONAN's output to regular longitude/latitude grids was slightly revised in
   scripts 4.run_post.bash and make_template.bash. The original calculation assumed 1
   degree ~ 100 km, which makes the reprojected grid a bit coarser than it needs to be.
   The new calculation uses the Earth's total surface area and the number of grid cells as
   follows:
   - delta = sqrt ( 4 * pi * (180 /pi)^2 / NumberOfGridCells )
   - PointsPerDegree = round (1/Delta)

6. A few minor additional bug fixes and edits for clarity.
1. Added option -h to show usage to all scripts.
2. Added option -m12 to try to run older versions of MONAN (based on 1.2.0-rc) on Jaci.
   If this runs, I will make another commit to add some post-processing code too.
…flag, and edited

setenv.bash to provide a unique name for the true/false version of the -m12 flag.
…PUT_PATH must update

the system-specific setenv.bash
It could be a PBS problem. I attempted to fix by defining the paths
DIR_SCRIPTS and DIR_DADOS based on the actual location of setenv.bash instead of $(pwd)
…ripts_CD-CT can handle

MONAN versions based on 1.2.0-rc. These can be removed again once the versions containing
Noah-MP are fully integrated into later releases.
… to setenv.bash. The

same directory names were set in every bash script, so defining them in setenv.bash helps
streamline the code and avoids inconsistencies.
…ranch, so the output

was not properly set. I also slightly edited the logic for reporting the error, so all
expected files that were missing are listed in the output.
…MONAN code (and

python requirements) on Jaci.
@mpaiao
Copy link
Author

mpaiao commented Feb 3, 2026

All tests on Egeon and Jaci ran successfully, so I am flagging this as ready for review.

@mpaiao mpaiao marked this pull request as ready for review February 3, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant