Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop] Transition the var_defns bash file to YAML. #1098

Merged
merged 43 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
55b500b
WIP
christinaholtNOAA Apr 11, 2024
46c4805
Add machine to command
christinaholtNOAA Apr 11, 2024
87e549f
Keep same environment behavior for AQM jobs.
christinaholtNOAA Apr 11, 2024
59d07d4
WIP
christinaholtNOAA Apr 18, 2024
446f6eb
Finished up first round of ex-scripts
christinaholtNOAA Apr 18, 2024
38f9daa
Order docs.
christinaholtNOAA Apr 18, 2024
8496c68
Order jobs.
christinaholtNOAA Apr 18, 2024
e5b28da
Ordering for sourced files.
christinaholtNOAA Apr 18, 2024
16da1ef
Cleaning up old functionality.
christinaholtNOAA Apr 18, 2024
444f1f0
WIP
christinaholtNOAA Apr 18, 2024
a12f6fb
WIP
christinaholtNOAA Apr 19, 2024
4bec6b7
WIP
christinaholtNOAA Apr 19, 2024
0d86ab0
Fix all the subshell problems.
christinaholtNOAA Apr 19, 2024
a6513cb
Merge remote-tracking branch 'origin/develop' into to_yaml
christinaholtNOAA Apr 23, 2024
f08e3ef
Boolified.
christinaholtNOAA Apr 27, 2024
94d7970
WIP
christinaholtNOAA Jun 11, 2024
4ef89f6
Merge remote-tracking branch 'origin/develop' into to_yaml
christinaholtNOAA Jun 11, 2024
874af4b
Bump uwtools version.
christinaholtNOAA Jun 11, 2024
d2a0bc2
Source from a function.
christinaholtNOAA Jun 11, 2024
253590f
WIP
christinaholtNOAA Jun 17, 2024
e242490
Add nco section to be sourced always.
christinaholtNOAA Jun 18, 2024
241ef5d
A bit of clean up
christinaholtNOAA Jun 18, 2024
f360da3
Update jobs/JREGIONAL_MAKE_OROG
christinaholtNOAA Jun 28, 2024
b31f6c7
Applying suggested changes from review.
christinaholtNOAA Jul 12, 2024
2ed368f
Update docs for default values.
christinaholtNOAA Jul 12, 2024
8b9eb07
Merge branch 'to_yaml' of https://github.com/ChristinaholtNOAA/ufs-sr…
christinaholtNOAA Jul 12, 2024
0a8cf97
Merge branch 'develop' of https://github.com/ufs-community/ufs-srweat…
christinaholtNOAA Jul 12, 2024
5502cdc
This should no longer be an executable bash file.
christinaholtNOAA Jul 12, 2024
b368974
Linting.
christinaholtNOAA Jul 13, 2024
b7bacbc
Addressing PR comments.
christinaholtNOAA Jul 15, 2024
d7378dc
Apply suggestions from code review
christinaholtNOAA Jul 15, 2024
e29b3b4
Fix reported stat namespace collision.
christinaholtNOAA Jul 16, 2024
d3f40c6
Merge branch 'to_yaml' of https://github.com/ChristinaholtNOAA/ufs-sr…
christinaholtNOAA Jul 16, 2024
8f7ac15
Apply suggestions from code review
christinaholtNOAA Jul 17, 2024
50be36a
Missed one!
christinaholtNOAA Jul 17, 2024
1acdb48
Making additional PR requested changes.
christinaholtNOAA Jul 17, 2024
ce0a6e6
Merge branch 'to_yaml' of https://github.com/ChristinaholtNOAA/ufs-sr…
christinaholtNOAA Jul 17, 2024
ff4f030
[to_yaml] Update wrapper scripts to allow them to run using var_defns…
MichaelLueken Jul 23, 2024
1afdf51
Merge pull request #4 from MichaelLueken/to_yaml
christinaholtNOAA Jul 23, 2024
060ecc9
Remove tests that are no longer relevant.
christinaholtNOAA Jul 23, 2024
072e8eb
Merge branch 'to_yaml' of https://github.com/ChristinaholtNOAA/ufs-sr…
christinaholtNOAA Jul 23, 2024
2ce08ae
[to_yaml] Update .cicd/scripts/wrapper_srw_ftest.sh to add third argu…
MichaelLueken Jul 25, 2024
85070ad
Merge pull request #5 from MichaelLueken/to_yaml
christinaholtNOAA Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aqm_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ dependencies:
- pylint=2.17*
- pytest=7.2*
- scipy=1.10.*
- uwtools=2.1*
- uwtools=2.3*
- xarray=2022.11.*
6 changes: 3 additions & 3 deletions doc/UsersGuide/CustomizingTheWorkflow/ConfigWorkflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ WORKFLOW Configuration Parameters

