Skip to content

Commit

Permalink
fixes for UPP and compression in ufswm
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Sep 5, 2024
1 parent 038ef7d commit 386ce38
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 19 deletions.
4 changes: 0 additions & 4 deletions parm/config/gefs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,6 @@ export OUTPUT_GRID="gaussian_grid"
export WRITE_DOPOST=".true." # WRITE_DOPOST=true, use inline POST
export WRITE_NSFLIP=".true."

# Override normal post flat files for GEFS
export FLTFILEGFS="${PARMgfs}/post/gefs/postxconfig-NT-gefs.txt"
export FLTFILEGFSF00="${PARMgfs}/post/gefs/postxconfig-NT-gefs-f00.txt"

# Microphysics Options: 99-ZhaoCarr, 8-Thompson; 6-WSM6, 10-MG, 11-GFDL
export imp_physics=8

Expand Down
21 changes: 20 additions & 1 deletion parm/config/gefs/config.ufs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,25 @@ export ntasks_fv3_gfs
export ntasks_quilt
export ntasks_quilt_gfs

# Determine whether to use compression in the write grid component based on resolution
case ${fv3_res} in
"C48" | "C96" | "C192" | "C384")
zstandard_level=0
ideflate=0
quantize_nsd=0
;;
"C768" | "C1152" | "C3072")
zstandard_level=0
ideflate=1
quantize_nsd=5
;;
*)
echo "FATAL ERROR: Unrecognized FV3 resolution ${fv3_res}"
exit 15
;;
esac
export zstandard_level ideflate quantize_nsd

# Determine whether to use parallel NetCDF based on resolution
case ${fv3_res} in
"C48" | "C96" | "C192" | "C384")
Expand Down Expand Up @@ -353,7 +372,7 @@ if [[ "${skip_mom6}" == "false" ]]; then
if [[ ${RUN} == "gfs" || "${RUN}" == "gefs" ]]; then
MOM6_DIAG_COORD_DEF_Z_FILE="interpolate_zgrid_40L.nc"
MOM6_DIAG_MISVAL="-1e34"
else
else
MOM6_DIAG_COORD_DEF_Z_FILE="oceanda_zgrid_75L.nc"
MOM6_DIAG_MISVAL="0.0"
fi
Expand Down
19 changes: 19 additions & 0 deletions parm/config/gfs/config.ufs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,25 @@ export ntasks_fv3_gfs
export ntasks_quilt_gdas
export ntasks_quilt_gfs

# Determine whether to use compression in the write grid component based on resolution
case ${fv3_res} in
"C48" | "C96" | "C192" | "C384")
zstandard_level=0
ideflate=0
quantize_nsd=0
;;
"C768" | "C1152" | "C3072")
zstandard_level=0
ideflate=1
quantize_nsd=5
;;
*)
echo "FATAL ERROR: Unrecognized FV3 resolution ${fv3_res}"
exit 15
;;
esac
export zstandard_level ideflate quantize_nsd

