modify_case_namelists.py#
Modifies key-value entries in eCLM case namelist files.
What it does#
The script rewrites individual namelist keys in one or more eCLM case namelist files. Only the keys targeted by the supplied options are changed; all other content is left untouched.
After modifying each file the script appends a comment block recording
the timestamp and the full command that was run (suppressed with
--no-changelog):
!#--------------------------------------------------------------------------------------------------------------------------
!# lnd_in:: Modified by modify_case_namelists.py on 2024-07-01 09:15:00
!# Command: modify_case_namelists.py --rundir /path/to/rundir --clm_inparm-finidat my_restart.nc
!#--------------------------------------------------------------------------------------------------------------------------
Files and option groups#
Options are organised by the file and namelist group they target. The prefix of each option flag identifies both:
Option prefix |
File |
Namelist group |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Run python3 modify_case_namelists.py --help for the complete list of
available keys within each group.
Usage#
# Set run period and CLM initial conditions
python3 modify_case_namelists.py \
--rundir /path/to/rundir \
--timemgr-start_ymd 20220101 \
--timemgr-stop_ymd 20221231 \
--clm_inparm-finidat my_restart.nc
# Change output directory in all modelio files
python3 modify_case_namelists.py \
--rundir /path/to/rundir \
--adapt lnd_modelio.nml atm_modelio.nml \
--modelio-diro /scratch/logs
# Modify only lnd_in, skip the changelog comment
python3 modify_case_namelists.py \
--rundir /path/to/rundir \
--adapt lnd_in \
--no-changelog \
--clm_inparm-spinup_state 1
General options#
Option |
Description |
|---|---|
|
Directory containing the namelist files. Defaults to |
|
Which files to modify (space- or comma-separated). Default: |
|
Namelist backend: |
|
Do not append the modification comment block to modified files |
Commonly used keys#
Run period (--timemgr-)
Option |
Namelist key |
Description |
|---|---|---|
|
|
Start date ( |
|
|
Stop date ( |
|
|
Run length (number of units) |
|
|
Run length unit ( |
|
|
Restart interval (number) |
|
|
Restart interval unit |
|
|
Calendar type |
|
|
ATM coupling time step (s) |
|
|
LND coupling time step (s) |
Land model (--clm_inparm-)
Option |
Namelist key |
Description |
|---|---|---|
|
|
Initial conditions file |
|
|
Surface data file |
|
|
Domain file |
|
|
CLM parameter file |
|
|
CLM time step (s) |
|
|
Spinup mode (0: normal, 1: AD, 2: post-AD) |
|
|
History write frequency |
|
|
Max frames per history file |
|
|
History field list (Fortran list string) |
DATM streams (--shr_strdata_nml-)
Option |
Namelist key |
Description |
|---|---|---|
|
|
Stream file list (Fortran list string) |
|
|
DATM domain file |
Model I/O (--modelio-, --pio_inparm-)
Option |
Namelist key |
Description |
|---|---|---|
|
|
Input directory |
|
|
Output/log directory |
|
|
Log filename |
|
|
PIO I/O type ( |
|
|
Number of PIO I/O tasks |
Multi-value keys#
Some keys hold comma-separated Fortran list values (e.g. hist_fincl1,
streams). Pass the entire Fortran list string as a single quoted
argument:
--clm_inparm-hist_fincl1 "'SOILWATER_10CM', 'H2OSOI', 'SOILLIQ'"