If non-default parameters are selected for the variables in this section, they should be added to the ``workflow:`` section of the ``config.yaml`` file.

``WORKFLOW_ID``: (Default: ``!nowtimestamp ''``)
``WORKFLOW_ID``: (Default: ``''``)
Unique ID for the workflow run that will be set in ``setup.py``.

``RELATIVE_LINK_FLAG``: (Default: "--relative")
Expand Down Expand Up @@ -458,8 +458,8 @@ This section contains files and paths to files that are staged in the experiment
``WFLOW_XML_FN``: (Default: "FV3LAM_wflow.xml")
Name of the Rocoto workflow XML file that the experiment generation script creates. This file defines the workflow for the experiment.

``GLOBAL_VAR_DEFNS_FN``: (Default: "var_defns.sh")
Name of the file (a shell script) containing definitions of the primary and secondary experiment variables (parameters). This file is sourced by many scripts (e.g., the J-job scripts corresponding to each workflow task) in order to make all the experiment variables available in those scripts. The primary variables are defined in the default configuration file (``config_defaults.yaml``) and in the user configuration file (``config.yaml``). The secondary experiment variables are generated by the experiment generation script.
``GLOBAL_VAR_DEFNS_FN``: (Default: "var_defns.yaml")
Name of the auto-generated experiment configuration file. It contains the primary experiment variables defined in this default configuration script and in the user-specified configuration as well as secondary experiment variables generated by the experiment generation script from machine files and other settings. This file is the primary source of information used in the scripts at run time.

``ROCOTO_YAML_FN``: (Default: "rocoto_defns.yaml")
Name of the YAML file containing the YAML workflow definition from which the Rocoto XML file is created.
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ channels:
dependencies:
- pylint=2.17*
- pytest=7.2*
- uwtools=2.2*
- uwtools=2.3*
19 changes: 18 additions & 1 deletion jobs/JREGIONAL_CHECK_POST_OUTPUT
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
#
#-----------------------------------------------------------------------
#
# The J-Job script for checking the post output.
#
# Run-time environment variables:
#
# CDATE
# ENSMEM_INDX
# GLOBAL_VAR_DEFNS_FP
#
# Experiment variables
#
# user:
# SCRIPTSdir
# USHdir
#
# workflow:
# EXPTDIR
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pattern that shows up regularly. I did my best to add a doc block to the top of each j-job and ex-script to list the variables that are used in the script and the sections they come from.

The run-time variables may be from Rocoto jobs or from the NCO preamble.

#
#-----------------------------------------------------------------------
#
Expand All @@ -16,7 +31,9 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "" ${GLOBAL_VAR_DEFNS_FP}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command sources everything in the bash file that does not start with "task_", so the environment is now narrowed to the specific script with the new implementation.

for sect in user nco workflow ; do
mkavulich marked this conversation as resolved.
Show resolved Hide resolved
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pattern I've added to explicitly state which sections of the var_defns file should be "sourced". The bash util helps us run a UW tool that translates YAML to bash and then exports it line-by-line.

This sort of thing will go away with a full integration of uwtools drivers (planned work in upcoming EPIC PI 13).

