Skip to content

Commit

Permalink
Remove forecast hour loops
Browse files Browse the repository at this point in the history
  • Loading branch information
GwenChen-NOAA committed Jun 27, 2024
1 parent 3b3387d commit dbb96b0
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 65 deletions.
4 changes: 2 additions & 2 deletions ecf/scripts/gdas/atmos/gempak/jgdas_atmos_gempak.ecf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#PBS -S /bin/bash
#PBS -N %RUN%_atmos_gempak_%FCSTHR%_%CYC%
#PBS -N %RUN%_atmos_gempak_%FHR3%_%CYC%
#PBS -j oe
#PBS -q %QUEUE%
#PBS -A %PROJ%-%PROJENVIR%
Expand Down Expand Up @@ -37,7 +37,7 @@ module list
export cyc=%CYC%
export cycle=t%CYC%z
export USE_CFP=YES
export FHRGRP=%FHRGRP% FHRLST=%FHRLST% FCSTHR=%FCSTHR% TRDRUN=%TRDRUN% fcsthrs=%FCSTHR%
export FHR3=%FHR3% fcsthrs=%FHR3%

############################################################
# CALL executable job script here
Expand Down
4 changes: 2 additions & 2 deletions ecf/scripts/gfs/atmos/gempak/jgfs_atmos_gempak.ecf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#PBS -S /bin/bash
#PBS -N %RUN%_atmos_gempak_%FCSTHR%_%CYC%
#PBS -N %RUN%_atmos_gempak_%FHR3%_%CYC%
#PBS -j oe
#PBS -q %QUEUE%
#PBS -A %PROJ%-%PROJENVIR%
Expand Down Expand Up @@ -37,7 +37,7 @@ module list
#############################################################
export cyc=%CYC%
export cycle=t%CYC%z
export FHRGRP=%FHRGRP% FHRLST=%FHRLST% FCSTHR=%FCSTHR% TRDRUN=%TRDRUN% fcsthrs=%FCSTHR%
export FHR3=%FHR3% fcsthrs=%FHR3%

############################################################
# CALL executable job script here
Expand Down
4 changes: 2 additions & 2 deletions ecf/scripts/gfs/atmos/gempak/jgfs_atmos_pgrb2_spec_gempak.ecf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#PBS -S /bin/bash
#PBS -N %RUN%_atmos_pgrb2_spec_gempak_%FCSTHR%_%CYC%
#PBS -N %RUN%_atmos_pgrb2_spec_gempak_%FHR3%_%CYC%
#PBS -j oe
#PBS -q %QUEUE%
#PBS -A %PROJ%-%PROJENVIR%
Expand Down Expand Up @@ -35,7 +35,7 @@ module list
#############################################################
export cyc=%CYC%
export cycle=t%CYC%z
export FHRGRP=%FHRGRP% FHRLST=%FHRLST% FCSTHR=%FCSTHR% TRDRUN=%TRDRUN% fcsthrs=%FCSTHR%
export FHR3=%FHR3% fcsthrs=%FHR3%

############################################################
# CALL executable job script here
Expand Down
21 changes: 9 additions & 12 deletions jobs/rocoto/gempak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/load_fv3gfs_modules.sh"
status=$?
(( status != 0 )) && exit "${status}"
if (( status != 0 )); then exit "${status}"; fi

export job="gempak"
export jobid="${job}.$$"

source "${HOMEgfs}/ush/jjob_header.sh" -e "gempak" -c "base gempak"

