Skip to content

Commit

Permalink
3dfgat gdas.cd ctests work but needs tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Jul 1, 2024
1 parent 9476c12 commit 17494de
Show file tree
Hide file tree
Showing 11 changed files with 546 additions and 3 deletions.
8 changes: 7 additions & 1 deletion env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ elif [[ "${step}" = "atmensanlfv3inc" ]]; then

export NTHREADS_ATMENSANLFV3INC=${nth_atmensanlfv3inc:-${nth_max}}
[[ ${NTHREADS_ATMENSANLFV3INC} -gt ${nth_max} ]] && export NTHREADS_ATMENSANLFV3INC=${nth_max}
export APRUN_ATMENSANLFV3INC="${launcher} -n ${npe_atmensanlfv3inc} --cpus-per-task=${NTHREADS_ATMENSANLFV3INC}"
export APRUN_ATMENSANLFV3INC="${launcher} -n ${npe_atmensanlfv3inc} --cpus-per-task=${NTHREADS_ATMENSANLFV3INC}"

elif [[ "${step}" = "aeroanlrun" ]]; then

Expand Down Expand Up @@ -114,6 +114,12 @@ elif [[ "${step}" = "snowanl" ]]; then

export APRUN_APPLY_INCR="${launcher} -n 6"

elif [[ "${step}" = "marinebmat" ]]; then

export APRUNCFP="${launcher} -n \$ncmd --multi-prog"

export APRUN_MARINEBMAT="${launcher} -n ${npe_ocnanalbmat}"

elif [[ "${step}" = "ocnanalbmat" ]]; then

export APRUNCFP="${launcher} -n \$ncmd --multi-prog"
Expand Down
4 changes: 4 additions & 0 deletions jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_PREP
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COM_ICE_HISTORY_PREV:COM_ICE_HISTORY_TMPL \
COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL

YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMIN_OCEAN_BMATRIX:COM_OCEAN_BMATRIX_TMPL \
COMIN_ICE_BMATRIX:COM_ICE_BMATRIX_TMPL

##############################################
# Begin JOB SPECIFIC work
##############################################
Expand Down
56 changes: 56 additions & 0 deletions jobs/JGLOBAL_MARINE_BMAT
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
source "${HOMEgfs}/ush/preamble.sh"
export DATA="${DATAROOT}/${RUN}marinebmat_${cyc}"
export DATA=${DATA:-${DATAROOT}/${RUN}marinebmat_${cyc}}
# source config.base, config.ocnanal and config.ocnanalbmat
# and pass marinebmat to ${machine}.env
source "${HOMEgfs}/ush/jjob_header.sh" -e "marinebmat" -c "base ocnanal marinebmat"

##############################################
# Set variables used in the script
##############################################
# shellcheck disable=SC2153
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours")
gPDY=${GDATE:0:8}
gcyc=${GDATE:8:2}
GDUMP="gdas"


##############################################
# Begin JOB SPECIFIC work
##############################################

# Generate COM variables from templates
# TODO: This is temporary, the plan is to prepare the bmatrix at the end of the
# cycle, so the backgrounds should be from the current cycle, not the previous
RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COMIN_OCEAN_HISTORY_PREV:COM_OCEAN_HISTORY_TMPL \
COMIN_ICE_HISTORY_PREV:COM_ICE_HISTORY_TMPL

YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMOUT_OCEAN_BMATRIX:COM_OCEAN_BMATRIX_TMPL \
COMOUT_ICE_BMATRIX:COM_ICE_BMATRIX_TMPL

mkdir -p "${COMOUT_OCEAN_BMATRIX}"
mkdir -p "${COMOUT_ICE_BMATRIX}"

###############################################################
# Run relevant script

EXSCRIPT=${GDASMARINEBMATRUNPY:-${SCRgfs}/exglobal_marine_bmat_run.py}
${EXSCRIPT}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi

exit 0
26 changes: 26 additions & 0 deletions jobs/rocoto/marinebmat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env bash

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

###############################################################
# Source UFSDA workflow modules
. "${HOMEgfs}/ush/load_ufsda_modules.sh"
status=$?
[[ "${status}" -ne 0 ]] && exit "${status}"

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

###############################################################
# setup python path for workflow utilities and tasks
wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src"
socaToolsPATH="${HOMEgfs}/sorc/gdas.cd/sorc/soca/tools"
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}"
export PYTHONPATH