. $USHdir/job_preamble.sh
#
#-----------------------------------------------------------------------
Expand Down
64 changes: 48 additions & 16 deletions jobs/JREGIONAL_GET_EXTRN_MDL_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,48 @@
#
#-----------------------------------------------------------------------
#
# This script gets either from the system directory or from mass store
# (HPSS) the files generated by the external model (specified by the
# variable EXTRN_MDL_NAME) for either the initial conditions (ICs) or the
# lateral boundary conditions (LBCs). Which of these we are considering
# depends on the value of the variable ICS_OR_LBCS, which should be defined
# in the environment (when calling this script from a rocoto workflow,
# the workflow should define this variable, e.g. using rocoto's <envar>
# tag).
#
# Note that when we refer to ICs, we are referring to not only the atmospheric
# fields at the initial time but also various surface fields (which are
# for now time-independent) as well as the 0-th forecast hour LBCs. Also,
# when we refer to LBCs, we are referring to the LBCs excluding the one
# at the 0-th hour.
# The J-Job script for getting the model files that will be used for
# either initial conditions or lateral boundary conditions for the
# experiment.
#
# Run-time environment variables:
christinaholtNOAA marked this conversation as resolved.
Show resolved Hide resolved
#
# CDATE
# COMIN
# cyc
# DATA
# EXTRN_MDL_STAGING_DIR
# GLOBAL_VAR_DEFNS_FP
# ICS_OR_LBCS
# PDY
#
# Experiment variables
#
# user:
# SCRIPTSdir
# USHdir
#
# workflow:
# EXPTDIR
#
# task_get_extrn_lbcs:
# EXTRN_MDL_FILES_LBCS
# EXTRN_MDL_LBCS_OFFSET_HRS
# EXTRN_MDL_NAME_LBCS
# EXTRN_MDL_SOURCE_BASEDIR_LBCS
# EXTRN_MDL_SYSBASEDIR_LBCS
# FV3GFS_FILE_FMT_LBCS
# LBC_SPEC_INTVL_HRS
# USE_USER_STAGED_EXTRN_FILES
#
# task_get_extrn_ics:
# EXTRN_MDL_FILES_ICS
# EXTRN_MDL_ICS_OFFSET_HRS
# EXTRN_MDL_NAME_ICS
# EXTRN_MDL_SOURCE_BASEDIR_ICS
# EXTRN_MDL_SYSBASEDIR_ICS
# FV3GFS_FILE_FMT_ICS
# USE_USER_STAGED_EXTRN_FILES
#
#-----------------------------------------------------------------------
#
Expand All @@ -29,8 +57,12 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "task_get_extrn_ics|task_get_extrn_lbcs" ${GLOBAL_VAR_DEFNS_FP}
. $USHdir/job_preamble.sh "TRUE"
for sect in user nco workflow task_get_extrn_lbcs task_get_extrn_ics ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
. $USHdir/job_preamble.sh


#
#-----------------------------------------------------------------------
#
Expand Down
18 changes: 16 additions & 2 deletions jobs/JREGIONAL_GET_VERIF_OBS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
#
#-----------------------------------------------------------------------
#
# This script checks, pulls, and stages observation data for model verification.
# The J-Job script that checks, pulls, and stages observation data for
# model verification.
#
# Run-time environment variables:
#
# CDATE
# GLOBAL_VAR_DEFNS_FP
#
# Experiment variables
#
# user:
# SCRIPTSdir
# USHdir
#
#-----------------------------------------------------------------------
#
Expand All @@ -16,7 +28,9 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task " " ${GLOBAL_VAR_DEFNS_FP}
for sect in user nco workflow ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
. $USHdir/job_preamble.sh
#
#-----------------------------------------------------------------------
Expand Down
31 changes: 30 additions & 1 deletion jobs/JREGIONAL_INTEGRATION_TEST
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
#!/bin/bash


#
#-----------------------------------------------------------------------
#
# This J-Job script runs a set of tests at the end of WE2E tests.
#
# Run-time environment variables:
#
# GLOBAL_VAR_DEFNS_FP
# CDATE
# FCST_DIR
# SLASH_ENSMEM_SUBDIR
#
# Experiment variables
#
# user:
# RUN_ENV
# SCRIPTSdir
# USHdir
#
# workflow:
# FCST_LEN_HRS
#
#-----------------------------------------------------------------------
#

#
#-----------------------------------------------------------------------
#
Expand All @@ -8,8 +34,11 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "task_integration_test|task_run_fcst" ${GLOBAL_VAR_DEFNS_FP}
for sect in user nco workflow ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
. $USHdir/job_preamble.sh

#
#-----------------------------------------------------------------------
#
Expand Down
114 changes: 22 additions & 92 deletions jobs/JREGIONAL_MAKE_GRID
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,25 @@
#
#-----------------------------------------------------------------------
#
# This script generates grid and orography files in NetCDF format that
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text block was not consistent with what this script actually does, nor what its corresponding ex-script does.

