From 98a8294aa8f89da2e40699d833389079fccd370e Mon Sep 17 00:00:00 2001 From: Guillaume Vernieres Date: Wed, 14 Dec 2022 12:56:29 -0500 Subject: [PATCH] Testing of the Marine DA jjobs (#234) * blank ctests for jjobs * works but needs tidy * fname too long for fms ... * some code tidy * removed debug prints * replacing machine in config * copy bkg * manual merge of prep script * adjusted a few things related to jjob refactor ... * tidy ... some and local2hpc * code tidy and some shellcheck * bomb obs, fix yaml * clean exp --- parm/soca/obs/config/sst_noaa19_l3u.yaml | 2 +- scripts/exgdas_global_marine_analysis_prep.py | 47 ++- test/setup_workflow_exp.sh | 2 + test/soca/CMakeLists.txt | 5 + test/soca/gw/CMakeLists.txt | 31 ++ test/soca/gw/bkg2comrot.sh | 10 + test/soca/gw/config.base | 399 ++++++++++++++++++ test/soca/gw/config.yaml | 7 + test/soca/gw/jjob_prep.sh | 13 + test/soca/gw/jjob_run.sh | 9 + test/soca/gw/runtime_vars.sh | 16 + test/soca/gw/setup_workflow_exp.sh | 67 +++ test/soca/test_prep.sh | 8 +- 13 files changed, 591 insertions(+), 25 deletions(-) create mode 100644 test/soca/gw/CMakeLists.txt create mode 100755 test/soca/gw/bkg2comrot.sh create mode 100644 test/soca/gw/config.base create mode 100644 test/soca/gw/config.yaml create mode 100755 test/soca/gw/jjob_prep.sh create mode 100755 test/soca/gw/jjob_run.sh create mode 100644 test/soca/gw/runtime_vars.sh create mode 100755 test/soca/gw/setup_workflow_exp.sh diff --git a/parm/soca/obs/config/sst_noaa19_l3u.yaml b/parm/soca/obs/config/sst_noaa19_l3u.yaml index e1612570b..c0906f02c 100644 --- a/parm/soca/obs/config/sst_noaa19_l3u.yaml +++ b/parm/soca/obs/config/sst_noaa19_l3u.yaml @@ -3,7 +3,7 @@ obs space: obsdatain: engine: type: H5File - obsfile: !ENV ${DATA}/obs${OPREFIX}sst_noaa19_l3u.${CDATE}.nc4 + obsfile: !ENV ${DATA}/obs/${OPREFIX}sst_noaa19_l3u.${CDATE}.nc4 obsdataout: engine: type: H5File diff --git a/scripts/exgdas_global_marine_analysis_prep.py b/scripts/exgdas_global_marine_analysis_prep.py index ac97905be..f58f7c593 100755 --- a/scripts/exgdas_global_marine_analysis_prep.py +++ b/scripts/exgdas_global_marine_analysis_prep.py @@ -44,8 +44,7 @@ my_home = os.path.dirname(os.path.dirname(my_dir)) gdas_home = os.path.join(os.getenv('HOMEgfs'), 'sorc', 'gdas.cd') sys.path.append(os.path.join(os.getenv('HOMEgfs', my_home), 'ush')) -print(f"sys.path={sys.path}") - +sys.path.append(os.path.join(gdas_home, 'ush')) # import UFSDA utilities import ufsda @@ -97,7 +96,7 @@ def test_hist_date(histfile, ref_date): assert hist_date == ref_date, 'Inconsistent bkg date' -def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]', yaml_name='bkg.yaml'): +def gen_bkg_list(bkg_path, out_path, window_begin=' ', file_type='gdas.t*.ocnf00[3-9]', yaml_name='bkg.yaml'): """ Generate a YAML of the list of backgrounds for the pseudo model TODO: [3-9] shouldn't be hard-coded. Instead construct the list of background dates for the cycle @@ -113,18 +112,27 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' test_hist_date(os.path.join(bkg_path, ocn_filename_ic), bkg_date) # assert date of the history file is correct for bkg in files: - test_hist_date(bkg, bkg_date) # assert date of the history file is correct + + # assert validity of ocean bkg, remove basename + test_hist_date(bkg, bkg_date) ocn_filename = os.path.splitext(os.path.basename(bkg))[0]+'.nc' + + # aggregate seaice variables and dump aggregated ice bkg in out_path ice_filename = ocn_filename.replace("ocn", "ice") agg_ice_filename = ocn_filename.replace("ocn", "agg_ice") agg_seaice(os.path.join(bkg_path, ice_filename), - os.path.join(bkg_path, agg_ice_filename)) # aggregate seaice variables + os.path.join(out_path, agg_ice_filename)) + + # copy ocean bkg to out_path + ufsda.disk_utils.copyfile(os.path.join(bkg_path, ocn_filename), + os.path.join(out_path, ocn_filename)) + bkg_dict = {'date': bkg_date.strftime('%Y-%m-%dT%H:%M:%SZ'), - 'basename': bkg_path+'/', + 'basename': './bkg/', 'ocn_filename': ocn_filename, 'ice_filename': agg_ice_filename, 'read_from_file': 1, - 'remap_filename': os.path.join(bkg_path, ocn_filename_ic)} + 'remap_filename': './bkg/'+ocn_filename_ic} bkg_date = bkg_date + timedelta(hours=1) # TODO: make the bkg interval a configurable bkg_list.append(bkg_dict) f = open(yaml_name, 'w') @@ -148,11 +156,14 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' diags = os.path.join(anl_dir, 'diags') ufsda.mkdir(diags) +# create output directory for obs +bkg_dir = os.path.join(anl_dir, 'bkg') +ufsda.mkdir(bkg_dir) + # create output directory for soca DA anl_out = os.path.join(comout, 'ocnanal_'+os.getenv('CDATE'), 'Data') ufsda.mkdir(anl_out) -ufsda.symlink(os.path.join(anl_dir, 'Data'), anl_out, remove=False) - +ufsda.symlink(anl_out, os.path.join(anl_dir, 'Data'), remove=False) ################################################################################ # fetch observations @@ -164,7 +175,6 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' # create config dict from runtime env envconfig = ufsda.misc_utils.get_env_config(component='notatm') - stage_cfg = YAMLFile(path=os.path.join(gdas_home, 'parm', 'templates', @@ -175,13 +185,6 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' # stage observations from R2D2 to COMIN_OBS and then link to analysis subdir ufsda.stage.obs(stage_cfg) -################################################################################ -# stage backgrounds from COMIN_GES to analysis subdir -logging.info(f"---------------- Stage backgrounds") - -stage_cfg['background_dir'] = os.getenv('COMIN_GES') -ufsda.stage.background(stage_cfg) - ################################################################################ # stage static files logging.info(f"---------------- Stage static files") @@ -275,9 +278,13 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' 'soca', 'variational', '3dvarfgat.yaml') + half_assim_freq = timedelta(hours=int(os.getenv('assim_freq'))/2) window_begin = datetime.strptime(os.getenv('CDATE'), '%Y%m%d%H') - half_assim_freq -gen_bkg_list(window_begin=window_begin, bkg_path=os.getenv('COMIN_GES'), yaml_name='bkg_list.yaml') +gen_bkg_list(bkg_path=os.getenv('COMIN_GES'), + out_path=bkg_dir, + window_begin=window_begin, + yaml_name='bkg_list.yaml') os.environ['BKG_LIST'] = 'bkg_list.yaml' os.environ['SABER_BLOCKS_YAML'] = os.path.join(gdas_home, 'parm', 'soca', 'berror', 'saber_blocks.yaml') logging.info(f"{config}") @@ -289,10 +296,10 @@ def gen_bkg_list(window_begin=' ', bkg_path='.', file_type='gdas.t*.ocnf00[3-9]' varconfig.save(var_yaml) # link of convenience -mom_ic = glob.glob(os.path.join(os.getenv('COMIN_GES'), 'gdas.*.ocnf003.nc'))[0] +mom_ic = glob.glob(os.path.join(bkg_dir, 'gdas.*.ocnf003.nc'))[0] ufsda.disk_utils.symlink(mom_ic, os.path.join(anl_dir, 'INPUT', 'MOM.res.nc')) -cice_ic = glob.glob(os.path.join(os.getenv('COMIN_GES'), 'gdas.*.agg_icef003.nc'))[0] +cice_ic = glob.glob(os.path.join(bkg_dir, 'gdas.*.agg_icef003.nc'))[0] ufsda.disk_utils.symlink(cice_ic, os.path.join(anl_dir, 'INPUT', 'cice.res.nc')) # prepare input.nml diff --git a/test/setup_workflow_exp.sh b/test/setup_workflow_exp.sh index 57b976232..bd7a84494 100755 --- a/test/setup_workflow_exp.sh +++ b/test/setup_workflow_exp.sh @@ -17,6 +17,8 @@ configdir=$srcdir/../../parm/config comrot=$bindir/test/testrun/ROTDIRS expdir=$bindir/test/testrun/experiments +# clean previous experiment +rm -rf "${comrot}" "${expdir}" # run the script cd $srcdir/../../workflow diff --git a/test/soca/CMakeLists.txt b/test/soca/CMakeLists.txt index 0aafbde95..fbb979427 100644 --- a/test/soca/CMakeLists.txt +++ b/test/soca/CMakeLists.txt @@ -97,3 +97,8 @@ set_tests_properties(test_gdasapp_soca_ana_run PROPERTIES DEPENDS "test_gdasapp_soca_ana_prep" ) + +# Test exgdas scripts from the global-worflow +if (WORKFLOW_TESTS) + add_subdirectory(gw) +endif() diff --git a/test/soca/gw/CMakeLists.txt b/test/soca/gw/CMakeLists.txt new file mode 100644 index 000000000..e3a6a037c --- /dev/null +++ b/test/soca/gw/CMakeLists.txt @@ -0,0 +1,31 @@ +# test for creating an experiment directory within the global-workflow +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test/soca/gw/testrun) + +add_test(NAME test_gdasapp_setup_soca_cycled_exp + COMMAND ${PROJECT_SOURCE_DIR}/test/soca/gw/setup_workflow_exp.sh + ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/soca/gw/testrun) + +add_test(NAME test_gdasapp_soca_bkg2comrot + COMMAND ${PROJECT_SOURCE_DIR}/test/soca/gw/bkg2comrot.sh + ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/soca/gw/testrun) +set_tests_properties(test_gdasapp_soca_bkg2comrot + PROPERTIES +DEPENDS "test_gdasapp_soca_cycled_exp") + +add_test(NAME test_gdasapp_soca_jjob_soca_prep + COMMAND ${PROJECT_SOURCE_DIR}/test/soca/gw/jjob_prep.sh + ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/soca/gw/testrun) +set_tests_properties(test_gdasapp_soca_jjob_soca_prep + PROPERTIES + DEPENDS "test_gdasapp_soca_cycled_exp;test_gdasapp_soca_bkg2comrot") + +add_test(NAME test_gdasapp_soca_jjob_soca_run + COMMAND ${PROJECT_SOURCE_DIR}/test/soca/gw/jjob_run.sh + ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/soca/gw/testrun) + set_tests_properties(test_gdasapp_soca_jjob_soca_run + PROPERTIES + DEPENDS "test_gdasapp_soca_cycled_exp;test_gdasapp_soca_bkg2comrot;test_gdasapp_soca_jjob_soca_prep") diff --git a/test/soca/gw/bkg2comrot.sh b/test/soca/gw/bkg2comrot.sh new file mode 100755 index 000000000..cb655236f --- /dev/null +++ b/test/soca/gw/bkg2comrot.sh @@ -0,0 +1,10 @@ +#!/bin/bash +bindir=$1 +srcdir=$2 + +# export env. var. +source "${srcdir}/test/soca/gw/runtime_vars.sh" "${bindir}" "${srcdir}" + +# prepare background from previous cycle +mkdir -p "${ROTDIR}/${PSLOT}/gdas.${PDY}/${gcyc}/ocean/" +cp -r "${bindir}/test/soca/bkg/"* "${ROTDIR}/${PSLOT}/gdas.${PDY}/${gcyc}/ocean/" diff --git a/test/soca/gw/config.base b/test/soca/gw/config.base new file mode 100644 index 000000000..d055d9f29 --- /dev/null +++ b/test/soca/gw/config.base @@ -0,0 +1,399 @@ +#! /usr/bin/env bash + +########## config.base ########## +# Common to all steps + +echo "BEGIN: config.base" + +# Machine environment +export machine="@MACHINE@" +# EMC parallel or NCO production +export RUN_ENVIR="emc" + +# Account, queue, etc. +export ACCOUNT="" +export QUEUE="" +export QUEUE_SERVICE="" +export PARTITION_BATCH="" +export PARTITION_SERVICE="" + +# Project to use in mass store: +HPSS_PROJECT=emc-global + +# Directories relative to installation areas: +export HOMEgfs=@HOMEgfs@ +export PARMgfs=$HOMEgfs/parm +export FIXgfs=$HOMEgfs/fix +export USHgfs=$HOMEgfs/ush +export UTILgfs=$HOMEgfs/util +export EXECgfs=$HOMEgfs/exec +export SCRgfs=$HOMEgfs/scripts + +export FIXcice=$HOMEgfs/fix/cice +export FIXmom=$HOMEgfs/fix/mom6 +export FIXreg2grb2=$HOMEgfs/fix/reg2grb2 + +######################################################################## + +# GLOBAL static environment parameters +export PACKAGEROOT="" # TODO: set via prod_envir in Ops +export COMROOT="" # TODO: set via prod_envir in Ops +export COMINsyn="" +export DMPDIR="/home/${USER}" + +# USER specific paths +export HOMEDIR="/home/${USER}" +export STMP=@STMP@ +export PTMP="/home/${USER}" +export NOSCRUB="$HOMEDIR" + +# Base directories for various builds +export BASE_GIT="" + +# Toggle to turn on/off GFS downstream processing. +export DO_BUFRSND="NO" # BUFR sounding products +export DO_GEMPAK="NO" # GEMPAK products +export DO_AWIPS="NO" # AWIPS products +export WAFSF="NO" # WAFS products +export DO_VRFY="YES" # VRFY step + +# NO for retrospective parallel; YES for real-time parallel +# arch.sh uses REALTIME for MOS. Need to set REALTIME=YES +# if want MOS written to HPSS. Should update arch.sh to +# use RUNMOS flag (currently in config.vrfy) +export REALTIME="YES" + +# Experiment mode (cycled or forecast-only) +export MODE="cycled" # cycled/forecast-only + +#################################################### +# DO NOT ADD MACHINE DEPENDENT STUFF BELOW THIS LINE +# IF YOU HAVE TO MAKE MACHINE SPECIFIC CHANGES BELOW +# FEEL FREE TO MOVE THEM ABOVE THIS LINE TO KEEP IT +# CLEAR +#################################################### +# Build paths relative to $HOMEgfs +export FIXgsi="$HOMEgfs/fix/gsi" +export HOMEfv3gfs="$HOMEgfs/sorc/fv3gfs.fd" +export HOMEpost="$HOMEgfs" +export HOMEobsproc="$BASE_GIT/obsproc/v1.0.2" + +# CONVENIENT utility scripts and other environment parameters +export NCP="/bin/cp -p" +export NMV="/bin/mv" +export NLN="/bin/ln -sf" +export VERBOSE="YES" +export KEEPDATA="NO" +export CHGRP_RSTPROD="YES" +export CHGRP_CMD="chgrp rstprod" +export NEMSIOGET="$HOMEgfs/exec/nemsio_get" +export NCDUMP="$NETCDF/bin/ncdump" +export NCLEN="$HOMEgfs/ush/getncdimlen" + +# Machine environment, jobs, and other utility scripts +export BASE_ENV="$HOMEgfs/env" +export BASE_JOB="$HOMEgfs/jobs/rocoto" + +# EXPERIMENT specific environment parameters +export SDATE=2021032318 +export FDATE=@FDATE@ +export EDATE=2021032418 +export EXP_WARM_START=".true." +export assim_freq=6 +export PSLOT="gdas_test" +export EXPDIR="@EXPDIRS@/$PSLOT" +export ROTDIR="@ROTDIRS@/$PSLOT" +export ROTDIR_DUMP="YES" #Note: A value of "NO" does not currently work +export DUMP_SUFFIX="" +if [[ "$CDATE" -ge "2019092100" && "$CDATE" -le "2019110700" ]]; then + export DUMP_SUFFIX="p" # Use dumps from NCO GFS v15.3 parallel +fi +export RUNDIR="$STMP/RUNDIRS/$PSLOT" +export DATAROOT="${STMP}/RUNDIRS/${PSLOT}" +export ARCDIR="$NOSCRUB/archive/$PSLOT" +export ICSDIR="None" +export ATARDIR="${NOSCRUB}/archive_rotdir/${PSLOT}" + +# Commonly defined parameters in JJOBS +export envir=${envir:-"prod"} +export NET="gfs" +export RUN=${RUN:-${CDUMP:-"gfs"}} +export COMIN_OBS=${DMPDIR}/${CDUMP}.${PDY}/$cyc/atmos +export COMIN_GES_OBS=${DMPDIR}/${CDUMP}.${PDY}/$cyc/atmos +export COMINatmos=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos +export COMOUTatmos=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos +export COMINwave=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/wave +export COMOUTwave=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/wave +export COMINocean=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean +export COMOUTocean=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean +export COMINice=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice +export COMOUTice=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice +export COMINaero=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/chem +export COMOUTaero=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/chem + +export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} +export LOGSCRIPT=${LOGSCRIPT:-""} +#export ERRSCRIPT=${ERRSCRIPT:-"err_chk"} +#export LOGSCRIPT=${LOGSCRIPT:-"startmsg"} +export REDOUT="1>" +export REDERR="2>" + +export SENDECF=${SENDECF:-"NO"} +export SENDCOM=${SENDCOM:-"NO"} +export SENDSDM=${SENDSDM:-"NO"} +export SENDDBN_NTC=${SENDDBN_NTC:-"NO"} +export SENDDBN=${SENDDBN:-"NO"} +export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} + +# APP settings +export APP=ATM + +# Defaults: +export DO_ATM="YES" +export DO_COUPLED="NO" +export DO_WAVE="NO" +export DO_OCN="NO" +export DO_ICE="NO" +export DO_AERO="NO" +export CCPP_SUITE="FV3_GFS_v16" +export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both +export DOBNDPNT_WAVE="NO" +export cplwav2atm=".false." +export FRAC_GRID=".true." + +case "${APP}" in + ATM) + export confignamevarfornems="atm" + ;; + ATMA) + export DO_AERO="YES" + export confignamevarfornems="atm_aero" + ;; + ATMW) + export DO_COUPLED="YES" + export DO_WAVE="YES" + export WAVE_CDUMP="both" + export confignamevarfornems="leapfrog_atm_wav" + ;; + NG-GODAS) + export DO_ATM="NO" + export DO_OCN="YES" + export DO_ICE="YES" + ;; + S2S*) + export DO_COUPLED="YES" + export DO_OCN="YES" + export DO_ICE="YES" + export CCPP_SUITE="FV3_GFS_v17_coupled_p8" + export confignamevarfornems="cpld" + + if [[ "$APP" =~ A$ ]]; then + export DO_AERO="YES" + export confignamevarfornems="${confignamevarfornems}_aero" + fi + + if [[ "$APP" =~ ^S2SW ]]; then + export DO_WAVE="YES" + export WAVE_CDUMP="both" + export cplwav2atm=".true." + export confignamevarfornems="${confignamevarfornems}_wave" + fi + + source $EXPDIR/config.defaults.s2sw + + ;; + *) + echo "Unrecognized APP: ${1}" + exit 1 + ;; +esac + +# Set operational resolution +export OPS_RES="C768" # Do not change + +# Resolution specific parameters +export LEVS=128 +export CASE="C48" +export CASE_ENKF="C24" +case "$CASE" in + "C48") export OCNRES=500;; + "C96") export OCNRES=100;; + "C192") export OCNRES=050;; + "C384") export OCNRES=025;; + "C768") export OCNRES=025;; + *) export OCNRES=025;; +esac +export ICERES=$OCNRES + +# Surface cycle update frequency +if [[ "$CDUMP" == "gdas" ]] ; then + export FHCYC=1 + export FTSFS=10 +elif [[ "$CDUMP" == "gfs" ]] ; then + export FHCYC=24 +fi + +# Output frequency of the forecast model (for cycling) +export FHMIN=0 +export FHMAX=9 +export FHOUT=3 # Will be changed to 1 in config.base if DO_GLDAS is set or (DOHYBVAR set to NO and l4densvar set to false) + +# Cycle to run EnKF (set to BOTH for both gfs and gdas) +export EUPD_CYC="gdas" + +# GFS cycle info +export gfs_cyc=4 # 0: no GFS cycle, 1: 00Z only, 2: 00Z and 12Z only, 4: all 4 cycles. + +# GFS output and frequency +export FHMIN_GFS=0 + +export FHMAX_GFS_00=${FHMAX_GFS_00:-384} +export FHMAX_GFS_06=${FHMAX_GFS_06:-384} +export FHMAX_GFS_12=${FHMAX_GFS_12:-384} +export FHMAX_GFS_18=${FHMAX_GFS_18:-384} +export FHMAX_GFS=$(eval echo \${FHMAX_GFS_$cyc}) + +export FHOUT_GFS=${FHOUT_GFS:-3} +export FHMAX_HF_GFS=${FHMAX_HF_GFS:-0} +export FHOUT_HF_GFS=${FHOUT_HF_GFS:-1} +if (( gfs_cyc != 0 )); then + export STEP_GFS=$(( 24 / gfs_cyc )) +else + export STEP_GFS="0" +fi +export ILPOST=1 # gempak output frequency up to F120 + +# GFS restart interval in hours +export restart_interval_gfs=0 + +# I/O QUILTING, true--use Write Component; false--use GFDL FMS +# if quilting=true, choose OUTPUT_GRID as cubed_sphere_grid in netcdf or gaussian_grid +# if gaussian_grid, set OUTPUT_FILE for nemsio or netcdf +# WRITE_DOPOST=true, use inline POST +export QUILTING=".true." +export OUTPUT_GRID="gaussian_grid" +export OUTPUT_FILE="netcdf" +export WRITE_DOPOST=".true." +export WRITE_NSFLIP=".true." + +# suffix options depending on file format +if [ $OUTPUT_FILE = "netcdf" ]; then + export SUFFIX=".nc" + export NEMSIO_IN=".false." + export NETCDF_IN=".true." +else + export SUFFIX=".nemsio" + export NEMSIO_IN=".true." + export NETCDF_IN=".false." +fi + +# IAU related parameters +export DOIAU="YES" # Enable 4DIAU for control with 3 increments +export IAUFHRS="3,6,9" +export IAU_FHROT=$(echo $IAUFHRS | cut -c1) +export IAU_DELTHRS=6 +export IAU_OFFSET=6 +export DOIAU_ENKF=${DOIAU:-"YES"} # Enable 4DIAU for EnKF ensemble +export IAUFHRS_ENKF="3,6,9" +export IAU_DELTHRS_ENKF=6 +# Check if cycle is cold starting, DOIAU off, or free-forecast mode +if [[ "$MODE" = "cycled" && "$SDATE" = "$CDATE" && $EXP_WARM_START = ".false." ]] || [[ "$DOIAU" = "NO" ]] || [[ "$MODE" = "forecast-only" && $EXP_WARM_START = ".false." ]] ; then + export IAU_OFFSET=0 + export IAU_FHROT=0 +fi + +# Use Jacobians in eupd and thereby remove need to run eomg +export lobsdiag_forenkf=".true." + +# run GLDAS to spin up land ICs +export DO_GLDAS="YES" +export gldas_cyc=00 + +# Exception handling that when DO_GLDAS is set, the FHOUT must be 1 +if [ $DO_GLDAS = "YES" ]; then + export FHOUT=1 +fi + +# if [[ "$SDATE" -lt "2019020100" ]]; then # no rtofs in GDA +# export DO_WAVE="NO" +# echo "WARNING: Wave suite turned off due to lack of RTOFS in GDA for SDATE" +# fi + +# Microphysics Options: 99-ZhaoCarr, 8-Thompson; 6-WSM6, 10-MG, 11-GFDL +export imp_physics=11 + +# Shared parameters +# DA engine +export DO_JEDIVAR="NO" +export DO_JEDIENS="NO" +export DO_JEDIOCNVAR="NO" + +# Hybrid related +export DOHYBVAR="YES" +export NMEM_ENKF=0 +export NMEM_EFCS=30 +export SMOOTH_ENKF="NO" +export l4densvar=".true." +export lwrite4danl=".true." + +# EnKF output frequency +if [ $DOHYBVAR = "YES" ]; then + export FHMIN_ENKF=3 + export FHMAX_ENKF=9 + export FHMAX_ENKF_GFS=120 + if [ $l4densvar = ".true." ]; then + export FHOUT=1 + export FHOUT_ENKF=1 + else + export FHOUT_ENKF=3 + fi +fi + +# turned on nsst in anal and/or fcst steps, and turn off rtgsst +export DONST="YES" +if [ $DONST = "YES" ]; then export FNTSFA=" "; fi + +# The switch to apply SST elevation correction or not +export nst_anl=.true. + +# Make the nsstbufr file on the fly or use the GDA version +export MAKE_NSSTBUFR="NO" + +# Make the aircraft prepbufr file on the fly or use the GDA version +export MAKE_ACFTBUFR="NO" + +# Analysis increments to zero in CALCINCEXEC +export INCREMENTS_TO_ZERO="'liq_wat_inc','icmr_inc'" + +if [ $OUTPUT_FILE = "nemsio" ]; then + export DO_CALC_INCREMENT="YES" + export DO_CALC_ANALYSIS="NO" +fi + +# Stratospheric increments to zero +export INCVARS_ZERO_STRAT="'sphum_inc','liq_wat_inc','icmr_inc'" +export INCVARS_EFOLD="5" + +# Swith to generate netcdf or binary diagnostic files. If not specified, +# script default to binary diagnostic files. Set diagnostic file +# variables here since used in both DA and vrfy jobs +export netcdf_diag=".true." +export binary_diag=".false." + +# Verification options +export DO_METP="YES" # Run METPLUS jobs - set METPLUS settings in config.metp + +# Archiving options +export HPSSARCH="NO" # save data to HPSS archive +export LOCALARCH="NO" # save data to local archive +if [[ $HPSSARCH = "YES" ]] && [[ $LOCALARCH = "YES" ]]; then + echo "Both HPSS and local archiving selected. Please choose one or the other." + exit 2 +fi +export ARCH_CYC=00 # Archive data at this cycle for warm_start capability +export ARCH_WARMICFREQ=4 # Archive frequency in days for warm_start capability +export ARCH_FCSTICFREQ=1 # Archive frequency in days for gdas and gfs forecast-only capability + +export DELETE_COM_IN_ARCHIVE_JOB="YES" # NO=retain ROTDIR. YES default in arch.sh and earc.sh. + +echo "END: config.base" diff --git a/test/soca/gw/config.yaml b/test/soca/gw/config.yaml new file mode 100644 index 000000000..9ad0d0214 --- /dev/null +++ b/test/soca/gw/config.yaml @@ -0,0 +1,7 @@ +ocnanal: + SOCA_INPUT_FIX_DIR: '@SOCA_INPUT_FIX_DIR@' + CASE_ANL: 'C24' + COMIN_OBS: '@COMIN_OBS@' + SOCA_NINNER: 3 + R2D2_OBS_SRC: 'gdasapp' + R2D2_OBS_DUMP: 'soca' diff --git a/test/soca/gw/jjob_prep.sh b/test/soca/gw/jjob_prep.sh new file mode 100755 index 000000000..979c1994f --- /dev/null +++ b/test/soca/gw/jjob_prep.sh @@ -0,0 +1,13 @@ +#!/bin/bash +bindir=$1 +srcdir=$2 + +# export env. var. +source "${srcdir}/test/soca/gw/runtime_vars.sh" "${bindir}" "${srcdir}" + +# prepare background from previous cycle +mkdir -p "${ROTDIR}/${PSLOT}/gdas.${PDY}/${gcyc}/ocean/" +cp -r "${bindir}/test/soca/bkg/"* "${ROTDIR}/${PSLOT}/gdas.${PDY}/${gcyc}/ocean/" + +# run prep jjob +"${HOMEgfs}/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_PREP" diff --git a/test/soca/gw/jjob_run.sh b/test/soca/gw/jjob_run.sh new file mode 100755 index 000000000..c66a8ef78 --- /dev/null +++ b/test/soca/gw/jjob_run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +bindir=$1 +srcdir=$2 + +# export env. var. +source "${srcdir}/test/soca/gw/runtime_vars.sh" "${bindir}" "${srcdir}" + +# run DA jjob +"${HOMEgfs}/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_RUN" diff --git a/test/soca/gw/runtime_vars.sh b/test/soca/gw/runtime_vars.sh new file mode 100644 index 000000000..5430eeccb --- /dev/null +++ b/test/soca/gw/runtime_vars.sh @@ -0,0 +1,16 @@ +#!/bin/bash +bindir=$1 +srcdir=$2 + +HOMEgfs=$(readlink -f "${srcdir}/../../") +export HOMEgfs +export PDY=20180415 +export cyc=12 +export gcyc=06 +export CDATE=2018041512 +export ROTDIR="${bindir}/test/soca/gw/testrun/ROTDIRS" +export DATAROOT="${bindir}/test/soca/gw/testrun/RUNDIRS/gdas_test" +export COMIN_GES="${bindir}/test/soca/bkg" +export PSLOT='gdas_test' +export EXPDIRS="${bindir}/test/soca/gw/testrun/experiments/" +export EXPDIR="${bindir}/test/soca/gw/testrun/experiments/${PSLOT}" diff --git a/test/soca/gw/setup_workflow_exp.sh b/test/soca/gw/setup_workflow_exp.sh new file mode 100755 index 000000000..2210391ab --- /dev/null +++ b/test/soca/gw/setup_workflow_exp.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# ctest to create an experiment directory for global-workflow +bindir=$1 +srcdir=$2 + +# export env. var. +source "${srcdir}/test/soca/gw/runtime_vars.sh" "${bindir}" "${srcdir}" + +# test experiment variables +idate=${PDY}${cyc} +edate=${PDY}${cyc} +app=ATM # NOTE make this S2SWA soon +starttype='warm' +gfscyc='4' +resdet='48' +resens='24' +nens=0 +configdir=${srcdir}/../../parm/config + +# clean previous experiment +rm -rf "${ROTDIR}" "${EXPDIRS}" + +# run the script +ln -sf "${srcdir}/../../workflow/setup_expt.py" . + +# make a copy of parm/configdir +# TODO: remove when all the config.* that need to have variables substituted have been +# updated in the g-w +cp -r "${configdir}" config + +# edit config.yaml +cp "${srcdir}/test/soca/gw/config.yaml" . +soca_input_fix_dir="${bindir}/soca_static" +comin_obs="${bindir}/test/soca/obs/r2d2-shared" +sed -i -e "s~@SOCA_INPUT_FIX_DIR@~${soca_input_fix_dir}~g" config.yaml +sed -i -e "s~@COMIN_OBS@~${comin_obs}~g" config.yaml + +echo "Running global-workflow experiment generation script" +./setup_expt.py cycled --idate "${idate}" \ + --edate "${edate}" \ + --app "${app}" \ + --start "${starttype}" \ + --gfs_cyc "${gfscyc}" \ + --resdet "${resdet}" \ + --resens "${resens}" \ + --nens "${nens}" \ + --pslot "${PSLOT}" \ + --configdir config \ + --comrot "${ROTDIR}" \ + --expdir "${EXPDIRS}" \ + --yaml config.yaml + +# get the machine name from config.base +machine="$(echo "$(grep "export machine=" "${EXPDIRS}/${PSLOT}/config.base")" | cut -d "=" -f2)" +machine=$(echo "${machine}" | sed 's/[^0-9A-Z]*//g') + +# over-write config.base +cp "${srcdir}/test/soca/gw/config.base" "${EXPDIRS}/${PSLOT}/" +HOMEgfs=$(readlink -f "${srcdir}/../..") +STMP="${bindir}/test/soca/gw/testrun" +sed -i -e "s~@MACHINE@~${machine}~g" "${EXPDIRS}/${PSLOT}/config.base" +sed -i -e "s~@HOMEgfs@~${HOMEgfs}~g" "${EXPDIRS}/${PSLOT}/config.base" +sed -i -e "s~@STMP@~${STMP}~g" "${EXPDIRS}/${PSLOT}/config.base" +sed -i -e "s~@ROTDIRS@~${ROTDIR}~g" "${EXPDIRS}/${PSLOT}/config.base" +sed -i -e "s~@EXPDIRS@~${EXPDIRS}~g" "${EXPDIRS}/${PSLOT}/config.base" + +exit $? diff --git a/test/soca/test_prep.sh b/test/soca/test_prep.sh index d215f6772..763f5503b 100755 --- a/test/soca/test_prep.sh +++ b/test/soca/test_prep.sh @@ -7,7 +7,7 @@ project_source_dir=$2 source ${project_source_dir}/test/soca/test_utils.sh # Remove previously fetched obs -rm -f ${project_binary_dir}/test/soca/3dvar/gdas.t12z.{sst,adt,sss,salt,icec}*.nc4 +rm -f ${project_binary_dir}/test/soca/3dvar/ocnanal_2018041512/obs/gdas.t12z.{sst,adt,sss,salt,icec}*.nc4 # Export runtime env. variables source ${project_source_dir}/test/soca/runtime_vars.sh $project_binary_dir $project_source_dir @@ -40,15 +40,15 @@ for o in $obslist; do continue ;; "ocn_filename:") - base=${project_binary_dir}/test/soca/bkg/ + base=${project_binary_dir}/test/soca/3dvar/ocnanal_2018041512/bkg/ continue ;; "ice_filename:") - base=${project_binary_dir}/test/soca/bkg/ + base=${project_binary_dir}/test/soca/3dvar/ocnanal_2018041512/bkg/ continue ;; "remap_filename:") - base='' + base=${project_binary_dir}/test/soca/3dvar/ocnanal_2018041512/ continue ;; esac