# shellcheck disable=SC2153
fhrlst=$(echo "${FHRLST}" | sed -e 's/_/ /g; s/f/ /g; s/,/ /g')
fhr3="${FHR3}"
fhr=$(( 10#${fhr3} ))
if (( fhr > FHMAX_GFS )); then
echo "Nothing to process for FHR = ${fhr3}, cycle"
continue
fi

for fhr3 in ${fhrlst}; do
fhr=$(( 10#${fhr3} ))
if (( fhr > FHMAX_GFS )); then
echo "Nothing to process for FHR = ${fhr3}, cycle"
continue
fi

export fcsthrs="${fhr3}"
export fcsthrs="${fhr3}"

# Execute the JJOB
"${HOMEgfs}/jobs/J${RUN^^}_ATMOS_GEMPAK"
done
"${HOMEgfs}/jobs/J${RUN^^}_ATMOS_GEMPAK"

status=$?
exit "${status}"
19 changes: 8 additions & 11 deletions jobs/rocoto/gempakgrb2spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ export jobid="${job}.$$"
source "${HOMEgfs}/ush/jjob_header.sh" -e "gempak_spec" -c "base"

# shellcheck disable=SC2153
fhrlst=$(echo "${FHRLST}" | sed -e 's/_/ /g; s/f/ /g; s/,/ /g')
fhr3="${FHR3}"
fhr=$(( 10#${fhr3} ))
if (( fhr > FHMAX_GFS )); then
echo "Nothing to process for FHR = ${fhr3}, cycle"
continue
fi

for fhr3 in ${fhrlst}; do
fhr=$(( 10#${fhr3} ))
if (( fhr > FHMAX_GFS )); then
echo "Nothing to process for FHR = ${fhr3}, cycle"
continue
fi

export fcsthrs="${fhr3}"
export fcsthrs="${fhr3}"

# Execute the JJOB
"${HOMEgfs}/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC"
done
"${HOMEgfs}/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC"

status=$?
exit "${status}"
5 changes: 1 addition & 4 deletions parm/config/gfs/config.gempak
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
echo "BEGIN: config.gempak"

# Get task specific resources
. "$EXPDIR/config.resources" gempak

# No. of concurrent gempak jobs
export NAWIPSGRP=42
. $EXPDIR/config.resources gempak

echo "END: config.gempak"
55 changes: 23 additions & 32 deletions workflow/rocoto/gfs_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,10 @@ def _get_awipsgroups(cdump, config):
fhout = config['FHOUT_GFS']
fhmax_hf = config['FHMAX_HF_GFS']
fhout_hf = config['FHOUT_HF_GFS']
# if fhmax > 240:
# fhmax = 240
# if fhmax_hf > 240:
# fhmax_hf = 240
if fhmax > 240:
fhmax = 240
if fhmax_hf > 240:
fhmax_hf = 240
fhrs_hf = list(range(fhmin, fhmax_hf + fhout_hf, fhout_hf))
fhrs = fhrs_hf + list(range(fhrs_hf[-1] + fhout, fhmax + fhout, fhout))

Expand Down Expand Up @@ -1420,7 +1420,7 @@ def awips_20km_1p0deg(self):

resources = self.get_resource('awips')

task_name = f'{self.cdump}awips_20km_1p0deg_#{varname3}#'
task_name = f'{self.cdump}awips_20km_1p0deg#{varname1}#'
task_dict = {'task_name': task_name,
'resources': resources,
'dependency': dependencies,
Expand All @@ -1444,23 +1444,17 @@ def awips_20km_1p0deg(self):
def gempak(self):

deps = []
dep_dict = {'type': 'metatask', 'name': f'{self.cdump}atmos_prod'}
dep_dict = {'type': 'task', 'name': f'{self.cdump}atmos_prod_f#fhr#'}
deps.append(rocoto.add_dependency(dep_dict))
dependencies = rocoto.create_dependency(dep=deps)

gempak_vars = self.envars.copy()
gempak_dict = {'FHRGRP': '#grp#',
'FHRLST': '#lst#',
'ROTDIR': self.rotdir}
gempak_dict = {'FHR3': '#fhr#'}
for key, value in gempak_dict.items():
gempak_vars.append(rocoto.create_envar(name=key, value=str(value)))

varname1, varname2, varname3 = 'grp', 'dep', 'lst'
varval1, varval2, varval3 = self._get_awipsgroups(self.cdump, self._configs['gempak'])
var_dict = {varname1: varval1, varname2: varval2, varname3: varval3}

resources = self.get_resource('gempak')
task_name = f'{self.cdump}gempak_#{varname3}#'
task_name = f'{self.cdump}gempak_f#fhr#'
task_dict = {'task_name': task_name,
'resources': resources,
'dependency': dependencies,
Expand All @@ -1472,11 +1466,14 @@ def gempak(self):
'maxtries': '&MAXTRIES;'
}

metatask_dict = {'task_name': f'{self.cdump}gempak',
'task_dict': task_dict,
'var_dict': var_dict}
fhrs = self._get_forecast_hours(self.cdump, self._configs['gempak'])
fhr_var_dict = {'fhr': ' '.join([f"{fhr:03d}" for fhr in fhrs])}

task = rocoto.create_task(metatask_dict)
fhr_metatask_dict = {'task_name': f'{self.cdump}gempak',
'task_dict': task_dict,
'var_dict': fhr_var_dict}

task = rocoto.create_task(fhr_metatask_dict)

return task

Expand Down Expand Up @@ -1556,18 +1553,12 @@ def gempakpgrb2spec(self):
dependencies = rocoto.create_dependency(dep=deps)

gempak_vars = self.envars.copy()
gempak_dict = {'FHRGRP': '#grp#',
'FHRLST': '#lst#',
'ROTDIR': self.rotdir}
gempak_dict = {'FHR3': '#fhr#'}
for key, value in gempak_dict.items():
gempak_vars.append(rocoto.create_envar(name=key, value=str(value)))

varname1, varname2, varname3 = 'grp', 'dep', 'lst'
varval1, varval2, varval3 = self._get_awipsgroups(self.cdump, self._configs['gempak'])
var_dict = {varname1: varval1, varname2: varval2, varname3: varval3}

resources = self.get_resource('gempak')
task_name = f'{self.cdump}gempakgrb2spec_#{varname3}#'
task_name = f'{self.cdump}gempakgrb2spec_f#fhr#'
task_dict = {'task_name': task_name,
'resources': resources,
'dependency': dependencies,
Expand All @@ -1588,14 +1579,14 @@ def gempakpgrb2spec(self):
}
local_config.update(goes_times)

# fhrs = self._get_forecast_hours(self.cdump, local_config)
# fhr_var_dict = {'fhr': ' '.join([f"{fhr:03d}" for fhr in fhrs])}
fhrs = self._get_forecast_hours(self.cdump, local_config)
fhr_var_dict = {'fhr': ' '.join([f"{fhr:03d}" for fhr in fhrs])}

metatask_dict = {'task_name': f'{self.cdump}gempakgrb2spec',
'task_dict': task_dict,
'var_dict': var_dict}
fhr_metatask_dict = {'task_name': f'{self.cdump}gempakgrb2spec',
'task_dict': task_dict,
'var_dict': fhr_var_dict}

task = rocoto.create_task(metatask_dict)
task = rocoto.create_task(fhr_metatask_dict)

return task

Expand Down

0 comments on commit dbb96b0

Please sign in to comment.