# are required as inputs for running the FV3-LAM model (i.e. the FV3 mo-
# del on a regional domain). It in turn calls three other scripts whose
# file names are specified in the variables grid_gen_scr, orog_gen_scr,
# and orog_fltr_scr and then calls the executable defined in the varia-
# ble shave_exec. These scripts/executable perform the following tasks:
#
# 1) grid_gen_scr:
#
# This script generates grid files that will be used by subsequent
# preprocessing steps. It places its output in the directory defined
# by GRID_DIR. Note that:
#
# a) This script creates grid files for each of the 7 tiles of the
# cubed sphere grid (where tiles 1 through 6 cover the globe, and
# tile 7 is the regional grid located somewhere within tile 6)
# even though the forecast will be performed only on tile 7.
#
# b) The tile 7 grid file that this script creates includes a halo,
# i.e. a layer of cells beyond the boundary of tile 7). The width
# of this halo (i.e. the number of cells in the halo in the direc-
# tion perpendicular to the boundary of the tile) must be made
# large enough such that the "shave" steps later below (which take
# this file as input and generate grid files with thinner halos)
# have a wide enough starting halo to work with. More specifical-
# ly, the FV3-LAM model needs as inputs two grid files: one with a
# halo that is 3 cells and another with a halo that is 4 cells
# wide. Thus, the halo in the grid file that the grid_gen_scr
# script generates must be greater than 4 since otherwise, the
# shave steps would shave off cells from within the interior of
# tile 7. We will let NHW denote the width of the halo in the
# grid file generated by grid_gen_scr. The "n" in this variable
# name denotes number of cells, the "h" is used to indicate that
# it refers to a halo region, the "w" is used to indicate that it
# refers to a wide halo (i.e. wider than the 3-cell and 4-cell ha-
# los that the FV3-LAM model requires as inputs, and the "T7" is
# used to indicate that the cell count is on tile 7.
#
# 2) orog_gen_scr:
#
# This script generates the orography file. It places its output in
# the directory defined by OROG_DIR. Note that:
#
# a) This script generates an orography file only on tile 7.
#
# b) This orography file contains a halo of the same width (NHW)
# as the grid file for tile 7 generated by the grid_gen_scr script
# in the previous step.
#
# 3) orog_fltr_scr:
#
# This script generates a filtered version of the orography file ge-
# nerated by the script orog_gen_scr. This script places its output
# in the temporary directory defined in WORKDIR_FLTR. Note that:
#
# a) The filtered orography file generated by this script contains a
# halo of the same width (NHW) as the (unfiltered) orography file
# generated by script orog_gen_scr (and the grid file generated by
# grid_gen_scr).
#
# b) In analogy with the input grid files, the FV3-LAM model needs as
# input two (filtered) orography files -- one with no halo cells
# and another with 3. These are obtained later below by "shaving"
# off layers of halo cells from the (filtered) orography file ge-
# nerated in this step.
#
# 4) shave_exec:
#
# This "shave" executable is called 4 times to generate 4 files from
# the tile 7 grid file generated by grid_gen_scr and the tile 7 fil-
# tered orography file generated by orog_fltr_scr (both of which have
# a halo of width NHW cells). The 4 output files are placed in the
# temporary directory defined in WORKDIR_SHVE. More specifically:
#
# a) shave_exec is called to shave the halo in the tile 7 grid file
# generated by grid_gen_scr down to a width of 3 cells and store
# the result in a new grid file in WORKDIR_SHVE.
#
# b) shave_exec is called to shave the halo in the tile 7 grid file
# generated by grid_gen_scr down to a width of 4 cells and store
# the result in a new grid file in WORKDIR_SHVE.
#
# c) shave_exec is called to shave the halo in the tile 7 filtered
# orography file generated by orog_fltr_scr down to a width of 0
# cells (i.e. no halo) and store the result in a new filtered oro-
# graphy file in WORKDIR_SHVE.
#
# d) shave_exec is called to shave the halo in the tile 7 filtered
# orography file generated by orog_fltr_scr down to a width of 4
# cells and store the result in a new filtered orography file in
# WORKDIR_SHVE.
# The J-Job that generates input NetCDF grid files for running the
# regional configuration of FV3
#
# Run-time environment variables:
#
# GLOBAL_VAR_DEFNS_FP
# DATA
#
# Experiment variables
#
# user:
# USHdir
# SCRIPTSdir
#
# workflow:
# PREEXISTING_DIR_METHOD
#
# task_make_grid:
# GRID_DIR
#
#-----------------------------------------------------------------------
#
Expand All @@ -106,7 +34,9 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "task_make_grid" ${GLOBAL_VAR_DEFNS_FP}
for sect in user nco workflow task_make_grid ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
. $USHdir/job_preamble.sh
#
#-----------------------------------------------------------------------
Expand Down
30 changes: 29 additions & 1 deletion jobs/JREGIONAL_MAKE_ICS
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
#!/usr/bin/env bash

#
#-----------------------------------------------------------------------
#
# The J-job to run chgres_cube for preparing initial conditions for the
# FV3 forecast
#
# Run-time environment variables:
#
# COMIN
# DATA
# GLOBAL_VAR_DEFNS_FP
# SLASH_ENSMEM_SUBDIR
#
# Experiment variables
#
# user:
# RUN_ENVIR
# SCRIPTSdir
# USHdir
#
# workflow:
# EXPTDIR
#
#-----------------------------------------------------------------------
#

#
#-----------------------------------------------------------------------
#
Expand All @@ -8,7 +34,9 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "task_make_ics" ${GLOBAL_VAR_DEFNS_FP}
for sect in user nco workflow ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
. $USHdir/job_preamble.sh
#
#-----------------------------------------------------------------------
Expand Down
Loading
Loading