# Example script demonstrating automation of SCMI tile generation using AXI-Tools.
#
# Requires inotify-tools (available as part of CentOS) be present.
# Requires these environment variables:
# GRB_PRODUCTS input L1B directory
# AXI_TOOLS AXI-Tools location
# SCENE ABI scene to filter on, e.g. RadC, RadM1, RadM2, RadF
# SCMI_REGION Region code to use in output SCMI filenames, e.g. ECONUS, EMESO1, EMESO2, EFD
# SCMI_ENV Environment and data type code to use in output SCMI filename, e.g. OT, OR, DT
#
# Invocation:
# /path/to/grb2scmi.sh
#
# Output is written to the working directory.
oops(){
echo"ERROR: $*"
exit 1
}
# configurable values provided in environment
test-d"$GRB_PRODUCTS"|| oops "please set GRB_PRODUCTS environment to directory of arriving GRB products"
test-n"$AXI_TOOLS"|| oops "Please set AXI_TOOLS in environment to indicate location of the AXI-Tools software"
test-x"$(which inotifywait)"|| oops "inotify-tools is needed by this script."
export PY3=$AXI_TOOLS/ShellB3/bin/python3
test-x"$PY3"|| oops "Could not find $PY3. Check environment variable AXI_TOOLS"
export CMI_CHANGER=$AXI_TOOLS/bin/cmi_changer.sh
test-f"$CMI_CHANGER"|| oops "Could not find $CMI_CHANGER. Check environment variable AXI_TOOLS"test-n"$SCENE"|| oops "please set SCENE in environment to indicate the scene to filter incoming files on (e.g. \"RadC\")"# e.g. "RadC" "RadM1", "RadM2", "RadF"
test-n"$SCMI_REGION"|| oops "please set SCMI_REGION in environment to indicate the region to use in output files (e.g. \"ECONUS\")"# TCONUS, TMESO1, TMESO2, TFD for lack of a better guess
test-n"$SCMI_ENV"|| oops "please set SCMI_ENV in environment to indicate the environment and data type to use in output files (e.g. \"OT\")"# OR, DT, etc
cmi_changer(){
# echo "+++ creating SCMI tiles using $*"
$CMI_CHANGER-E$SCMI_ENV-R$SCMI_REGION"$@"
}
export-f cmi_changer # needed when using with xargs and other forms of sub-shell like $(...)