From 386ce380dd5c875155407d1c2f8841716c6af049 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 5 Sep 2024 14:24:02 -0400 Subject: [PATCH 1/5] fixes for UPP and compression in ufswm --- parm/config/gefs/config.base | 4 ---- parm/config/gefs/config.ufs | 21 ++++++++++++++++++++- parm/config/gfs/config.ufs | 19 +++++++++++++++++++ sorc/link_workflow.sh | 13 ++++++------- ush/forecast_predet.sh | 14 ++++++++++---- ush/parsing_model_configure_FV3.sh | 6 +++--- 6 files changed, 58 insertions(+), 19 deletions(-) diff --git a/parm/config/gefs/config.base b/parm/config/gefs/config.base index da8433c16d..47474fb108 100644 --- a/parm/config/gefs/config.base +++ b/parm/config/gefs/config.base @@ -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 diff --git a/parm/config/gefs/config.ufs b/parm/config/gefs/config.ufs index 584e4769a8..bfc11e3c5a 100644 --- a/parm/config/gefs/config.ufs +++ b/parm/config/gefs/config.ufs @@ -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") @@ -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 diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index 148793927f..b27845aec7 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -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") diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index d774c888b8..1b88bdd18c 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -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}" . @@ -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}" . diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 10581fc84a..dda0551164 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -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 } diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 63e6fdd436..8f102fe298 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -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)) From 78825c81c4ec1674f51d8c7ecbbb1c8b4734b357 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 5 Sep 2024 14:29:05 -0400 Subject: [PATCH 2/5] post tag name is incorrect --- ush/forecast_predet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index dda0551164..c089aeda58 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -538,7 +538,7 @@ FV3_predet(){ # Inline UPP fix files if [[ "${WRITE_DOPOST:-}" == ".true." ]]; then ${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 + ${NCP} "${PARMgfs}/ufs/post_itag_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" From 22b1e2fdf0bfa43bc5f21e70fc0e5bed10a23579 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 5 Sep 2024 14:35:16 -0400 Subject: [PATCH 3/5] fix shellnorm errors --- ush/forecast_predet.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index c089aeda58..365bebb973 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -542,10 +542,10 @@ FV3_predet(){ # 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" + ${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" + ${NCP} "${PARMgfs}/post/gefs/postxconfig-NT-gefs-f00.txt" "${DATA}/postxconfig-NT_FH00.txt" fi fi From 5accc45ee65aea6a27023f1c7b2eb58968d52c13 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 5 Sep 2024 14:36:33 -0400 Subject: [PATCH 4/5] Update ush/forecast_predet.sh Co-authored-by: David Huber <69919478+DavidHuber-NOAA@users.noreply.github.com> From 14c449c443f082bb61ec0d388200b7fe16125da4 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 5 Sep 2024 14:39:30 -0400 Subject: [PATCH 5/5] comment cleanup --- sorc/link_workflow.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 1b88bdd18c..92404afc01 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -213,10 +213,11 @@ declare -a ufs_templates=("model_configure.IN" "input_global_nest.nml.IN"\ "ufs.configure.s2swa_esmf.IN" \ "ufs.configure.leapfrog_atm_wav.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 + "post_itag_gfs" \ + "postxconfig-NT-gfs.txt" \ + "postxconfig-NT-gfs_FH00.txt") # TODO: The above postxconfig files in the UFSWM are not the same as the ones in UPP + # TODO: GEFS postxconfig files also need to be received from UFSWM # 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}"