Skip to content

Conversation

@mpaiao
Copy link

@mpaiao mpaiao commented Jan 5, 2026

Multiple edits to the CD-CT scripts, mostly minor.

  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.
  1. 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.*)
  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. 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).

  3. 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:

  • Δ = sqrt[ 4 × π × ( 180 / π)2 / NumberOfGridCells ]
  • PointsPerDegree = round(1 / Δ)
  1. A few minor additional bug fixes and edits for clarity.

…to specify which

settings to use (resolution, input). This provides a more intuitive (albeit more verbose)
method to configure the runs.

Script 0.run_all.bash was rewritten such that all settings can go through it, and a new
"step" argument can be passed to specify which step to run (as opposed to commenting
or uncommenting each step).
mpaiao added 5 commits January 6, 2026 16:15
… to increase the

visibility of variable VARTABLE.
…alculation to

   refer to OUTPUT_DIAG_INTERVAL
2. A few minor typo fixes that I had inadvertently introduced in the helper function as I
   was deciding which flags to use. I also removed some forgotten references to
   OUTPUT_DIAG_INT, which I had originally used by replaced with OUTPUT_DIAG_INTERVAL for
   clarity.
…setting the input

path for data in setenv.bash. If "-i" is not provided, the default path is used.
@mpaiao mpaiao marked this pull request as draft January 8, 2026 10:54
mpaiao added 4 commits January 8, 2026 11:10
…(with dash) to avoid

   hardcoded variables (especially VARTABLE and OUTPUT_DIAG_INTERVAL).
2. Fixed some of the code in 4.run_post.bash, which was still assuming results every 3
   hours.
3. Renamed NLEV in the post-processing to avoid ambiguities
4. Fixed inconsistent configurations for grid resolutions.
…tput/log files

from the path. It is not a complete reset because it does not revert files in the
scripts directory.
@mpaiao mpaiao changed the title Add "dash" options to the bash script, and refactoring of 0.run_all.bash Add "dash" options to the bash scripts, and some additional refactoring Jan 10, 2026
…he output to a regular

longitude/latitude grid. It now accounts for the number of grid cells and the average
resolution across the Earth's surface (4*pi steradians).
@mpaiao mpaiao marked this pull request as ready for review January 10, 2026 13:22
@mpaiao
Copy link
Author

mpaiao commented Jan 10, 2026

I tested these updates quite a bit, and I think these are good for review.

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