From b88513e73fd498791e5bdde4a6a631da0b6ccef9 Mon Sep 17 00:00:00 2001 From: Jamie Wolff Date: Tue, 10 Aug 2021 23:03:35 +0000 Subject: [PATCH 1/3] Moved mrms_pull_topofhour.py to ush/ rather than scripts/ --- scripts/exregional_get_mrms_files.sh | 2 +- ush/config_defaults.sh | 2 +- {scripts => ush}/mrms_pull_topofhour.py | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {scripts => ush}/mrms_pull_topofhour.py (100%) diff --git a/scripts/exregional_get_mrms_files.sh b/scripts/exregional_get_mrms_files.sh index b21e27f2c..d337ec201 100755 --- a/scripts/exregional_get_mrms_files.sh +++ b/scripts/exregional_get_mrms_files.sh @@ -122,7 +122,7 @@ while [[ ${cur_ut} -le ${end_valid_ut} ]]; do hour=0 while [[ ${hour} -le 23 ]]; do echo "hour=${hour}" - python ${SCRIPTSDIR}/mrms_pull_topofhour.py ${vyyyy}${vmm}${vdd}${hour} ${mrms_proc} ${mrms_raw} ${field_base_name} ${level} + python ${USHDIR}/mrms_pull_topofhour.py ${vyyyy}${vmm}${vdd}${hour} ${mrms_proc} ${mrms_raw} ${field_base_name} ${level} hour=$((${hour} + 1)) # hourly increment done fi diff --git a/ush/config_defaults.sh b/ush/config_defaults.sh index 64baa7a8a..823cf12e8 100644 --- a/ush/config_defaults.sh +++ b/ush/config_defaults.sh @@ -483,7 +483,7 @@ WRITE_DOPOST="FALSE" # HPSS has an example of the expected file naming structure: # regional_workflow/scripts/exregional_get_mrms_files.sh. This script # calls the script used to identify the MRMS file closest to the valid -# time: regional_workflow/scripts/mrms_pull_topofhour.py. +# time: regional_workflow/ush/mrms_pull_topofhour.py. # # NDAS_OBS_DIR: # User-specified location of top-level directory where NDAS prepbufr diff --git a/scripts/mrms_pull_topofhour.py b/ush/mrms_pull_topofhour.py similarity index 100% rename from scripts/mrms_pull_topofhour.py rename to ush/mrms_pull_topofhour.py From 01e4f222f46d54f0993aede05d4a65d8b52ef8bb Mon Sep 17 00:00:00 2001 From: Jamie Wolff Date: Mon, 16 Aug 2021 20:22:29 +0000 Subject: [PATCH 2/3] Updates to get the mrms_pull_topofhour.py script to run with the proper environment loaded. Fixed a tab issue in the py script as well. --- scripts/exregional_get_mrms_files.sh | 2 ++ ush/load_modules_run_task.sh | 2 +- ush/mrms_pull_topofhour.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/exregional_get_mrms_files.sh b/scripts/exregional_get_mrms_files.sh index d337ec201..ff09c5546 100755 --- a/scripts/exregional_get_mrms_files.sh +++ b/scripts/exregional_get_mrms_files.sh @@ -1,5 +1,7 @@ #!/bin/sh +. ${GLOBAL_VAR_DEFNS_FP} + # This script pulls MRMS data from the NOAA HPSS # Top-level MRMS directory set -x diff --git a/ush/load_modules_run_task.sh b/ush/load_modules_run_task.sh index 862bf9338..8be5eda08 100755 --- a/ush/load_modules_run_task.sh +++ b/ush/load_modules_run_task.sh @@ -298,6 +298,7 @@ Call to \"module use\" command failed." # # Load the .local module file if available for the given task # +set +u modulefile_local="${task_name}.local" if [ -f ${modules_dir}/${modulefile_local} ]; then module load "${modulefile_local}" || print_err_msg_exit "\ @@ -331,7 +332,6 @@ if [ -n "${SRW_ENV:-}" ] ; then conda activate ${SRW_ENV} fi - # #----------------------------------------------------------------------- # diff --git a/ush/mrms_pull_topofhour.py b/ush/mrms_pull_topofhour.py index 36d644be3..43bc70619 100644 --- a/ush/mrms_pull_topofhour.py +++ b/ush/mrms_pull_topofhour.py @@ -73,7 +73,7 @@ print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) os.system('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/dcom/us007003/ldmdata/obs/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) - os.system('gunzip '+VALID_DIR+'/'+filename2) + os.system('gunzip '+VALID_DIR+'/'+filename2) elif valid.strftime('%Y%m%d') >= '20200304': print('cp '+MRMS_PROD_DIR+'/'+valid.strftime('%Y%m%d')+'/upperair/mrms/conus/'+MRMS_PRODUCT+'/'+filename1+' '+VALID_DIR+'/'+filename2) From f4a3aba3af38b4822014e398f4a0a8492541f0e2 Mon Sep 17 00:00:00 2001 From: "Michael Kavulich, Jr" Date: Wed, 25 Aug 2021 16:42:38 +0000 Subject: [PATCH 3/3] Move "set +u" to the place it is absolutely needed, add a "set -u" at the end to restore the unset variable flag --- ush/load_modules_run_task.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ush/load_modules_run_task.sh b/ush/load_modules_run_task.sh index 8be5eda08..8b91ef0cf 100755 --- a/ush/load_modules_run_task.sh +++ b/ush/load_modules_run_task.sh @@ -298,7 +298,6 @@ Call to \"module use\" command failed." # # Load the .local module file if available for the given task # -set +u modulefile_local="${task_name}.local" if [ -f ${modules_dir}/${modulefile_local} ]; then module load "${modulefile_local}" || print_err_msg_exit "\ @@ -329,7 +328,9 @@ ules_dir) for the specified task (task_name) failed: # now. if [ -n "${SRW_ENV:-}" ] ; then + set +u conda activate ${SRW_ENV} + set -u fi #