# Determine whether to use parallel NetCDF based on resolution
case ${fv3_res} in
"C48" | "C96" | "C192" | "C384")
Expand Down
13 changes: 6 additions & 7 deletions sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ for dir in gfs gefs
do
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/parm/${dir}" .
done
for file in optics_luts_DUST.dat optics_luts_DUST_nasa.dat optics_luts_NITR_nasa.dat \
optics_luts_SALT.dat optics_luts_SALT_nasa.dat optics_luts_SOOT.dat optics_luts_SOOT_nasa.dat \
optics_luts_SUSO.dat optics_luts_SUSO_nasa.dat optics_luts_WASO.dat optics_luts_WASO_nasa.dat
do
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/fix/chem/${file}" .
done
for file in ice.csv ocean.csv ocnicepost.nml.jinja2
do
${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/parm/ocnicepost/${file}" .
Expand Down Expand Up @@ -218,7 +212,12 @@ declare -a ufs_templates=("model_configure.IN" "input_global_nest.nml.IN"\
"ufs.configure.s2swa.IN" \
"ufs.configure.s2swa_esmf.IN" \
"ufs.configure.leapfrog_atm_wav.IN" \
"ufs.configure.leapfrog_atm_wav_esmf.IN" )
"ufs.configure.leapfrog_atm_wav_esmf.IN" \
"post_itag_gfs" \ # TODO: Need a GEFS version of this in the UFS-weather-model
"postxconfig-NT-gfs.txt" \ # TODO: Need a GEFS version of this in the UFS-weather-model
"postxconfig-NT-gfs_FH00.txt") # TODO: Need a GEFS version of this in the UFS-weather-model
# TODO: The above postxconfig files in the UFSWM are not the same as the ones in UPP
# See forecast_predet.sh where the UPP versions are used. They will need to be replaced with these.
for file in "${ufs_templates[@]}"; do
[[ -s "${file}" ]] && rm -f "${file}"
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/${file}" .
Expand Down
14 changes: 10 additions & 4 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,16 @@ FV3_predet(){

# Inline UPP fix files
if [[ "${WRITE_DOPOST:-}" == ".true." ]]; then
${NCP} "${PARMgfs}/post/post_tag_gfs${LEVS}" "${DATA}/itag"
${NCP} "${FLTFILEGFS:-${PARMgfs}/post/gfs/postxconfig-NT-gfs-two.txt}" "${DATA}/postxconfig-NT.txt"
${NCP} "${FLTFILEGFSF00:-${PARMgfs}/post/gfs/postxconfig-NT-gfs-f00-two.txt}" "${DATA}/postxconfig-NT_FH00.txt"
${NCP} "${POSTGRB2TBL:-${PARMgfs}/post/params_grib2_tbl_new}" "${DATA}/params_grib2_tbl_new"
${NCP} "${POSTGRB2TBL:-${PARMgfs}/post/params_grib2_tbl_new}" "${DATA}/params_grib2_tbl_new"
${NCP} "${PARMgfs}/ufs/post_tag_gfs" "${DATA}/itag" # TODO: Need a GEFS version when available in the UFS-weather-model
# TODO: These should be replaced with ones from the ufs-weather-model when available there
if [[ "${RUN}" =~ "gdas" || "${RUN}" =~ "gfs" ]]; then # RUN = gdas | enkfgdas | gfs | enkfgfs
${NCP} "${PARMgfs}/post/gfs/postxconfig-NT-gfs-two.txt" "${DATA}/postxconfig-NT.txt"
- ${NCP} "${PARMgfs}/post/gfs/postxconfig-NT-gfs-f00-two.txt" "${DATA}/postxconfig-NT_FH00.txt"
elif [[ "${RUN}" == "gefs" ]]; then # RUN = gefs
${NCP} "${PARMgfs}/post/gefs/postxconfig-NT-gefs.txt" "${DATA}/postxconfig-NT.txt"
- ${NCP} "${PARMgfs}/post/gefs/postxconfig-NT-gefs-f00.txt" "${DATA}/postxconfig-NT_FH00.txt"
fi
fi

}
Expand Down
6 changes: 3 additions & 3 deletions ush/parsing_model_configure_FV3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ local NUM_FILES=${NUM_FILES:-2}
local FILENAME_BASE="'atm' 'sfc'"
# OUTPUT_GRID
local OUTPUT_FILE="'${OUTPUT_FILETYPE_ATM}' '${OUTPUT_FILETYPE_SFC}'"
local ZSTANDARD_LEVEL=0
local IDEFLATE=0 # netCDF zlib lossless compression (0-9); 0: no compression
local QUANTIZE_NSD=${QUANTIZE_NSD:-0} # netCDF compression
local ZSTANDARD_LEVEL=${zstandard_level:-0}
local IDEFLATE=${ideflate:-0} # netCDF zlib lossless compression (0-9); 0: no compression
local QUANTIZE_NSD=${quantize_nsd:-0} # netCDF compression
local ICHUNK2D=$((4*restile))
local JCHUNK2D=$((2*restile))
local ICHUNK3D=$((4*restile))
Expand Down

0 comments on commit 386ce38

Please sign in to comment.