diff --git a/parm/post/atm_post.yaml b/parm/post/atm_post.yaml index 08a07dc16f9..92cead37bb5 100644 --- a/parm/post/atm_post.yaml +++ b/parm/post/atm_post.yaml @@ -1,9 +1,9 @@ -work_dir: !ENV ${DATA} +work_dir: !ENV ${DATA}/atm tmpl_file: !ENV ${PARMpost}/post.nml.j2 mp_file: !ENV ${PARMpost}/nam_micro_lookup.dat grib_out: !ENV ${COMOUT}/${RUN}.${cycle}.master.grb2f${fhr} grib_idx_out: !ENV ${COMOUT}/${RUN}.${cycle}.master.grb2if${fhr} -exe_log_file: !ENV ${pgmout} +exe_log_file: !ENV ${DATA}/${pgmout} out_form: 'netcdfpara' cdate: !ENV ${CDATE} fhr: !ENV ${fhr} diff --git a/parm/post/atm_post_gfs_anl.yaml b/parm/post/atm_post_anl.yaml similarity index 90% rename from parm/post/atm_post_gfs_anl.yaml rename to parm/post/atm_post_anl.yaml index aec361eea86..2f919880eda 100644 --- a/parm/post/atm_post_gfs_anl.yaml +++ b/parm/post/atm_post_anl.yaml @@ -7,7 +7,6 @@ trigger_file: !ENV ${COMIN}/${RUN}.${cycle}.atmanl.nc igen: anal_gfs flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS-ANL.txt -ctrl_file: !ENV ${PARMpost}/postcntrl_gfs_anl.xml grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new dbn_signals: diff --git a/parm/post/atm_post_gfs_f000.yaml b/parm/post/atm_post_f000.yaml similarity index 65% rename from parm/post/atm_post_gfs_f000.yaml rename to parm/post/atm_post_f000.yaml index cd93113931f..b3efc8c4373 100644 --- a/parm/post/atm_post_gfs_f000.yaml +++ b/parm/post/atm_post_f000.yaml @@ -7,9 +7,4 @@ trigger_file: !ENV ${COMIN}/${CDUMP}.t${cyc}z.logf000.txt igen: gfs_avn flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS-F00.txt -ctrl_file: !ENV ${PARMpost}/postcntrl_gfs_f00.xml grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new - -dbn_signals: - GFS_SA: !ENV ${COMIN}/${RUN}.${cycle}.atmf000.nc - GFS_MSC_sfcanal: !ENV ${COMIN}/${RUN}.${cycle}.sfcf000.nc \ No newline at end of file diff --git a/parm/post/atm_post_gfs_fhr.yaml b/parm/post/atm_post_fhr.yaml similarity index 72% rename from parm/post/atm_post_gfs_fhr.yaml rename to parm/post/atm_post_fhr.yaml index c72886c8b8f..4993f839e5f 100644 --- a/parm/post/atm_post_gfs_fhr.yaml +++ b/parm/post/atm_post_fhr.yaml @@ -7,5 +7,4 @@ trigger_file: !ENV ${COMIN}/${CDUMP}.t${cyc}z.logf${fhr}.txt igen: gfs_avn flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS.txt -ctrl_file: !ENV ${PARMpost}/postcntrl_gfs.xml -grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new \ No newline at end of file +grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new diff --git a/parm/post/sflux_post.yaml b/parm/post/sflux_post.yaml new file mode 100644 index 00000000000..dd51cad2ff6 --- /dev/null +++ b/parm/post/sflux_post.yaml @@ -0,0 +1,20 @@ +work_dir: !ENV ${DATA}/sflux +tmpl_file: !ENV ${PARMpost}/post.nml.j2 +mp_file: !ENV ${PARMpost}/nam_micro_lookup.dat +grib_out: !ENV ${COMOUT}/${RUN}.${cycle}.sfluxgrbf${fhr}.grb2 +grib_idx_out: !ENV ${COMOUT}/${RUN}.${cycle}.sfluxgrbf${fhr}.grb2.idx +exe_log_file: !ENV ${pgmout} +out_form: 'netcdfpara' +cdate: !ENV ${CDATE} +fhr: !ENV ${fhr} +grib_version: 'grib2' +grib_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new +post_variables: 'KPO=57,PO=1000.,975.,950.,925.,900.,875.,850.,825.,800.,775.,750.,725.,700.,675.,650.,625.,600.,575.,550.,525.,500.,475.,450.,425.,400.,375.,350.,325.,300.,275.,250.,225.,200.,175.,150.,125.,100.,70.,50.,40.,30.,20.,15.,10.,7.,5.,3.,2.,1.,0.7,0.4,0.2,0.1,0.07,0.04,0.02,0.01,' +post_exe: !ENV ${HOMEgfs}/exec/upp.x +grib_idx_exe: !ENV ${GRB2INDEX} +mpi_run: !ENV ${APRUNP} +sleep_max: 900 +sleep_interval: 5 +send_com: !ENV ${SENDCOM} +send_dbn: !ENV ${SENDDBN} +dbn_alert: !ENV ${DBNROOT}/bin/dbn_alert diff --git a/parm/post/sflux_post_anl.yaml b/parm/post/sflux_post_anl.yaml new file mode 100644 index 00000000000..3dcc5a26f22 --- /dev/null +++ b/parm/post/sflux_post_anl.yaml @@ -0,0 +1,10 @@ +include: + - !INC ${PARMpost}/sflux_post.yaml + +atm_file: !ENV ${COMIN}/${RUN}.${cycle}.atmanl.nc +sfc_file: !ENV ${COMIN}/${RUN}.${cycle}.sfcanl.nc +trigger_file: !ENV ${COMIN}/${RUN}.${cycle}.atmanl.nc + +igen: anal_gfs +flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS-FLUX-ANL.txt +grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new diff --git a/parm/post/sflux_post_f000.yaml b/parm/post/sflux_post_f000.yaml new file mode 100644 index 00000000000..2c5b1c4093f --- /dev/null +++ b/parm/post/sflux_post_f000.yaml @@ -0,0 +1,14 @@ +include: + - !INC ${PARMpost}/sflux_post.yaml + +atm_file: !ENV ${COMIN}/${RUN}.${cycle}.atmf000.nc +sfc_file: !ENV ${COMIN}/${RUN}.${cycle}.sfcf000.nc +trigger_file: !ENV ${COMIN}/${CDUMP}.t${cyc}z.logf000.txt + +igen: gfs_avn +flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS-FLUX-F00.txt +grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new + +dbn_signals: + GFS_SGB_GB2: $(include[0].grib_out) + GFS_SGB_GB2_WIDX: $(include[0].grib_idx_out) diff --git a/parm/post/sflux_post_fhr.yaml b/parm/post/sflux_post_fhr.yaml new file mode 100644 index 00000000000..beb76dfcb6e --- /dev/null +++ b/parm/post/sflux_post_fhr.yaml @@ -0,0 +1,14 @@ +include: + - !INC ${PARMpost}/sflux_post.yaml + +atm_file: !ENV ${COMIN}/${RUN}.${cycle}.atmf${fhr}.nc +sfc_file: !ENV ${COMIN}/${RUN}.${cycle}.sfcf${fhr}.nc +trigger_file: !ENV ${COMIN}/${CDUMP}.t${cyc}z.logf${fhr}.txt + +igen: gfs_avn +flat_file: !ENV ${PARMpost}/postxconfig-NT-GFS-FLUX.txt +grib2_table: !ENV ${g2tmpl_ROOT}/share/params_grib2_tbl_new + +dbn_signals: + GFS_SGB_GB2: !ENV ${COMOUT}/${RUN}.${cycle}.sfluxgrbf${fhr}.grb2 + GFS_SGB_GB2_WIDX: !ENV ${COMOUT}/${RUN}.${cycle}.sfluxgrbf${fhr}.grb2.idx diff --git a/scripts/exglobal_atmos_post.sh b/scripts/exglobal_atmos_post.sh index 1d610ac7073..97e103d3694 100755 --- a/scripts/exglobal_atmos_post.sh +++ b/scripts/exglobal_atmos_post.sh @@ -2,16 +2,22 @@ source "${HOMEgfs}/ush/preamble.sh" -# Determine which yaml file to use -case ${fhr} in - anl) yaml_cat='anl' ;; - 000) yaml_cat='f000';; - *) yaml_cat='fhr' ;; -esac -post_settings="${PARMpost}/atm_post_${CDUMP}_${yaml_cat}.yaml" +for type in "atm" "sflux"; do + # Determine which yaml file to use + case ${fhr} in + anl) yaml_cat='anl' ;; + 000) yaml_cat='f000';; + *) yaml_cat='fhr' ;; + esac + post_settings="${PARMpost}/${type}_post_${yaml_cat}.yaml" -# Run post -"${HOMEgfs}/ush/atm_post.py" "${post_settings}" -err=$? + # Run post + "${HOMEgfs}/ush/atm_post.py" "${post_settings}" + err=$? -exit ${err} + if ((err > 0)); then + exit "${err}" + fi +done + +exit diff --git a/ush/atm_post.py b/ush/atm_post.py index d0cda7070f6..b3afbba3c8c 100755 --- a/ush/atm_post.py +++ b/ush/atm_post.py @@ -2,14 +2,13 @@ import os import shutil -import glob import subprocess import time from datetime import timedelta from argparse import ArgumentParser from python.pygw.src.pygw import timetools from python.pygw.src.pygw.template import Template, TemplateConstants -from python.pygw.src.pygw.fsutils import mkdir, chdir, rm_p +from python.pygw.src.pygw.fsutils import mkdir from python.pygw.src.pygw.yaml_file import YAMLFile from pprint import pprint from functools import partial @@ -61,7 +60,7 @@ def run_post(settings: dict) -> None: ''' ) os.environ['PGBOUT'] = 'pgbfile' - subprocess.run(f"{settings['mpi_run']} upp.x > {settings['exe_log_file']}", shell=True, check=True) + subprocess.run(f"{settings['mpi_run']} upp.x >> {settings['exe_log_file']}", shell=True, check=True) subprocess.run(f"{settings['grib_idx_exe']} pgbfile pgifile >> {settings['exe_log_file']}", shell=True, check=True) @@ -171,21 +170,21 @@ def stage_post(settings: dict, nml_filename: str = 'itag') -> None: work_dir : str The temporary working directory to use atm_file : str - Raw atmosphere model output in NetCDF format. Will be copied + Raw atmosphere model output in NetCDF format. Will be linked to work_dir as atm_file. sfc_file : str - Raw atmosphere flux output in NetCDF format. Will be copied + Raw atmosphere flux output in NetCDF format. Will be linked to work_dir as sfc_file. flat_file : str - Post 'flat' file. Will be copied to work_dir as + Post 'flat' file. Will be linked to work_dir as postxconfig-NT.txt. grib_table : str - Grib2 table. Will be copied to work_dir. + Grib2 table. Will be linked to work_dir. mp_file : str - Microphysics .dat file. Will be copied to work_dir as + Microphysics .dat file. Will be linked to work_dir as eta_micro_lookup.dat. post_exe : str - Path to the post executable. Will be copied to work_dir as + Path to the post executable. Will be linked to work_dir as upp.x Additionally, the following key/value pair may be defined: @@ -199,18 +198,18 @@ def stage_post(settings: dict, nml_filename: str = 'itag') -> None: ''' work_dir = settings['work_dir'] mkdir(work_dir) - chdir(work_dir) + os.chdir(work_dir) namelist = make_namelist(settings) with open(nml_filename, 'w') as file: file.write(namelist) - shutil.copy(settings['flat_file'], 'postxconfig-NT.txt') - shutil.copy(settings['grib_table'], './') - shutil.copy(settings['mp_file'], 'eta_micro_lookup.dat') - shutil.copy(settings['atm_file'], 'atm_file') - shutil.copy(settings['sfc_file'], 'sfc_file') - shutil.copy(settings['post_exe'], 'upp.x') + os.symlink(settings['flat_file'], 'postxconfig-NT.txt') + os.symlink(settings['grib_table'], os.path.basename(settings['grib_table'])) + os.symlink(settings['mp_file'], 'eta_micro_lookup.dat') + os.symlink(settings['atm_file'], 'atm_file') + os.symlink(settings['sfc_file'], 'sfc_file') + os.symlink(settings['post_exe'], 'upp.x') if settings.get('is_ens', False): # TODO replace negatively_post_fcst with ${ens_pert_type} in postxconfig-NT.txt @@ -293,6 +292,7 @@ def send_dbn(settings: dict) -> None: stage_post(settings=settings) wait_for_model_output(settings=settings) run_post(settings=settings) + if settings['send_com'] in ["YES"]: send_com(settings)