CLI Commandsο
initialize_adcircο
initialize_adcirc creates JSON Configurations from initial parameters of a model run (model start and end times, forcing files, storm track ID, etc.).
These JSON files provide a portable encapsulation of the entire model run, including model configurations in fort.15 and NEMS couplings.
The files are read by generate_adcirc to generate the actual model configuration; generate_adcirc must be run again every time the JSON files change to keep the configuration up to date.
[2024-08-08 14:08:01,521] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/bin/initialize_adcirc", line 5, in <module>
from coupledmodeldriver.client.initialize_adcirc import main
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/client/initialize_adcirc.py", line 9, in <module>
from adcircpy import TidalSource
ModuleNotFoundError: No module named 'adcircpy'
ADCIRC run options that are not exposed by this command, such as runs or gwce_solution_scheme, can be specified by directly modifying the JSON files.
The following command creates JSON files for coupling (ATMESH + WW3DATA) -> ADCIRC over a small Shinnecock Inlet mesh:
initialize_adcirc \
--platform HERA \
--mesh-directory /scratch2/COASTAL/coastal/save/shared/models/meshes/shinnecock/v1.0 \
--output-directory hera_shinnecock_ike_spinup_tidal_atmesh_ww3data \
--modeled-start-time 20080823 \
--modeled-duration 14:06:00:00 \
--modeled-timestep 00:00:02 \
--nems-interval 01:00:00 \
--adcirc-executable /scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/ALLBIN_INSTALL/NEMS-adcirc-atmesh-ww3data.x \
--adcirc-processors 40
--adcprep-executable /scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/ALLBIN_INSTALL/adcprep \
--modulefile /scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/modulefiles/envmodules_intel.hera \
--forcings tidal,atmesh,ww3data \
--tidal-source TPXO \
--tidal-path /scratch2/COASTAL/coastal/save/shared/models/forcings/tides/h_tpxo9.v1.nc \
--tidal-spinup-duration 12:06:00:00 \
--atmesh-path /scratch2/COASTAL/coastal/save/shared/models/forcings/shinnecock/ike/wind_atm_fin_ch_time_vec.nc \
--ww3data-path /scratch2/COASTAL/coastal/save/shared/models/forcings/shinnecock/ike/ww3.Constant.20151214_sxy_ike_date.nc
This will create the directory hera_shinnecock_ike_spinup_tidal_atmesh_ww3data/ with the following JSON configuration files:
π hera_shinnecock_ike_spinup_tidal_atmesh_ww3data/
β£ π configure_adcirc.json
β£ π configure_atmesh.json
β£ π configure_modeldriver.json
β£ π configure_nems.json
β£ π configure_slurm.json
β£ π configure_tidal_forcing.json
β π configure_ww3data.json
These files contain relevant configuration values for an ADCIRC run. You will likely wish to change these values to alter the
resulting run, before generating the actual model configuration. For instance, NEMS connections and the run sequence need to be
manually specified in configure_nems.json.
generate_adcircο
generate_adcirc reads JSON files (created by initialize_adcirc) and creates a set of ADCIRC configurations
(fort.14, fort.15, etc.), as well as a script with which to submit the model run to a job manager such as Slurm.
[2024-08-08 14:08:01,569] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/pyschism/forcing/hycom/gofs.py:8: UserWarning: The seawater library is deprecated! Please use gsw instead.
import seawater as sw
[2024-08-08 14:08:04,383] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:04,385] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:04,386] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/bin/generate_adcirc", line 5, in <module>
from coupledmodeldriver.client.generate_adcirc import main
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/client/generate_adcirc.py", line 6, in <module>
from coupledmodeldriver.generate import generate_adcirc_configuration
ImportError: cannot import name 'generate_adcirc_configuration' from 'coupledmodeldriver.generate' (/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/generate/__init__.py)
The following command will read the JSON files created in the example above and generate the following files:
cd hera_shinnecock_ike_spinup_tidal_atmesh_ww3data
generate_adcirc
π hera_shinnecock_ike_spinup_tidal_atmesh_ww3data/
β£ π configure_adcirc.json
β£ π configure_atmesh.json
β£ π configure_modeldriver.json
β£ π configure_nems.json
β£ π configure_slurm.json
β£ π configure_tidal_forcing.json
β£ π configure_ww3data.json
β£ π spinup/
β β£ π fort.13
β β£ π fort.14 -> ../fort.14
β β£ π fort.15
β β£ π nems.configure
β β£ π model_configure
β β£ π atm_namelist.rc -> ./model_configure
β β£ π config.rc
β β£ π setup.job
β β π adcirc.job
β£ π runs/
β β π unperturbed/
β β£ π fort.13
β β£ π fort.14 -> ../../fort.14
β β£ π fort.15
β β£ π fort.67.nc -> ../../spinup/fort.67.nc
β β£ π fort.68.nc -> ../../spinup/fort.68.nc
β β£ π nems.configure
β β£ π model_configure
β β£ π atm_namelist.rc -> ./model_configure
β β£ π config.rc
β β£ π setup.job
β β π adcirc.job
β£ π fort.14
β£ π cleanup.sh
β π run_hera.sh
check_completionο
check_completion checks the completion status of a running model directory.
[2024-08-08 14:08:04,705] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/pyschism/forcing/hycom/gofs.py:8: UserWarning: The seawater library is deprecated! Please use gsw instead.
import seawater as sw
[2024-08-08 14:08:07,517] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:07,519] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:07,521] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
usage: check_completion [-h] [--model MODEL] [--verbose] [directory ...]
positional arguments:
directory directory containing model run configuration
options:
-h, --help show this help message and exit
--model MODEL model that is running, one of: `ADCIRC`, `SCHISM`
--verbose list all errors and problems with runs
check_completion
{
"hera_shinnecock_ike_spinup_tidal_atmesh_ww3data": {
"spinup": "running - 15%",
"runs": "not_started - 0%"
}
}
you can also pass a specific directory (or several directories):
check_completion spinup
{
"spinup": "running - 27%"
}
cd run_20211027_florence_besttrack_250msubset_quadrature
check_completion runs/*_13
{
"vortex_4_variable_perturbation_13": "completed - 100.0%",
"vortex_4_variable_quadrature_13": "not_started - 0%"
}
if a run has an error, you can pass βverbose to see detailed logs:
check_completion spinup
{
"spinup": "error - 0%"
}
check_completion spinup --verbose
{
"spinup": {
"status": "error",
"progress": "0%",
"error": {
"ADCIRC_SETUP_SPINUP.err.log": [
"forrtl: severe (24): end-of-file during read, unit -4, file /proc/92195/fd/0\n",
"Image PC Routine Line Source \n",
"adcprep 000000000069A72E Unknown Unknown Unknown\n",
"adcprep 00000000006CBAAF Unknown Unknown Unknown\n",
"adcprep 000000000050A5CB openprepfiles_ 6996 prep.F\n",
"adcprep 0000000000507F22 prep13_ 753 prep.F\n",
"adcprep 000000000042E2E9 prepinput_ 717 adcprep.F\n",
"adcprep 000000000042BCDB MAIN__ 239 adcprep.F\n",
"adcprep 000000000040B65E Unknown Unknown Unknown\n",
"libc-2.17.so 00002AAEC02EB555 __libc_start_main Unknown Unknown\n",
"adcprep 000000000040B569 Unknown Unknown Unknown\n",
"srun: error: h24c51: task 0: Exited with exit code 24\n",
"srun: launch/slurm: _step_signal: Terminating StepId=25366266.1\n"
]
}
}
}
check_completion runs
{
"spinup": "failed - 0%"
}
check_completion runs --verbose
{
"runs": {
"status": "failed",
"progress": "0%",
"failed": {
"fort.16": "ADCIRC output file `fort.16` not found"
},
"error": {
"ADCIRC_SETUP_unperturbed.err.log": [
"slurmstepd: error: execve(): /scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/ADCIRC/ALLBIN_INSTALL/adcprep: No such file or directory\n",
"srun: error: h18c49: task 0: Exited with exit code 2\n",
"srun: launch/slurm: _step_signal: Terminating StepId=25366268.0\n"
]
}
}
}
unqueued_runsο
unqueued_runs finds and optionally submits runs that havenβt been queued to a job manager.
[2024-08-08 14:08:07,837] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/pyschism/forcing/hycom/gofs.py:8: UserWarning: The seawater library is deprecated! Please use gsw instead.
import seawater as sw
[2024-08-08 14:08:10,647] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:10,648] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
[2024-08-08 14:08:10,651] /home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/_depend.py WARNING : can't find the 'adcircpy' module
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/bin/unqueued_runs", line 5, in <module>
from coupledmodeldriver.client.unqueued_runs import main
File "/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/client/unqueued_runs.py", line 7, in <module>
from coupledmodeldriver.client.check_completion import (
ImportError: cannot import name 'MODELS' from 'coupledmodeldriver.client.check_completion' (/home/docs/checkouts/readthedocs.org/user_builds/coupledmodeldriver/envs/stable/lib/python3.10/site-packages/coupledmodeldriver/client/check_completion.py)
corresponding Python functionsο
- coupledmodeldriver.client.check_completion.check_completion(directory: PathLike | None = None, verbose: bool = False, model: Model | None = None) Dict[str, Any]ο
check the completion status of a running model
- Parameters:
directory β directory containing model run configuration
verbose β list all errors and problems with runs
model β model that is running, one of:
ADCIRC,SCHISM
- Returns:
JSON output of completion status