Skip to content

Commit

Permalink
debugging for ocean ensemble run
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewEichmann-NOAA committed Aug 21, 2024
1 parent d3d85f0 commit 20e48a1
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 11 deletions.
32 changes: 32 additions & 0 deletions ci/cases/pr/C48mx500_3DVarAOWCDAens.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
experiment:
system: gfs
mode: cycled

arguments:
pslot: {{ 'pslot' | getenv }}
app: S2S
resdetatmos: 48
resdetocean: 5.0
resensatmos: 48
comroot: {{ 'RUNTESTS' | getenv }}/COMROOT
expdir: {{ 'RUNTESTS' | getenv }}/EXPDIR
#icsdir: {{ 'ICSDIR_ROOT' | getenv }}/C48mx500
idate: 2021032412
edate: 2021032418
#nens: 0
#icsdir: /scratch1/NCEPDEV/da/Andrew.Eichmann/ICSDIR/C48mx500
#idate: 2021032312
#edate: 2021032318
#icsdir: /scratch1/NCEPDEV/da/Andrew.Eichmann/ICSDIR/C48O500
#idate: 2021032412
#edate: 2021032418
nens: 3
icsdir: /scratch1/NCEPDEV/da/Andrew.Eichmann/ICSDIR/C48mx500ens
gfs_cyc: 0
start: warm
yaml: {{ HOMEgfs }}/ci/cases/yamls/soca_gfs_defaults_ci.yaml

skip_ci_on_hosts:
- wcoss2
- orion
- hercules
14 changes: 9 additions & 5 deletions jobs/JGLOBAL_MARINE_BMAT
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

source "${HOMEgfs}/ush/preamble.sh"

if (( 10#${ENSMEM:-0} > 0 )); then
# source config.base, config.ocnanal and config.marinebmat
# and pass marinebmat to ${machine}.env
source "${HOMEgfs}/ush/jjob_header.sh" -e "marinebmat" -c "base ocnanal marinebmat"


#if (( 10#${ENSMEM:-0} > 0 )); then
if (( 10#${NMEM_ENS:-0} > 0 )); then
export DATAjob="${DATAROOT}/${RUN}marinebmat.${PDY:-}${cyc}"
export DATA="${DATAjob}/${jobid}"
#export DATA="${DATAjob}/${jobid}"
export DATA=${DATA:-${DATAROOT}/${jobid:?}}
# Create the directory to hold ensemble perturbations
export DATAenspert="${DATAjob}/enspert"
if [[ ! -d "${DATAenspert}" ]]; then mkdir -p "${DATAenspert}"; fi
fi

# source config.base, config.ocnanal and config.marinebmat
# and pass marinebmat to ${machine}.env
source "${HOMEgfs}/ush/jjob_header.sh" -e "marinebmat" -c "base ocnanal marinebmat"

##############################################
# Set variables used in the script
Expand Down
9 changes: 5 additions & 4 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,12 @@ MOM6_postdet() {

# GEFS perturbations
# TODO if [[ $RUN} == "gefs" ]] block maybe be needed
# yup
# to ensure it does not interfere with the GFS when ensemble is updated in the GFS
if (( MEMBER > 0 )) && [[ "${ODA_INCUPD:-False}" == "True" ]]; then
${NCP} "${COMIN_OCEAN_ANALYSIS}/mom6_increment.nc" "${DATA}/INPUT/mom6_increment.nc" \
|| ( echo "FATAL ERROR: Unable to copy ensemble MOM6 increment, ABORT!"; exit 1 )
fi
#if (( MEMBER > 0 )) && [[ "${ODA_INCUPD:-False}" == "True" ]]; then
# ${NCP} "${COMIN_OCEAN_ANALYSIS}/mom6_increment.nc" "${DATA}/INPUT/mom6_increment.nc" \
# || ( echo "FATAL ERROR: Unable to copy ensemble MOM6 increment, ABORT!"; exit 1 )
#fi
fi # if [[ "${RERUN}" == "NO" ]]; then

# Link output files
Expand Down
4 changes: 3 additions & 1 deletion ush/python/pygfs/task/marine_bmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def initialize(self: Task) -> None:
# stage backgrounds
# TODO(G): Check ocean backgrounds dates for consistency
bkg_list = parse_j2yaml(self.task_config.MARINE_DET_STAGE_BKG_YAML_TMPL, self.task_config)
print("bkg_list: ",bkg_list)
FileHandler(bkg_list).sync()
for cice_fname in ['./INPUT/cice.res.nc', './bkg/ice.bkg.f006.nc', './bkg/ice.bkg.f009.nc']:
mdau.cice_hist2fms(cice_fname, cice_fname)
Expand Down Expand Up @@ -214,6 +215,7 @@ def vertical_diffusion(self: Task) -> None:
# compute the coefficients of the diffusion operator
mdau.run(exec_cmd)


@logit(logger)
def ensemble_perturbations(self: Task) -> None:
"""Generate the 3D ensemble of perturbation for the 3DEnVAR
Expand Down Expand Up @@ -323,7 +325,7 @@ def finalize(self: Task) -> None:
FileHandler({'copy': diagb_list}).sync()

# Copy the ensemble perturbation diagnostics to the ROTDIR
if self.task_config.DOHYBVAR == "YES" or self.task_config.NMEM_ENS > 3:
if self.task_config.DOHYBVAR == "YES" or self.task_config.NMEM_ENS > 2:
window_middle_iso = self.task_config.MARINE_WINDOW_MIDDLE.strftime('%Y-%m-%dT%H:%M:%SZ')
weight_list = []
src = os.path.join(self.task_config.DATA, f"ocn.ens_weights.incr.{window_middle_iso}.nc")
Expand Down
8 changes: 7 additions & 1 deletion ush/python/pygfs/utils/marine_da_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import f90nml
import os
from logging import getLogger
import os
import re
import xarray as xr

from wxflow import (FileHandler,
Expand Down Expand Up @@ -97,3 +98,8 @@ def stage_ens_mem(task_config: AttrDict) -> None:
letkf_stage_list = parse_j2yaml(task_config.MARINE_ENSDA_STAGE_BKG_YAML_TMPL, ensbkgconf)
logger.info(f"{letkf_stage_list}")
FileHandler(letkf_stage_list).sync()

for _, ens_mem_file in letkf_stage_list['copy']:
print("ens_mem_file: ", ens_mem_file)
if re.fullmatch(r'ice\.\d+\.nc', os.path.basename(ens_mem_file)):
cice_hist2fms(ens_mem_file, ens_mem_file)
6 changes: 6 additions & 0 deletions workflow/setup_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def link_files_from_src_to_dst(src_dir, dst_dir):
makedirs_if_missing(dst_dir)
link_files_from_src_to_dst(src_dir, dst_dir)

dst_dir = os.path.join(rotdir, current_cycle_dir, memdir, dst_ice_anl_dir)
src_dir = os.path.join(inputs.icsdir, current_cycle_dir, memdir, src_ice_anl_dir)
makedirs_if_missing(dst_dir)
link_files_from_src_to_dst(src_dir, dst_dir)


# Link mediator files
if do_med:
dst_dir = os.path.join(rotdir, previous_cycle_dir, memdir, dst_med_dir)
Expand Down

0 comments on commit 20e48a1

Please sign in to comment.