forked from NOAA-GSL/UPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NOAA-EMC#115 from gsketefian/community_develop
Community develop
- Loading branch information
Showing
51 changed files
with
4,071 additions
and
6,137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
#!/bin/bash | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# This script generates grid and orography files in NetCDF format that | ||
# are required as inputs for running the FV3SAR 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 temporary direc- | ||
# tory defined in 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 FV3SAR 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_T7 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 FV3SAR 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 temporary directory defined in 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_T7) | ||
# 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_T7) as the (unfiltered) orography | ||
# file generated by script orog_gen_scr (and the grid file genera- | ||
# ted by grid_gen_scr). | ||
# | ||
# b) In analogy with the input grid files, the FV3SAR 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_T7 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. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Source the variable definitions script and the function definitions | ||
# file. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
. $SCRIPT_VAR_DEFNS_FP | ||
. $USHDIR/source_funcs.sh | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Save current shell options (in a global array). Then set new options | ||
# for this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ save_shell_opts; set -u -x; } > /dev/null 2>&1 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Set the script name and print out an informational message informing | ||
# the user that we've entered this script. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
script_name=$( basename "${BASH_SOURCE[0]}" ) | ||
print_info_msg "\n\ | ||
======================================================================== | ||
Entering script: \"${script_name}\" | ||
This is the J-job script for the task that generates grid files. | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Export select variables. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
export gtype | ||
export stretch_fac | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Call the ex-script for this J-job and pass to it the necessary varia- | ||
# bles. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
${SCRIPTSDIR}/exregional_make_grid.sh \ | ||
WORKDIR_LOCAL="ABCD" || \ | ||
print_err_msg_exit "${script_name}" "\ | ||
Call to ex-script corresponding to J-job \"${script_name}\" failed." | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Create a flag file to make rocoto aware that the make_grid task has | ||
# successfully completed (so that other tasks that depend on it can be | ||
# launched). | ||
# | ||
# Although we can use the <taskdep> tag to make other tasks depend on | ||
# the successful completion of make_grid, it turns out that the <task- | ||
# dep> tag assumes that the task it specifies (in this case make_grid) | ||
# runs for the same set of cycles as the one in which it appears as a | ||
# dependency. Thus, if we use <taskdep> in a cycle-dependent task in | ||
# the workflow to make it depend on the make_grid, then the workflow | ||
# will wait for make_grid to run for each cycle for which that cycle-de- | ||
# pendent task is defined before running the task. But since make_grid | ||
# will not run for each cycle (except possibly for the very first one), | ||
# the cycle-dependent task will not be able to run for any of the cycles | ||
# except the first one. For this reason, we cannot use the <taskdep> | ||
# tag to make other cycle-dependent tasks depend on make_grid and must | ||
# instead use a flag file. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
touch "$LOGDIR/make_grid_task_complete.txt" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Print exit message. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg "\n\ | ||
======================================================================== | ||
Exiting script: \"${script_name}\" | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Restore the shell options saved at the beginning of this script/func- | ||
# tion. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ restore_shell_opts; } > /dev/null 2>&1 | ||
|
Oops, something went wrong.