diff --git a/util/sfc_climo_gen/readme.md b/util/sfc_climo_gen/readme.md index 95745a1ec..1606199f9 100644 --- a/util/sfc_climo_gen/readme.md +++ b/util/sfc_climo_gen/readme.md @@ -1,4 +1,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. 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.hera.sh b/util/sfc_climo_gen/run.hera.sh new file mode 100755 index 000000000..697d0f350 --- /dev/null +++ b/util/sfc_climo_gen/run.hera.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +#------------------------------------------------------------ +# Run the sfc_climo_gen program stand-alone on Hera using +# 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' +#------------------------------------------------------------ + +#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/../.. + +$SLURM_SUBMIT_DIR/sfc_gen.sh + +exit diff --git a/util/sfc_climo_gen/run.wcoss2.sh b/util/sfc_climo_gen/run.wcoss2.sh index a96eceeec..ad767015d 100755 --- a/util/sfc_climo_gen/run.wcoss2.sh +++ b/util/sfc_climo_gen/run.wcoss2.sh @@ -2,9 +2,11 @@ #------------------------------------------------------------ # 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. # -# 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,94 +24,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 - -#------------------------------------- -# 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" - -export vegsoilt_frac='.false.' # When true, outputs percent of each - # soil and veg type category and a - # dominate category. When false, only - # outputs the dominate category. A - # Fortran logical, so include the dots. - -#------------------------------------- -# 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 - -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..9ba7b747c --- /dev/null +++ b/util/sfc_climo_gen/sfc_gen.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# This script is run by the machine specific driver script. +# +# Set the following variables: +# +# 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. +# +# 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. +# +# 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 +# +# 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 + +#export res=96 +export res=96.mx100 + +#HALO=4 +#export GRIDTYPE=regional +#FIX_REG=/lfs/h2/emc/stmp/$LOGNAME/fix.reg + +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} + +export FIX_FV3=${BASE_DIR}/fix/orog/C${res} + +export vegsoilt_frac=.true. + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +# Should not have to touch anything below here. +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ + +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 +else + res2=${res//".mx"*} + export mosaic_file=$FIX_FV3/C${res2}_mosaic.nc +fi + +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