From 7e09899586138b9b59166d5a35141b6293e3cc56 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Fri, 17 Mar 2023 12:13:21 +0000 Subject: [PATCH 1/9] Baseline initial version of Hera script. Fixes #788. --- util/sfc_climo_gen/run.hera.sh | 114 +++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100755 util/sfc_climo_gen/run.hera.sh diff --git a/util/sfc_climo_gen/run.hera.sh b/util/sfc_climo_gen/run.hera.sh new file mode 100755 index 000000000..25f539cf8 --- /dev/null +++ b/util/sfc_climo_gen/run.hera.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +#------------------------------------------------------------ +# Run the sfc_climo_gen program stand-alone on Hera using +# pre-exiting 'grid' and 'orography files. +# +# To run, type: 'sbatch $script' +#------------------------------------------------------------ + +#SBATCH -J sfc_climo_gen +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o log +#SBATCH -e log +#SBATCH --nodes=1 --ntasks-per-node=24 +#SBATCH --partition=bigmem +#SBATCH -q debug +#SBATCH -t 00:10:00 + +set -x + +export APRUN_SFC="srun" + +export BASE_DIR=$SLURM_SUBMIT_DIR/../.. + +source ${BASE_DIR}/sorc/machine-setup.sh > /dev/null 2>&1 +module use ${BASE_DIR}/modulefiles +module load build.$target.intel +module list + +#------------------------------------- +# Set model resolution. +#------------------------------------- + +export res=384 +#export res=384.mx025 + +#------------------------------------- +# Where the model "grid", "mosaic" and "oro" files reside. +#------------------------------------- + +export FIX_FV3=${BASE_DIR}/fix/orog/C${res} + +#------------------------------------- +# Uncomment for regional grids. +#------------------------------------- + +#HALO=3 +#export GRIDTYPE=regional + +#------------------------------------------------------------- +# Choose which soil type and vegetation type data to use. +# +# For viirs-based vegetation type data, set to: +# 1) "viirs.igbp.0.1" for global 0.10-deg data +# 2) "viirs.igbp.0.05" for global 0.05-deg data +# 3) "viirs.igbp.0.03" for global 0.03-deg data +# 4) "viirs.igbp.conus.30s" for CONUS 30s data +# 4) "viirs.igbp.nh.30s" for NH 30s data +# 4) "viirs.igbp.30s" for global 30s data +# +# For the modis-based vegetation data, set to: +# 1) "modis.igbp.0.05" for global 0.05-deg data +# 2) "modis.igbp.0.03" for global 0.03-deg data +# 3) "modis.igbp.conus.30s" for CONUS 30s data +# 4) "modis.igbp.nh.30s" for NH 30s data +# 5) "modis.igbp.30s" for global 30s data +# +# For STATSGO soil type data +# 1) "statsgo.0.05" for global 0.05-deg data +# 2) "statsgo.0.03" for global 0.03-deg data +# 3) "statsgo.conus.30s" for CONUS 30s data +# 4) "statsgo.nh.30s" for NH 30s data +# 5) "statsgo.30s" for global 30s data +# +# For Beijing Norm. Univ. soil type data +# 1) "bnu.30s" for global 30s data +#------------------------------------------------------------- + +export veg_type_src="modis.igbp.0.05" + +export soil_type_src="statsgo.0.05" + +#------------------------------------- +# Set working directory and directory where output files will be saved. +#------------------------------------- + +export WORK_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/work.sfc +export SAVE_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/sfc.C${res} + +#------------------------------------- +# Should not have to touch anything below here. +#------------------------------------- + +if [[ $GRIDTYPE = "regional" ]]; then + HALO=$(( $HALO + 1 )) + export HALO + ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_FV3/C${res}_grid.tile7.nc + ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc +fi + +res2=${res//".mx"*} +export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc + +export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo + +ulimit -a +ulimit -s unlimited + +rm -fr $WORK_DIR $SAVE_DIR + +${BASE_DIR}/ush/sfc_climo_gen.sh + +exit From 88e860e470849d074e48692b790d05485b332b07 Mon Sep 17 00:00:00 2001 From: "George.Gayno" Date: Fri, 17 Mar 2023 18:55:08 +0000 Subject: [PATCH 2/9] Update the wcoss2 script for 'frac oro' data. Fixes #788. --- util/sfc_climo_gen/run.wcoss2.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/sfc_climo_gen/run.wcoss2.sh b/util/sfc_climo_gen/run.wcoss2.sh index f8ecc9588..d5ce6d959 100755 --- a/util/sfc_climo_gen/run.wcoss2.sh +++ b/util/sfc_climo_gen/run.wcoss2.sh @@ -31,7 +31,8 @@ module list # Set model resolution. #------------------------------------- -export res=384 +#export res=384 +export res=384.mx025 #------------------------------------- # Where the model "grid", "mosaic" and "oro" files reside. @@ -97,6 +98,9 @@ if [[ $GRIDTYPE = "regional" ]]; then ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc fi +res2=${res//".mx"*} +export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc + export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo ulimit -a From 35f2a6dc5bd20793eeb5570517c57197856acec1 Mon Sep 17 00:00:00 2001 From: "George.Gayno" Date: Fri, 17 Mar 2023 21:00:19 +0000 Subject: [PATCH 3/9] Move common logic into a new script - sfc_gen.sh Fixes #788. --- util/sfc_climo_gen/readme.md | 3 + util/sfc_climo_gen/run.wcoss2.sh | 91 +------------------------------ util/sfc_climo_gen/sfc_gen.sh | 94 ++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 88 deletions(-) create mode 100755 util/sfc_climo_gen/sfc_gen.sh diff --git a/util/sfc_climo_gen/readme.md b/util/sfc_climo_gen/readme.md index 95745a1ec..ae9039b27 100644 --- a/util/sfc_climo_gen/readme.md +++ b/util/sfc_climo_gen/readme.md @@ -2,3 +2,6 @@ Run the sfc_climo_gen program stand-alone on WCOSS2 using pre-exiting 'grid' and 'orography' files. Outputs surface fields such as soil and vegetation type. + +Set the configuration variables in sfc_gen.sh. Then +run using the machine specific driver script. diff --git a/util/sfc_climo_gen/run.wcoss2.sh b/util/sfc_climo_gen/run.wcoss2.sh index d5ce6d959..fba3a815a 100755 --- a/util/sfc_climo_gen/run.wcoss2.sh +++ b/util/sfc_climo_gen/run.wcoss2.sh @@ -4,7 +4,8 @@ # Run the sfc_climo_gen program stand-alone on WCOSS2 using # pre-exiting 'grid' and 'orography files. # -# To run, type: 'qsub $script' +# Set the configuration variables in sfc_gen.sh. Then, +# run this script as follows: 'qsub $script' #------------------------------------------------------------ #PBS -o log @@ -22,92 +23,6 @@ export APRUN_SFC="mpiexec -n 24 -ppn 24 -cpu-bind core" export BASE_DIR=$PBS_O_WORKDIR/../.. -source ${BASE_DIR}/sorc/machine-setup.sh > /dev/null 2>&1 -module use ${BASE_DIR}/modulefiles -module load build.$target.intel -module list - -#------------------------------------- -# Set model resolution. -#------------------------------------- - -#export res=384 -export res=384.mx025 - -#------------------------------------- -# Where the model "grid", "mosaic" and "oro" files reside. -#------------------------------------- - -export FIX_FV3=${BASE_DIR}/fix/orog/C${res} - -#------------------------------------- -# Uncomment for regional grids. -#------------------------------------- - -##HALO=3 -##export GRIDTYPE=regional - -#------------------------------------------------------------- -# Choose which soil type and vegetation type data to use. -# -# For viirs-based vegetation type data, set to: -# 1) "viirs.igbp.0.1" for global 0.10-deg data -# 2) "viirs.igbp.0.05" for global 0.05-deg data -# 3) "viirs.igbp.0.03" for global 0.03-deg data -# 4) "viirs.igbp.conus.30s" for CONUS 30s data -# 4) "viirs.igbp.nh.30s" for NH 30s data -# 4) "viirs.igbp.30s" for global 30s data -# -# For the modis-based vegetation data, set to: -# 1) "modis.igbp.0.05" for global 0.05-deg data -# 2) "modis.igbp.0.03" for global 0.03-deg data -# 3) "modis.igbp.conus.30s" for CONUS 30s data -# 4) "modis.igbp.nh.30s" for NH 30s data -# 5) "modis.igbp.30s" for global 30s data -# -# For STATSGO soil type data -# 1) "statsgo.0.05" for global 0.05-deg data -# 2) "statsgo.0.03" for global 0.03-deg data -# 3) "statsgo.conus.30s" for CONUS 30s data -# 4) "statsgo.nh.30s" for NH 30s data -# 5) "statsgo.30s" for global 30s data -# -# For Beijing Norm. Univ. soil type data -# 1) "bnu.30s" for global 30s data -#------------------------------------------------------------- - -export veg_type_src="modis.igbp.0.05" - -export soil_type_src="statsgo.0.05" - -#------------------------------------- -# Set working directory and directory where output files will be saved. -#------------------------------------- - -export WORK_DIR=/lfs/h2/emc/stmp/$LOGNAME/work.sfc -export SAVE_DIR=/lfs/h2/emc/stmp/$LOGNAME/sfc.C${res} - -#------------------------------------- -# Should not have to touch anything below here. -#------------------------------------- - -if [[ $GRIDTYPE = "regional" ]]; then - HALO=$(( $HALO + 1 )) - export HALO - ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_FV3/C${res}_grid.tile7.nc - ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc -fi - -res2=${res//".mx"*} -export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc - -export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo - -ulimit -a -ulimit -s unlimited - -rm -fr $WORK_DIR $SAVE_DIR - -${BASE_DIR}/ush/sfc_climo_gen.sh +$PBS_O_WORKDIR/sfc_gen.sh exit diff --git a/util/sfc_climo_gen/sfc_gen.sh b/util/sfc_climo_gen/sfc_gen.sh new file mode 100755 index 000000000..00f5f07e1 --- /dev/null +++ b/util/sfc_climo_gen/sfc_gen.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# This script is run by the machine specific driver script. +# +# Set the following variables: +# +# res - Grid resolution. Example: 384 or 384.mx025. +# +# GRIDTYPE - set to 'regional' for regional grids. Otherwise, +# comment out. +# +# HALO - The number of halo rows/cols. Only for regional grids. +# Otherwise, comment out. +# +# WORK_DIR - Working directory. +# +# SAVE_DIR - Directory where the surface files will be saved. +# +# veg_type_src - Input vegetation type data. Choices are: +# For viirs-based vegetation type data, set to: +# - "viirs.igbp.0.1" for global 0.10-deg data +# - "viirs.igbp.0.05" for global 0.05-deg data +# - "viirs.igbp.0.03" for global 0.03-deg data +# - "viirs.igbp.conus.30s" for CONUS 30s data +# - "viirs.igbp.nh.30s" for NH 30s data +# - "viirs.igbp.30s" for global 30s data +# For the modis-based vegetation data, set to: +# - "modis.igbp.0.05" for global 0.05-deg data +# - "modis.igbp.0.03" for global 0.03-deg data +# - "modis.igbp.conus.30s" for CONUS 30s data +# - "modis.igbp.nh.30s" for NH 30s data +# - "modis.igbp.30s" for global 30s data +# +# soil_type_src - Input soil type data. Choices are: +# For STATSGO soil type data +# - "statsgo.0.05" for global 0.05-deg data +# - "statsgo.0.03" for global 0.03-deg data +# - "statsgo.conus.30s" for CONUS 30s data +# - "statsgo.nh.30s" for NH 30s data +# - "statsgo.30s" for global 30s data +# For Beijing Norm. Univ. soil type data +# - "bnu.30s" for global 30s data +#----------------------------------------------------------------------- + +#export res=384 +export res=384.mx025 + +##HALO=3 +##export GRIDTYPE=regional + +export veg_type_src="modis.igbp.0.05" + +export soil_type_src="statsgo.0.05" + +export WORK_DIR=/lfs/h2/emc/stmp/$LOGNAME/work.sfc +export SAVE_DIR=/lfs/h2/emc/stmp/$LOGNAME/sfc.C${res} + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +# Should not have to touch anything below here. +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ + +export FIX_FV3=${BASE_DIR}/fix/orog/C${res} + +if [[ $GRIDTYPE = "regional" ]]; then + HALO=$(( $HALO + 1 )) + export HALO + ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_FV3/C${res}_grid.tile7.nc + ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc +fi + +res2=${res//".mx"*} +export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc + +export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo + +ulimit -a +ulimit -s unlimited + +source ${BASE_DIR}/sorc/machine-setup.sh > /dev/null 2>&1 +module use ${BASE_DIR}/modulefiles +module load build.$target.intel +module list + +rm -fr $WORK_DIR $SAVE_DIR + +export APRUN + +${BASE_DIR}/ush/sfc_climo_gen.sh + +exit From a655a23a4c1d7e27ea7eba6ebcc6e122ad108e29 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Fri, 17 Mar 2023 21:18:41 +0000 Subject: [PATCH 4/9] Update Hera script to invoke sfc_gen.sh. Fixes #788. --- util/sfc_climo_gen/run.hera.sh | 91 ++-------------------------------- 1 file changed, 3 insertions(+), 88 deletions(-) diff --git a/util/sfc_climo_gen/run.hera.sh b/util/sfc_climo_gen/run.hera.sh index 25f539cf8..d2b13b12a 100755 --- a/util/sfc_climo_gen/run.hera.sh +++ b/util/sfc_climo_gen/run.hera.sh @@ -4,7 +4,8 @@ # Run the sfc_climo_gen program stand-alone on Hera using # pre-exiting 'grid' and 'orography files. # -# To run, type: 'sbatch $script' +# Set the configuration variables in sfc_gen.sh. Then +# run this script as follows: 'sbatch $script' #------------------------------------------------------------ #SBATCH -J sfc_climo_gen @@ -23,92 +24,6 @@ export APRUN_SFC="srun" export BASE_DIR=$SLURM_SUBMIT_DIR/../.. -source ${BASE_DIR}/sorc/machine-setup.sh > /dev/null 2>&1 -module use ${BASE_DIR}/modulefiles -module load build.$target.intel -module list - -#------------------------------------- -# Set model resolution. -#------------------------------------- - -export res=384 -#export res=384.mx025 - -#------------------------------------- -# Where the model "grid", "mosaic" and "oro" files reside. -#------------------------------------- - -export FIX_FV3=${BASE_DIR}/fix/orog/C${res} - -#------------------------------------- -# Uncomment for regional grids. -#------------------------------------- - -#HALO=3 -#export GRIDTYPE=regional - -#------------------------------------------------------------- -# Choose which soil type and vegetation type data to use. -# -# For viirs-based vegetation type data, set to: -# 1) "viirs.igbp.0.1" for global 0.10-deg data -# 2) "viirs.igbp.0.05" for global 0.05-deg data -# 3) "viirs.igbp.0.03" for global 0.03-deg data -# 4) "viirs.igbp.conus.30s" for CONUS 30s data -# 4) "viirs.igbp.nh.30s" for NH 30s data -# 4) "viirs.igbp.30s" for global 30s data -# -# For the modis-based vegetation data, set to: -# 1) "modis.igbp.0.05" for global 0.05-deg data -# 2) "modis.igbp.0.03" for global 0.03-deg data -# 3) "modis.igbp.conus.30s" for CONUS 30s data -# 4) "modis.igbp.nh.30s" for NH 30s data -# 5) "modis.igbp.30s" for global 30s data -# -# For STATSGO soil type data -# 1) "statsgo.0.05" for global 0.05-deg data -# 2) "statsgo.0.03" for global 0.03-deg data -# 3) "statsgo.conus.30s" for CONUS 30s data -# 4) "statsgo.nh.30s" for NH 30s data -# 5) "statsgo.30s" for global 30s data -# -# For Beijing Norm. Univ. soil type data -# 1) "bnu.30s" for global 30s data -#------------------------------------------------------------- - -export veg_type_src="modis.igbp.0.05" - -export soil_type_src="statsgo.0.05" - -#------------------------------------- -# Set working directory and directory where output files will be saved. -#------------------------------------- - -export WORK_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/work.sfc -export SAVE_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/sfc.C${res} - -#------------------------------------- -# Should not have to touch anything below here. -#------------------------------------- - -if [[ $GRIDTYPE = "regional" ]]; then - HALO=$(( $HALO + 1 )) - export HALO - ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_FV3/C${res}_grid.tile7.nc - ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc -fi - -res2=${res//".mx"*} -export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc - -export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo - -ulimit -a -ulimit -s unlimited - -rm -fr $WORK_DIR $SAVE_DIR - -${BASE_DIR}/ush/sfc_climo_gen.sh +$SLURM_SUBMIT_DIR/sfc_gen.sh exit From 5741d10422710e0f165cced276c829ce24a2e043 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 4 Apr 2023 09:39:36 -0500 Subject: [PATCH 5/9] Fix typo. Fixes #788. --- util/sfc_climo_gen/run.hera.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sfc_climo_gen/run.hera.sh b/util/sfc_climo_gen/run.hera.sh index d2b13b12a..bbaff54ec 100755 --- a/util/sfc_climo_gen/run.hera.sh +++ b/util/sfc_climo_gen/run.hera.sh @@ -2,7 +2,7 @@ #------------------------------------------------------------ # Run the sfc_climo_gen program stand-alone on Hera using -# pre-exiting 'grid' and 'orography files. +# pre-exiting 'grid' and 'orography' files. # # Set the configuration variables in sfc_gen.sh. Then # run this script as follows: 'sbatch $script' From f0353e56ecf4863d89adbcf456135f2738becff8 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Tue, 4 Apr 2023 10:31:23 -0500 Subject: [PATCH 6/9] Update comments. Fixes #788. --- util/sfc_climo_gen/readme.md | 3 ++- util/sfc_climo_gen/run.hera.sh | 3 ++- util/sfc_climo_gen/run.wcoss2.sh | 3 ++- util/sfc_climo_gen/sfc_gen.sh | 20 ++++++++++++++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/util/sfc_climo_gen/readme.md b/util/sfc_climo_gen/readme.md index ae9039b27..1606199f9 100644 --- a/util/sfc_climo_gen/readme.md +++ b/util/sfc_climo_gen/readme.md @@ -1,5 +1,6 @@ Run the sfc_climo_gen program stand-alone on WCOSS2 using -pre-exiting 'grid' and 'orography' files. +pre-exiting 'grid' and 'orography' files. See the +sfc_gen.sh script for details. Outputs surface fields such as soil and vegetation type. diff --git a/util/sfc_climo_gen/run.hera.sh b/util/sfc_climo_gen/run.hera.sh index bbaff54ec..697d0f350 100755 --- a/util/sfc_climo_gen/run.hera.sh +++ b/util/sfc_climo_gen/run.hera.sh @@ -2,7 +2,8 @@ #------------------------------------------------------------ # Run the sfc_climo_gen program stand-alone on Hera using -# pre-exiting 'grid' and 'orography' files. +# pre-exiting 'grid' and 'orography' files. See the +# sfc_gen.sh script for details. # # Set the configuration variables in sfc_gen.sh. Then # run this script as follows: 'sbatch $script' diff --git a/util/sfc_climo_gen/run.wcoss2.sh b/util/sfc_climo_gen/run.wcoss2.sh index fba3a815a..c7e76c85c 100755 --- a/util/sfc_climo_gen/run.wcoss2.sh +++ b/util/sfc_climo_gen/run.wcoss2.sh @@ -2,7 +2,8 @@ #------------------------------------------------------------ # Run the sfc_climo_gen program stand-alone on WCOSS2 using -# pre-exiting 'grid' and 'orography files. +# pre-exiting 'grid' and 'orography files. See the +# sfc_gen.sh script for details. # # Set the configuration variables in sfc_gen.sh. Then, # run this script as follows: 'qsub $script' diff --git a/util/sfc_climo_gen/sfc_gen.sh b/util/sfc_climo_gen/sfc_gen.sh index 00f5f07e1..1851710be 100755 --- a/util/sfc_climo_gen/sfc_gen.sh +++ b/util/sfc_climo_gen/sfc_gen.sh @@ -8,6 +8,22 @@ # # res - Grid resolution. Example: 384 or 384.mx025. # +# FIX_FV3 - Location of the pre-existing 'grid' and 'orography' +# files. Defaults to ${BASE_DIR}/fix/orog/C${res}, where +# BASE_DIR is the location of the checked out repository. +# +# The required files are: +# +# 'mosaic' file - C${res}_mosaic.nc (Note: 'res' without +# the 'mx' extension.) +# +# 'grid' files - C${res}_grid.tile7.halo${HALO}.nc (regional grids). +# C${res}_grid.tile[1-6].nc (global grids). +# Note: 'res' without the 'mx' extension. +# +# 'orog' files - C${res}_oro_data.tile7.halo${HALO}.nc (regional grids). +# C${res}_oro_data.tile[1-6].nc (global grids). +# # GRIDTYPE - set to 'regional' for regional grids. Otherwise, # comment out. # @@ -57,14 +73,14 @@ export soil_type_src="statsgo.0.05" export WORK_DIR=/lfs/h2/emc/stmp/$LOGNAME/work.sfc export SAVE_DIR=/lfs/h2/emc/stmp/$LOGNAME/sfc.C${res} +export FIX_FV3=${BASE_DIR}/fix/orog/C${res} + #------------------------------------------------------------------------ #------------------------------------------------------------------------ # Should not have to touch anything below here. #------------------------------------------------------------------------ #------------------------------------------------------------------------ -export FIX_FV3=${BASE_DIR}/fix/orog/C${res} - if [[ $GRIDTYPE = "regional" ]]; then HALO=$(( $HALO + 1 )) export HALO From 5baa903532a3e48cbdd88b851bd9083482f88530 Mon Sep 17 00:00:00 2001 From: "George.Gayno" Date: Tue, 4 Apr 2023 19:18:00 +0000 Subject: [PATCH 7/9] Update logic for regional grids. Create a local 'fixed' directory to store links to the input files using names that are recognized by the program. Previously, the code tried to create links in the official 'fixed' directory but most users won't have permissions to do that. Fixes #788. --- util/sfc_climo_gen/sfc_gen.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/util/sfc_climo_gen/sfc_gen.sh b/util/sfc_climo_gen/sfc_gen.sh index 1851710be..5853dba73 100755 --- a/util/sfc_climo_gen/sfc_gen.sh +++ b/util/sfc_climo_gen/sfc_gen.sh @@ -27,6 +27,9 @@ # GRIDTYPE - set to 'regional' for regional grids. Otherwise, # comment out. # +# FIX_REG - For regional grids. Hold links to the 'grid' and 'orog' files +# with names expected by the program. +# # HALO - The number of halo rows/cols. Only for regional grids. # Otherwise, comment out. # @@ -60,11 +63,14 @@ # - "bnu.30s" for global 30s data #----------------------------------------------------------------------- -#export res=384 -export res=384.mx025 +set -x + +#export res=96 +export res=96.mx100 -##HALO=3 -##export GRIDTYPE=regional +#HALO=4 +#export GRIDTYPE=regional +#FIX_REG=/lfs/h2/emc/stmp/$LOGNAME/fix.reg export veg_type_src="modis.igbp.0.05" @@ -81,16 +87,20 @@ export FIX_FV3=${BASE_DIR}/fix/orog/C${res} #------------------------------------------------------------------------ #------------------------------------------------------------------------ -if [[ $GRIDTYPE = "regional" ]]; then +if [[ "$GRIDTYPE" = "regional" ]]; then + mkdir -p $FIX_REG + ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_REG/C${res}_grid.tile7.halo${HALO}.nc + ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_REG/C${res}_oro_data.tile7.nc + ln -fs $FIX_FV3/C${res}_mosaic.nc $FIX_REG/C${res}_mosaic.nc + export mosaic_file=$FIX_REG/C${res}_mosaic.nc + export FIX_FV3=$FIX_REG HALO=$(( $HALO + 1 )) export HALO - ln -fs $FIX_FV3/C${res}_grid.tile7.halo${HALO}.nc $FIX_FV3/C${res}_grid.tile7.nc - ln -fs $FIX_FV3/C${res}_oro_data.tile7.halo${HALO}.nc $FIX_FV3/C${res}_oro_data.tile7.nc +else + res2=${res//".mx"*} + export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc fi -res2=${res//".mx"*} -export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc - export input_sfc_climo_dir=${BASE_DIR}/fix/sfc_climo ulimit -a From 4e2895da15a68bd57f9a63f1a4cc9f1dbd9f376a Mon Sep 17 00:00:00 2001 From: "George.Gayno" Date: Tue, 4 Apr 2023 19:22:30 +0000 Subject: [PATCH 8/9] Fix typo. Fixes #788. --- util/sfc_climo_gen/run.wcoss2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sfc_climo_gen/run.wcoss2.sh b/util/sfc_climo_gen/run.wcoss2.sh index c7e76c85c..0f2ed4fac 100755 --- a/util/sfc_climo_gen/run.wcoss2.sh +++ b/util/sfc_climo_gen/run.wcoss2.sh @@ -2,7 +2,7 @@ #------------------------------------------------------------ # Run the sfc_climo_gen program stand-alone on WCOSS2 using -# pre-exiting 'grid' and 'orography files. See the +# pre-exiting 'grid' and 'orography' files. See the # sfc_gen.sh script for details. # # Set the configuration variables in sfc_gen.sh. Then, From 619864d2e0e72f7b072462da5d6f35e4ad107b4e Mon Sep 17 00:00:00 2001 From: George Gayno Date: Thu, 6 Apr 2023 16:58:02 +0000 Subject: [PATCH 9/9] Add new namelist varaible - vegsoil_frac - to sfc_gen.sh Fixes #788. --- util/sfc_climo_gen/sfc_gen.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/sfc_climo_gen/sfc_gen.sh b/util/sfc_climo_gen/sfc_gen.sh index 5853dba73..9ba7b747c 100755 --- a/util/sfc_climo_gen/sfc_gen.sh +++ b/util/sfc_climo_gen/sfc_gen.sh @@ -61,6 +61,11 @@ # - "statsgo.30s" for global 30s data # For Beijing Norm. Univ. soil type data # - "bnu.30s" for global 30s data +# +# vegsoilt_frac - When .true., output the fraction of each +# vegetation and soil type and the dominant +# category. When .false., output dominant +# category only. #----------------------------------------------------------------------- set -x @@ -81,6 +86,8 @@ export SAVE_DIR=/lfs/h2/emc/stmp/$LOGNAME/sfc.C${res} export FIX_FV3=${BASE_DIR}/fix/orog/C${res} +export vegsoilt_frac=.true. + #------------------------------------------------------------------------ #------------------------------------------------------------------------ # Should not have to touch anything below here.