###############################################################
# Execute the JJOB
"${HOMEgfs}"/jobs/JGLOBAL_MARINE_BMAT
echo "BMAT gets run here"
status=$?
exit "${status}"
2 changes: 2 additions & 0 deletions parm/config/gfs/config.com
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ declare -rx COM_OCEAN_HISTORY_TMPL=${COM_BASE}'/model_data/ocean/history'
declare -rx COM_OCEAN_RESTART_TMPL=${COM_BASE}'/model_data/ocean/restart'
declare -rx COM_OCEAN_INPUT_TMPL=${COM_BASE}'/model_data/ocean/input'
declare -rx COM_OCEAN_ANALYSIS_TMPL=${COM_BASE}'/analysis/ocean'
declare -rx COM_OCEAN_BMATRIX_TMPL=${COM_BASE}'/bmatrix/ocean'
declare -rx COM_OCEAN_NETCDF_TMPL=${COM_BASE}'/products/ocean/netcdf'
declare -rx COM_OCEAN_GRIB_TMPL=${COM_BASE}'/products/ocean/grib2'
declare -rx COM_OCEAN_GRIB_GRID_TMPL=${COM_OCEAN_GRIB_TMPL}'/${GRID}'

declare -rx COM_ICE_ANALYSIS_TMPL=${COM_BASE}'/analysis/ice'
declare -rx COM_ICE_BMATRIX_TMPL=${COM_BASE}'/bmatrix/ice'
declare -rx COM_ICE_INPUT_TMPL=${COM_BASE}'/model_data/ice/input'
declare -rx COM_ICE_HISTORY_TMPL=${COM_BASE}'/model_data/ice/history'
declare -rx COM_ICE_RESTART_TMPL=${COM_BASE}'/model_data/ice/restart'
Expand Down
11 changes: 11 additions & 0 deletions parm/config/gfs/config.marinebmat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

########## config.marinebmat ##########
# configuration for the marine B-matrix

echo "BEGIN: config.marinebmat"

# Get task specific resources
. "${EXPDIR}/config.resources" marinebmat

echo "END: config.marinebmat"
1 change: 1 addition & 0 deletions parm/config/gfs/config.ocnanal
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

echo "BEGIN: config.ocnanal"

export SOCA_FIX_YAML_TMPL="${PARMgfs}/gdas/soca/letkf/soca_fix_stage.yaml.j2"
export OBS_YAML_DIR="${HOMEgfs}/sorc/gdas.cd/parm/soca/obs/config"
export OBS_LIST=@SOCA_OBS_LIST@
export OBS_YAML="${OBS_LIST}"
Expand Down
2 changes: 1 addition & 1 deletion parm/config/gfs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ case ${step} in
export memory_prepoceanobs="48GB"
;;

"ocnanalbmat")
"ocnanalbmat" | "marinebmat")
npes=16
case ${OCNRES} in
"025") npes=480;;
Expand Down
24 changes: 24 additions & 0 deletions scripts/exglobal_marine_bmat_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
# exglobal_marine_bmat_run.py
# This script creates an marineBmat object
# and runs the execute method
# which executes all the steps necessary to create the global marine B-matrix
import os

from wxflow import Logger, cast_strdict_as_dtypedict
from pygfs.task.marine_bmat import MarineBMat

# Initialize root logger
logger = Logger(level='DEBUG', colored_log=True)


if __name__ == '__main__':

# Take configuration from environment and cast it as python dictionary
config = cast_strdict_as_dtypedict(os.environ)

# Create an instance of the MarineBMat task
marineBMat = MarineBMat(config)
marineBMat.execute()


3 changes: 2 additions & 1 deletion sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ case "${machine}" in
"gaea") FIX_DIR="/gpfs/f5/epic/proj-shared/global/glopara/data/fix" ;;
*)
echo "FATAL: Unknown target machine ${machine}, couldn't set FIX_DIR"
exit 1
#exit 0
;;
esac

Expand Down Expand Up @@ -368,6 +368,7 @@ if [[ -d "${HOMEgfs}/sorc/gdas.cd/build" ]]; then
"gdas_soca_gridgen.x" \
"gdas_soca_error_covariance_toolbox.x" \
"gdas_soca_setcorscales.x" \
"gdas_soca_diagb.x" \
"fv3jedi_plot_field.x" \
"fv3jedi_fv3inc.x" \
"gdas_ens_handler.x" \
Expand Down
Loading

0 comments on commit 17494de

Please sign in to comment.