diff --git a/jobs/JGLOBAL_ARCHIVE b/jobs/JGLOBAL_ARCHIVE index 401feba35f..e094516489 100755 --- a/jobs/JGLOBAL_ARCHIVE +++ b/jobs/JGLOBAL_ARCHIVE @@ -3,6 +3,11 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "arch" -c "base arch" +############################################################### +#select the correct domain.grid for gridded data +source "${USHgfs}/wave_domain_grid.sh" +process_grdID "${waveGRD}" +############################################################### ############################################## # Set variables used in the script @@ -49,7 +54,6 @@ for grid in "0p25" "0p50" "1p00"; do YMD=${PDY} HH=${cyc} GRID=${grid} declare_from_tmpl -rx \ "COMIN_ATMOS_GRIB_${grid}:COM_ATMOS_GRIB_GRID_TMPL" done - ############################################################### # Run archive script ############################################################### @@ -68,8 +72,6 @@ status=$? if [[ -e "${pgmout}" ]] ; then cat "${pgmout}" fi - - ########################################## # Remove the Temporary working directory ########################################## diff --git a/parm/archive/gefs_extracted_wave.yaml.j2 b/parm/archive/gefs_extracted_wave.yaml.j2 index e0aa07c816..402e27f2bf 100644 --- a/parm/archive/gefs_extracted_wave.yaml.j2 +++ b/parm/archive/gefs_extracted_wave.yaml.j2 @@ -13,8 +13,6 @@ gefs_wave: {% set ofst_hr = FHMIN_GFS %} {% endif %} -{% set res = (waveGRD[-3:])[0] ~ "p" ~ (waveGRD[-3:])[-2:] %} - #select mem%03d and ensstat files required {% set members = [] %} {% for mem_nm in range(0, NMEM_ENS + 1) %} @@ -27,17 +25,6 @@ gefs_wave: '${YMD}':cycle_YMD, '${HH}':cycle_HH, '${MEMDIR}':mem }) %} - - {% set COMIN_WAVE_GRID = COM_WAVE_GRID_TMPL | replace_tmpl(tmpl_dict) %} - # Select grib2 files to copy to the atardir - {% if path_exists(COMIN_WAVE_GRID) %} - {% for fhr in range(ofst_hr, FHMAX_GFS + FHOUT_WAV, FHOUT_WAV) %} - {% set file_name = head ~ "global." ~ res ~ ".f" ~ '%03d'|format(fhr) ~ ".grib2" %} - {% set file_path = COMIN_WAVE_GRID ~ "/" ~ file_name %} - - "{{ file_path | relpath(ROTDIR)}}" - {% endfor %} - {% endif %} - {% set COMIN_WAVE_STATION = COM_WAVE_STATION_TMPL | replace_tmpl(tmpl_dict) %} # Select station files to copy to the atardir {% if path_exists(COMIN_WAVE_STATION) %} @@ -48,4 +35,14 @@ gefs_wave: {% set file_path = COMIN_WAVE_STATION ~ "/" ~ RUN ~ "wave.t" ~ cycle_HH ~ "z.bull_tar" %} - "{{ file_path | relpath(ROTDIR)}}" {% endif %} + + {% set COMIN_WAVE_GRID = COM_WAVE_GRID_TMPL | replace_tmpl(tmpl_dict) %} + # Select grib2 files to copy to the atardir + {% if path_exists(COMIN_WAVE_GRID) %} + {% for fhr in range(ofst_hr, FHMAX_GFS + FHOUT_WAV, FHOUT_WAV) %} + {% set file_name = head ~ grdNAME ~ ".f" ~ '%03d'|format(fhr) ~ ".grib2" %} + {% set file_path = COMIN_WAVE_GRID ~ "/" ~ grdNAME ~ "/" ~ file_name %} + - "{{ file_path | relpath(ROTDIR)}}" + {% endfor %} + {% endif %} {% endfor %} diff --git a/parm/archive/gfswave.yaml.j2 b/parm/archive/gfswave.yaml.j2 index 6909421757..83d18e0d21 100644 --- a/parm/archive/gfswave.yaml.j2 +++ b/parm/archive/gfswave.yaml.j2 @@ -4,17 +4,19 @@ gfswave: target: "{{ ATARDIR }}/{{ cycle_YMDH }}/gfswave.tar" required: # Wave GRIB2 regional forecast products + {% set file_path = COMIN_WAVE_GRID ~ "/" ~ grdNAME %} + {% for fh in range(0, FHMAX_HF_WAV + FHOUT_HF_WAV, FHOUT_HF_WAV) %} # NOTE This is as explicit as possible without major logic to parse wavepostGRD. # Matches files of the form "gfswave.tCCz...fHHH.grib2". - - "{{ COMIN_WAVE_GRID | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2" - - "{{ COMIN_WAVE_GRID | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2.idx" + - "{{ file_path | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2" + - "{{ file_path | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2.idx" {% endfor %} # Global wave GRIB2 forecast products {% for fh in range(FHMAX_HF_WAV + FHOUT_WAV, FHMAX_WAV_GFS + FHOUT_WAV, FHOUT_WAV) %} - - "{{ COMIN_WAVE_GRID | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2" - - "{{ COMIN_WAVE_GRID | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2.idx" + - "{{ file_path | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2" + - "{{ file_path | relpath(ROTDIR) }}/{{ head }}*.*.f{{ '%03d' % fh }}.grib2.idx" {% endfor %} # Wave bulletins diff --git a/scripts/exgfs_wave_post_gridded_sbs.sh b/scripts/exgfs_wave_post_gridded_sbs.sh index a241a00d88..277cee33cf 100755 --- a/scripts/exgfs_wave_post_gridded_sbs.sh +++ b/scripts/exgfs_wave_post_gridded_sbs.sh @@ -261,20 +261,8 @@ source "${USHgfs}/preamble.sh" if [ "$DOGRB_WAV" = 'YES' ] then gribFL=\'$(echo ${OUTPARS_WAV})\' - case $grdID in - glo_15mxt) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - reg025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - glo_025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - glo_100) GRDNAME='global' ; GRDRES=1p00 ; GRIDNR=255 ; MODNR=11 ;; - glo_200) GRDNAME='global' ; GRDRES=2p00 ; GRIDNR=255 ; MODNR=11 ;; - glo_500) GRDNAME='global' ; GRDRES=5p00 ; GRIDNR=255 ; MODNR=11 ;; - glo_30mxt) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=11 ;; - glo_30m) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=11 ;; - at_10m) GRDNAME='atlocn' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - ep_10m) GRDNAME='epacif' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - wc_10m) GRDNAME='wcoast' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - ak_10m) GRDNAME='alaska' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - esac + source "${USHgfs}/wave_domain_grid.sh" + process_grdID "${grdID}" echo "${USHgfs}/wave_grib2_sbs.sh $grdID $GRIDNR $MODNR $ymdh $fhr $GRDNAME $GRDRES $gribFL > grib_$grdID.out 2>&1" >> ${fcmdigrd}.${nigrd} fi echo "${GRIBDATA}/${fcmdigrd}.${nigrd}" >> ${fcmdnow} @@ -288,23 +276,8 @@ source "${USHgfs}/preamble.sh" for grdID in ${wavepostGRD} # First concatenate grib files for sbs grids do gribFL=\'$(echo ${OUTPARS_WAV})\' - case $grdID in - aoc_9km) GRDNAME='arctic' ; GRDRES=9km ; GRIDNR=255 ; MODNR=11 ;; - ant_9km) GRDNAME='antarc' ; GRDRES=9km ; GRIDNR=255 ; MODNR=11 ;; - glo_10m) GRDNAME='global' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - gnh_10m) GRDNAME='global' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; - gsh_15m) GRDNAME='gsouth' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - glo_15m) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - ao_20m) GRDNAME='arctic' ; GRDRES=0p33 ; GRIDNR=255 ; MODNR=11 ;; - so_20m) GRDNAME='antarc' ; GRDRES=0p33 ; GRIDNR=255 ; MODNR=11 ;; - glo_15mxt) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - reg025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - glo_025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; - glo_100) GRDNAME='global' ; GRDRES=1p00 ; GRIDNR=255 ; MODNR=11 ;; - glo_200) GRDNAME='global' ; GRDRES=2p00 ; GRIDNR=255 ; MODNR=11 ;; - glo_500) GRDNAME='global' ; GRDRES=5p00 ; GRIDNR=255 ; MODNR=11 ;; - gwes_30m) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=10 ;; - esac + source "${USHgfs}/wave_domain_grid.sh" + process_grdID "${grdID}" echo "${USHgfs}/wave_grib2_sbs.sh $grdID $GRIDNR $MODNR $ymdh $fhr $GRDNAME $GRDRES $gribFL > grib_$grdID.out 2>&1" >> ${fcmdnow} done fi @@ -379,15 +352,21 @@ source "${USHgfs}/preamble.sh" rm -f out_grd.* # Remove large binary grid output files cd $DATA - - - if [ "$fhr" = "$fhrg" ] - then + + if [ "$fhr" = "$fhrg" ]; then # Check if grib2 file created ENSTAG="" if [ ${waveMEMB} ]; then ENSTAG=".${membTAG}${waveMEMB}" ; fi gribchk="${RUN}wave.${cycle}${ENSTAG}.${GRDNAME}.${GRDRES}.f${FH3}.grib2" - if [ ! -s ${COMOUT_WAVE_GRID}/${gribchk} ]; then + gribchk_idx="${RUN}wave.${cycle}${ENSTAG}.${GRDNAME}.${GRDRES}.f${FH3}.grib2.idx" + if [[ ! -d "${COMOUT_WAVE_GRID}/${GRDNAME}.${GRDRES}" ]]; then + mkdir -m 775 -p "${COMOUT_WAVE_GRID}/${GRDNAME}.${GRDRES}" + fi +# move grib2 files to domain.dimension + if [[ -s "${COMOUT_WAVE_GRID}/${gribchk}" && -s "${COMOUT_WAVE_GRID}/${gribchk_idx}" ]]; then + mv -f "${COMOUT_WAVE_GRID}/${gribchk}" "${COMOUT_WAVE_GRID}/${GRDNAME}.${GRDRES}" + mv -f "${COMOUT_WAVE_GRID}/${gribchk_idx}" "${COMOUT_WAVE_GRID}/${GRDNAME}.${GRDRES}" + else set +x echo ' ' echo '********************************************' diff --git a/scripts/exgfs_wave_prdgen_gridded.sh b/scripts/exgfs_wave_prdgen_gridded.sh index 9111c81273..960b27b552 100755 --- a/scripts/exgfs_wave_prdgen_gridded.sh +++ b/scripts/exgfs_wave_prdgen_gridded.sh @@ -9,7 +9,7 @@ # - Supplemental error output is witten to the wave.log file. # # # # COM inputs: # -# - ${COMIN_WAVE_GRID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2 # +# - ${COMIN_WAVE_GRID}/${grdID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2 # # # # COM outputs: # # - ${COMOUT_WAVE_WMO}/grib2.${cycle}.f${fhr}.awipsww3_${grdOut} # @@ -89,7 +89,7 @@ grids=${grids:-ak_10m at_10m ep_10m wc_10m glo_30m} fhr=$(printf "%03d" $fhcnt) for grdOut in $grids;do case $grdOut in - ao_9km) grdID='arctic.9km' ;; + aoc_9km) grdID='arctic.9km' ;; at_10m) grdID='atlocn.0p16' ;; ep_10m) grdID='epacif.0p16' ;; wc_10m) grdID='wcoast.0p16' ;; @@ -100,7 +100,7 @@ grids=${grids:-ak_10m at_10m ep_10m wc_10m glo_30m} esac # - GRIBIN="${COM_WAVE_GRID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2" + GRIBIN="${COM_WAVE_GRID}/${grdID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2" GRIBIN_chk="${GRIBIN}.idx" sleep_interval=5 max_tries=1000 diff --git a/scripts/exglobal_archive.py b/scripts/exglobal_archive.py index ae613fb39c..c16e5e3b9c 100755 --- a/scripts/exglobal_archive.py +++ b/scripts/exglobal_archive.py @@ -40,7 +40,7 @@ def main(): 'NMEM_ENS', 'DO_JEDIATMVAR', 'DO_VRFY_OCEANDA', 'FHMAX_FITS', 'waveGRD', 'IAUFHRS', 'DO_FIT2OBS', 'NET', 'FHOUT_HF_GFS', 'FHMAX_HF_GFS', 'REPLAY_ICS', 'OFFSET_START_HOUR', 'ARCH_EXPDIR', 'EXPDIR', 'ARCH_EXPDIR_FREQ', 'ARCH_HASHES', - 'ARCH_DIFFS', 'SDATE', 'EDATE', 'HOMEgfs'] + 'ARCH_DIFFS', 'SDATE', 'EDATE', 'HOMEgfs', 'grdNAME'] archive_dict = AttrDict() for key in keys: diff --git a/ush/wave_domain_grid.sh b/ush/wave_domain_grid.sh new file mode 100644 index 0000000000..0912718695 --- /dev/null +++ b/ush/wave_domain_grid.sh @@ -0,0 +1,42 @@ +#! /usr/bin/env bash + +################################################################################ +## UNIX Script Documentation Block +## Script name: wave_domain_grid.sh +## Script description: provides the wave grid specific values that +## are needed for the wave related jobs +####################### +# Main body starts here +####################### + +process_grdID() { + grdID=$1 + case ${grdID} in + glo_10m) GRDNAME='global' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + glo_15mxt) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; + glo_30mxt) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=11 ;; + glo_30m) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=11 ;; + glo_025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; + glo_100) GRDNAME='global' ; GRDRES=1p00 ; GRIDNR=255 ; MODNR=11 ;; + glo_200) GRDNAME='global' ; GRDRES=2p00 ; GRIDNR=255 ; MODNR=11 ;; + glo_500) GRDNAME='global' ; GRDRES=5p00 ; GRIDNR=255 ; MODNR=11 ;; + at_10m) GRDNAME='atlocn' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + ep_10m) GRDNAME='epacif' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + wc_10m) GRDNAME='wcoast' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + ak_10m) GRDNAME='alaska' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + aoc_9km) GRDNAME='arctic' ; GRDRES=9km ; GRIDNR=255 ; MODNR=11 ;; + ant_9km) GRDNAME='antarc' ; GRDRES=9km ; GRIDNR=255 ; MODNR=11 ;; + gnh_10m) GRDNAME='global' ; GRDRES=0p16 ; GRIDNR=255 ; MODNR=11 ;; + gsh_15m) GRDNAME='gsouth' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; + ao_20m) GRDNAME='arctic' ; GRDRES=0p33 ; GRIDNR=255 ; MODNR=11 ;; + so_20m) GRDNAME='antarc' ; GRDRES=0p33 ; GRIDNR=255 ; MODNR=11 ;; + reg025) GRDNAME='global' ; GRDRES=0p25 ; GRIDNR=255 ; MODNR=11 ;; + gwes_30m) GRDNAME='global' ; GRDRES=0p50 ; GRIDNR=255 ; MODNR=10 ;; + *) + echo "FATAL ERROR: No grid specific wave config values exist for ${grdID}. Aborting." + exit 1 ;; + esac + export grdNAME="${GRDNAME}.${GRDRES}" + echo "GRIDNR=${GRIDNR}" + echo "MODNR=${MODNR}" +} diff --git a/ush/wave_extractvars.sh b/ush/wave_extractvars.sh index 32ee44986b..46c23b85db 100755 --- a/ush/wave_extractvars.sh +++ b/ush/wave_extractvars.sh @@ -13,13 +13,16 @@ source "${USHgfs}/preamble.sh" subdata=${1} +source "${USHgfs}/wave_domain_grid.sh" +process_grdID "${waveGRD}" + [[ -d "${subdata}" ]] || mkdir -p "${subdata}" for (( nh = FHOUT_WAV_EXTRACT; nh <= FHMAX_WAV; nh = nh + FHOUT_WAV_EXTRACT )); do fnh=$(printf "%3.3d" "${nh}") - infile=${COMIN_WAVE_GRID}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2 - outfile=${subdata}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2 + infile="${COMIN_WAVE_GRID}/${grdNAME}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2" + outfile="${subdata}/${RUN}wave.t${cyc}z.global.${wavres}.f${fnh}.grib2" rm -f "${outfile}" # Remove outfile if it already exists before extraction if [[ -f "${infile}" ]]; then # Check if input file exists before extraction