From 57e2a50d477e077670950f746db794adac03dd87 Mon Sep 17 00:00:00 2001 From: AndrewEichmann-NOAA <58948505+AndrewEichmann-NOAA@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:13:13 -0400 Subject: [PATCH 1/5] adding titles to vrfy plots (#578) * first pass at adding titles to vrfy plots * python style * some streamlining * mv gsw before vader --------- Co-authored-by: Guillaume Vernieres --- CMakeLists.txt | 4 +- scripts/exgdas_global_marine_analysis_vrfy.py | 1 + ush/soca/soca_vrfy.py | 42 ++++++++++++++----- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7530e2cf1..008fa630f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,9 @@ if(BUILD_GDASBUNDLE) ecbuild_bundle( PROJECT gsibec GIT "https://github.com/GEOS-ESM/GSIbec.git" TAG 1.1.2 ) endif() +# Gibbs seawater + ecbuild_bundle( PROJECT gsw GIT "https://github.com/jcsda-internal/GSW-Fortran.git" BRANCH develop ) + # Core JEDI repositories ecbuild_bundle( PROJECT oops GIT "https://github.com/jcsda/oops.git" BRANCH develop ) ecbuild_bundle( PROJECT vader GIT "https://github.com/jcsda/vader.git" BRANCH develop ) @@ -92,7 +95,6 @@ if(BUILD_GDASBUNDLE) if ( BUILD_ICEPACK ) ecbuild_bundle( PROJECT icepack GIT "https://github.com/JCSDA-internal/Icepack.git" BRANCH feature/ecbuild-new ) endif() - ecbuild_bundle( PROJECT gsw GIT "https://github.com/jcsda-internal/GSW-Fortran.git" BRANCH develop ) ecbuild_bundle( PROJECT mom6 GIT "https://github.com/jcsda-internal/MOM6.git" BRANCH main-ecbuild RECURSIVE ) ecbuild_bundle( PROJECT soca GIT "https://github.com/jcsda-internal/soca.git" BRANCH develop ) diff --git a/scripts/exgdas_global_marine_analysis_vrfy.py b/scripts/exgdas_global_marine_analysis_vrfy.py index fa72a148b..ef2d5d7f9 100755 --- a/scripts/exgdas_global_marine_analysis_vrfy.py +++ b/scripts/exgdas_global_marine_analysis_vrfy.py @@ -40,6 +40,7 @@ diagdir = os.path.join(comout, 'diags') HOMEgfs = os.getenv('HOMEgfs') + ####################################### # ocean increment ####################################### diff --git a/ush/soca/soca_vrfy.py b/ush/soca/soca_vrfy.py index 2c8d602a0..c1b765dce 100755 --- a/ush/soca/soca_vrfy.py +++ b/ush/soca/soca_vrfy.py @@ -18,6 +18,9 @@ def plotConfig(grid_file=[], data_file=[], variable=[], + PDY=os.getenv('PDY'), + cyc=os.getenv('cyc'), + exp=os.getenv('PSLOT'), levels=[], bounds=[], colormap=[], @@ -38,6 +41,9 @@ def plotConfig(grid_file=[], config['comout'] = comout # output directory config['grid file'] = grid_file config['fields file'] = data_file + config['PDY'] = PDY + config['cyc'] = cyc + config['exp'] = exp config['levels'] = [1] config['colormap'] = colormap config['bounds'] = bounds @@ -63,15 +69,22 @@ def plotHorizontalSlice(config): dirname = os.path.join(config['comout'], config['variable']) os.makedirs(dirname, exist_ok=True) - if config['variable'] in ['Temp', 'Salt', 'u', 'v']: + variable = config['variable'] + exp = config['exp'] + PDY = config['PDY'] + cyc = config['cyc'] + + if variable in ['Temp', 'Salt', 'u', 'v']: level = config['levels'][0] - slice_data = np.squeeze(data[config['variable']])[level, :, :] - label_colorbar = config['variable']+' Level '+str(level) - figname = os.path.join(dirname, config['variable']+'_Level_'+str(level)) + slice_data = np.squeeze(data[variable])[level, :, :] + label_colorbar = variable+' Level '+str(level) + figname = os.path.join(dirname, variable+'_Level_'+str(level)) + title = f"{exp} {PDY} {cyc} {variable} Level {level}" else: - slice_data = np.squeeze(data[config['variable']]) - label_colorbar = config['variable'] - figname = os.path.join(dirname, config['variable']+'_'+config['proj']) + slice_data = np.squeeze(data[variable]) + label_colorbar = variable + figname = os.path.join(dirname, variable+'_'+config['proj']) + title = f"{exp} {PDY} {cyc} {variable}" bounds = config['bounds'] @@ -86,6 +99,7 @@ def plotHorizontalSlice(config): plt.colorbar(label=label_colorbar, shrink=0.5, orientation='horizontal') ax.coastlines() # TODO: make this work on hpc ax.gridlines(draw_labels=True) + ax.set_title(title) if config['proj'] == 'South': ax.set_extent([-180, 180, -90, -50], ccrs.PlateCarree()) if config['proj'] == 'North': @@ -98,11 +112,15 @@ def plotZonalSlice(config): """ pcolormesh of a zonal slice of an ocean field """ + variable = config['variable'] + exp = config['exp'] + PDY = config['PDY'] + cyc = config['cyc'] lat = float(config['lat']) grid = xr.open_dataset(config['grid file']) data = xr.open_dataset(config['fields file']) lat_index = np.argmin(np.array(np.abs(np.squeeze(grid.lat)[:, 0]-lat))) - slice_data = np.squeeze(np.array(data[config['variable']]))[:, lat_index, :] + slice_data = np.squeeze(np.array(data[variable]))[:, lat_index, :] depth = np.squeeze(np.array(grid['h']))[:, lat_index, :] depth[np.where(np.abs(depth) > 10000.0)] = 0.0 depth = np.cumsum(depth, axis=0) @@ -112,11 +130,13 @@ def plotZonalSlice(config): plt.pcolormesh(x, -depth, slice_data, vmin=bounds[0], vmax=bounds[1], cmap=config['colormap']) - plt.colorbar(label=config['variable']+' Lat '+str(lat), shrink=0.5, orientation='horizontal') + plt.colorbar(label=variable+' Lat '+str(lat), shrink=0.5, orientation='horizontal') ax.set_ylim(-config['max depth'], 0) - dirname = os.path.join(config['comout'], config['variable']) + title = f"{exp} {PDY} {cyc} {variable} lat {int(lat)}" + ax.set_title(title) + dirname = os.path.join(config['comout'], variable) os.makedirs(dirname, exist_ok=True) - figname = os.path.join(dirname, config['variable'] + + figname = os.path.join(dirname, variable + 'zonal_lat_'+str(int(lat)) + '_' + str(int(config['max depth'])) + 'm') plt.savefig(figname, bbox_inches='tight', dpi=600) From cc68184c0766f0d6f6d52e90760b2981109de16c Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Fri, 25 Aug 2023 08:30:59 -0400 Subject: [PATCH 2/5] Bugfix for atm Hybrid 3DEnVar tests (#584) --- test/atm/global-workflow/jjob_var_init.sh | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/atm/global-workflow/jjob_var_init.sh b/test/atm/global-workflow/jjob_var_init.sh index 8de5cb329..2fe0510cd 100755 --- a/test/atm/global-workflow/jjob_var_init.sh +++ b/test/atm/global-workflow/jjob_var_init.sh @@ -100,6 +100,30 @@ for file in $flist; do done +# Link member atmospheric background on tiles and atmf006 +dpath=enkfgdas.$gPDY/$gcyc +for imem in $(seq 1 $NMEM_ENS); do + memchar="mem"$(printf %03i $imem) + + MEMDIR=${memchar} RUN=${RUN} YMD=${gPDY} HH=${gcyc} generate_com -x \ + COM_ATMOS_HISTORY_PREV_ENS:COM_ATMOS_HISTORY_TMPL \ + COM_ATMOS_RESTART_PREV_ENS:COM_ATMOS_RESTART_TMPL + COM_ATMOS_RESTART_PREV_DIRNAME_ENS=$(dirname $COM_ATMOS_RESTART_PREV_ENS) + + source=$GDASAPP_TESTDATA/lowres/$dpath/$memchar/model_data/atmos + target=$COM_ATMOS_RESTART_PREV_DIRNAME_ENS + mkdir -p $target + rm -rf $target/restart + ln -fs $source/restart $target/ + + source=$GDASAPP_TESTDATA/lowres/$dpath/$memchar/model_data/atmos/history + target=$COM_ATMOS_HISTORY_PREV_ENS + mkdir -p $target + rm -rf $target/enkfgdas.t${gcyc}z.atmf006.nc + ln -fs $source/enkfgdas.t${gcyc}z.atmf006.nc $target/ +done + + # Execute j-job if [ $machine = 'HERA' ]; then sbatch --ntasks=1 --account=$ACCOUNT --qos=batch --time=00:10:00 --export=ALL --wait ${HOMEgfs}/jobs/JGLOBAL_ATM_ANALYSIS_INITIALIZE From f50fcfd82f870e88ae76921544757d88d49fb4e2 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Fri, 25 Aug 2023 10:03:29 -0400 Subject: [PATCH 3/5] Hotfix for bugfix (#585) Missing one thing that is needed to actually fix issue in PR#584 --- test/atm/global-workflow/jjob_var_init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/atm/global-workflow/jjob_var_init.sh b/test/atm/global-workflow/jjob_var_init.sh index 2fe0510cd..c16c55e3e 100755 --- a/test/atm/global-workflow/jjob_var_init.sh +++ b/test/atm/global-workflow/jjob_var_init.sh @@ -21,7 +21,7 @@ export COMIN_GES=${bindir}/test/atm/bkg export pid=${pid:-$$} export jobid=$pid export COMROOT=$DATAROOT -export NMEM_ENS=0 +export NMEM_ENS=3 export ACCOUNT=da-cpu export COM_TOP=$ROTDIR From dd4eb2421dcc1f41d1c05256077326604ee4baa8 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Fri, 25 Aug 2023 13:14:27 -0400 Subject: [PATCH 4/5] Yet another hotfix for hybrid 3DEnVar (#586) This should (hopefully) finally fix the hybrid 3DEnVar tests. This is the gift that keeps on giving! --- test/atm/global-workflow/jjob_var_init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/atm/global-workflow/jjob_var_init.sh b/test/atm/global-workflow/jjob_var_init.sh index c16c55e3e..0d88c2174 100755 --- a/test/atm/global-workflow/jjob_var_init.sh +++ b/test/atm/global-workflow/jjob_var_init.sh @@ -105,7 +105,7 @@ dpath=enkfgdas.$gPDY/$gcyc for imem in $(seq 1 $NMEM_ENS); do memchar="mem"$(printf %03i $imem) - MEMDIR=${memchar} RUN=${RUN} YMD=${gPDY} HH=${gcyc} generate_com -x \ + MEMDIR=${memchar} RUN=enkf${RUN} YMD=${gPDY} HH=${gcyc} generate_com -x \ COM_ATMOS_HISTORY_PREV_ENS:COM_ATMOS_HISTORY_TMPL \ COM_ATMOS_RESTART_PREV_ENS:COM_ATMOS_RESTART_TMPL COM_ATMOS_RESTART_PREV_DIRNAME_ENS=$(dirname $COM_ATMOS_RESTART_PREV_ENS) From 9fa348f92a0bd5f3d073f22e73bf06dd6ad9db15 Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Mon, 28 Aug 2023 08:59:42 -0400 Subject: [PATCH 5/5] Remove run_jedi_exe and cleanup legacy YAML tools (#581) * Start to remove legacy genYAML; remove run_jedi_exe * just prescribe the land YAML for testing * remove tests * Try to fix soca YAML * Fixes for the SOCA tests * Delete genYAML_output_letkfoi.yaml --- scripts/exgdas_global_marine_analysis_prep.py | 21 +- test/CMakeLists.txt | 40 ---- test/atm/global-workflow/CMakeLists.txt | 34 --- .../global-workflow/run_jedi_exe_3denvar.sh | 124 ----------- .../global-workflow/run_jedi_exe_3dhofx.sh | 114 ---------- .../atm/global-workflow/run_jedi_exe_3dvar.sh | 123 ---------- .../atm/global-workflow/run_jedi_exe_letkf.sh | 122 ---------- test/genYAML_prep.sh | 24 -- test/genYAML_prep_aero.sh | 24 -- test/genYAML_prep_land.sh | 25 --- .../land/letkfoi_land.yaml | 0 test/land/letkfoi_snowda.sh | 2 +- ush/examples/run_jedi_exe/3denvar_hera.yaml | 37 --- ush/examples/run_jedi_exe/3denvar_orion.yaml | 37 --- ush/examples/run_jedi_exe/3dhofx_hera.yaml | 27 --- ush/examples/run_jedi_exe/3dhofx_orion.yaml | 27 --- ush/examples/run_jedi_exe/3dvar_hera.yaml | 36 --- ush/examples/run_jedi_exe/3dvar_orion.yaml | 36 --- ush/examples/run_jedi_exe/4dhofx_hera.yaml | 28 --- ush/examples/run_jedi_exe/4dhofx_orion.yaml | 28 --- ush/examples/run_jedi_exe/letkf_hera.yaml | 33 --- ush/examples/run_jedi_exe/letkf_orion.yaml | 33 --- ush/genYAML | 17 +- ush/run_jedi_exe.py | 210 ------------------ ush/ufoeval/run_ufo_hofx_test.sh | 24 +- ush/ufsda/__init__.py | 1 - ush/ufsda/genYAML.py | 122 ---------- 27 files changed, 33 insertions(+), 1316 deletions(-) delete mode 100755 test/atm/global-workflow/run_jedi_exe_3denvar.sh delete mode 100755 test/atm/global-workflow/run_jedi_exe_3dhofx.sh delete mode 100755 test/atm/global-workflow/run_jedi_exe_3dvar.sh delete mode 100755 test/atm/global-workflow/run_jedi_exe_letkf.sh delete mode 100755 test/genYAML_prep.sh delete mode 100755 test/genYAML_prep_aero.sh delete mode 100755 test/genYAML_prep_land.sh rename ush/land/genYAML_output_letkfoi.yaml => test/land/letkfoi_land.yaml (100%) delete mode 100644 ush/examples/run_jedi_exe/3denvar_hera.yaml delete mode 100644 ush/examples/run_jedi_exe/3denvar_orion.yaml delete mode 100644 ush/examples/run_jedi_exe/3dhofx_hera.yaml delete mode 100644 ush/examples/run_jedi_exe/3dhofx_orion.yaml delete mode 100644 ush/examples/run_jedi_exe/3dvar_hera.yaml delete mode 100644 ush/examples/run_jedi_exe/3dvar_orion.yaml delete mode 100644 ush/examples/run_jedi_exe/4dhofx_hera.yaml delete mode 100644 ush/examples/run_jedi_exe/4dhofx_orion.yaml delete mode 100644 ush/examples/run_jedi_exe/letkf_hera.yaml delete mode 100644 ush/examples/run_jedi_exe/letkf_orion.yaml delete mode 100755 ush/run_jedi_exe.py delete mode 100644 ush/ufsda/genYAML.py diff --git a/scripts/exgdas_global_marine_analysis_prep.py b/scripts/exgdas_global_marine_analysis_prep.py index 73f67b4e9..34eca899c 100755 --- a/scripts/exgdas_global_marine_analysis_prep.py +++ b/scripts/exgdas_global_marine_analysis_prep.py @@ -517,22 +517,17 @@ def find_clim_ens(input_date): # write the two seaice analysis to model change of variable yamls varchgyamls = ['soca_2cice_arctic.yaml', 'soca_2cice_antarctic.yaml'] soca2cice_cfg = { - "template": "", - "output": "", - "config": { - "OCN_ANA": "./Data/ocn.3dvarfgat_pseudo.an."+window_middle_iso+".nc", - "ICE_ANA": "./Data/ice.3dvarfgat_pseudo.an."+window_middle_iso+".nc", - "ICE_RST": ice_rst_ana, - "FCST_BEGIN": fcst_begin.strftime('%Y-%m-%dT%H:%M:%SZ') - } + "OCN_ANA": "./Data/ocn.3dvarfgat_pseudo.an."+window_middle_iso+".nc", + "ICE_ANA": "./Data/ice.3dvarfgat_pseudo.an."+window_middle_iso+".nc", + "ICE_RST": ice_rst_ana, + "FCST_BEGIN": fcst_begin.strftime('%Y-%m-%dT%H:%M:%SZ') } varchgyamls = ['soca_2cice_arctic.yaml', 'soca_2cice_antarctic.yaml'] for varchgyaml in varchgyamls: - soca2cice_cfg['template'] = os.path.join(gdas_home, 'parm', 'soca', 'varchange', varchgyaml) - f = open('tmp.yaml', 'w') - # TODO: use YAMLFile instead - yaml.dump(soca2cice_cfg, f, sort_keys=False, default_flow_style=False) - ufsda.genYAML.genYAML('tmp.yaml', output=varchgyaml) + soca2cice_cfg_template = os.path.join(gdas_home, 'parm', 'soca', 'varchange', varchgyaml) + outyaml = YAMLFile(path=soca2cice_cfg_template) + outyaml = Template.substitute_structure(outyaml, TemplateConstants.DOLLAR_PARENTHESES, soca2cice_cfg.get) + outyaml.save(varchgyaml) # prepare yaml for soca to MOM6 IAU increment logging.info(f"---------------- generate soca to MOM6 IAU yaml") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 51e14f207..61c45509e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -121,46 +121,6 @@ add_test(NAME test_gdasapp_jedi_increment_to_fv3 COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/ush/jediinc2fv3.py ${PROJECT_BINARY_DIR}/test/testdata/atmges_compress.nc4 ${PROJECT_BINARY_DIR}/test/testdata/atminc_compress.nc4 ${PROJECT_BINARY_DIR}/test/testoutput/fv_increment.nc WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) -# test for YAML generation from a template -add_test(NAME test_gdasapp_genYAML_prep - COMMAND ${PROJECT_SOURCE_DIR}/test/genYAML_prep.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -add_test(NAME test_gdasapp_genYAML_run - COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/ush/genYAML --config ${PROJECT_BINARY_DIR}/test/testoutput/genYAML_example.yaml - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) -set_tests_properties( - test_gdasapp_genYAML_run -PROPERTIES -ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/ush:$ENV{PYTHONPATH};PARMgfs=${PROJECT_SOURCE_DIR}/parm") - -# test for YAML generation from a template for land DA -add_test(NAME test_gdasapp_genYAML_land_prep - COMMAND ${PROJECT_SOURCE_DIR}/test/genYAML_prep_land.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -add_test(NAME test_gdasapp_genYAML_land_run - COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/ush/genYAML --config ${PROJECT_BINARY_DIR}/test/testoutput/genYAML_example_land.yaml - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) -set_tests_properties( - test_gdasapp_genYAML_land_run -PROPERTIES -ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/ush:$ENV{PYTHONPATH};PARMgfs=${PROJECT_SOURCE_DIR}/parm") - - -# test for YAML generation from a template for aero DA -add_test(NAME test_gdasapp_genYAML_aero_prep - COMMAND ${PROJECT_SOURCE_DIR}/test/genYAML_prep_aero.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -add_test(NAME test_gdasapp_genYAML_aero_run - COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/ush/genYAML --config ${PROJECT_BINARY_DIR}/test/testoutput/genYAML_example_aero.yaml - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) -set_tests_properties( - test_gdasapp_genYAML_aero_run -PROPERTIES -ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/ush:$ENV{PYTHONPATH};PARMgfs=${PROJECT_SOURCE_DIR}/parm") - # test for converting ewok yaml to gdas add_test(NAME test_gdasapp_convert_ewok_yaml COMMAND ${PROJECT_SOURCE_DIR}/test/convert_ewok_yaml.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} diff --git a/test/atm/global-workflow/CMakeLists.txt b/test/atm/global-workflow/CMakeLists.txt index 60c500ca5..c911f1a9f 100644 --- a/test/atm/global-workflow/CMakeLists.txt +++ b/test/atm/global-workflow/CMakeLists.txt @@ -1,30 +1,6 @@ # test for creating an experiment directory within the global-workflow file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun) -# test for ush/run_jedi_exe.py 3dhofx -add_test(NAME test_gdasapp_run_jedi_exe_3dhofx - COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_3dhofx.sh - ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -# test for ush/run_jedi_exe.py 3dvar -add_test(NAME test_gdasapp_run_jedi_exe_3dvar - COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_3dvar.sh - ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -# test for ush/run_jedi_exe.py 3denvar -add_test(NAME test_gdasapp_run_jedi_exe_3denvar - COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_3denvar.sh - ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - -# test for ush/run_jedi_exe.py letkf -add_test(NAME test_gdasapp_run_jedi_exe_letkf - COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/run_jedi_exe_letkf.sh - ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/) - add_test(NAME test_gdasapp_setup_atm_cycled_exp COMMAND ${PROJECT_SOURCE_DIR}/test/atm/global-workflow/setup_workflow_exp.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} @@ -60,13 +36,3 @@ add_test(NAME test_gdasapp_atm_jjob_ens_final ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test/atm/global-workflow/testrun) -# python fix - set_tests_properties( - test_gdasapp_run_jedi_exe_3dhofx - test_gdasapp_run_jedi_exe_3dvar - test_gdasapp_run_jedi_exe_3denvar - test_gdasapp_run_jedi_exe_letkf - PROPERTIES - ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}:$ENV{PYTHONPATH}" - ) - diff --git a/test/atm/global-workflow/run_jedi_exe_3denvar.sh b/test/atm/global-workflow/run_jedi_exe_3denvar.sh deleted file mode 100755 index 25824dcb4..000000000 --- a/test/atm/global-workflow/run_jedi_exe_3denvar.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -set -x - -bindir=$1 -srcdir=$2 - -# Identify machine -if [[ -d /scratch1 ]] ; then - machine="hera" -elif [[ -d /work ]] ; then - machine="orion" -else - echo "UNSUPPORTED MACHINE. ABORT" - exit 99 -fi - -# Load modules -#set +x -#module use ${srcdir}/modulefiles -#module load GDAS/${machine} -#set -x -module list - -# Set machine dependent variables -if [ "$machine" = "hera" ] ; then - partition="hera" - gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix" -elif [ "$machine" = "orion" ]; then - partition="orion" - gdasfix="/work2/noaa/da/cmartin/GDASApp/fix" -fi - -# Setup python path for workflow utilities and tasks -export HOMEgfs=$srcdir/../../ # TODO: HOMEgfs had to be hard-coded in config -echo $HOMEgfs -wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src" -PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}" -export PYTHONPATH - -# Create test run directory -mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3denvar -cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3denvar - -# Create input yaml -cat > ./3denvar_example.yaml << EOF -working directory: ./ -GDASApp home: ${srcdir} -GDASApp mode: variational -template: ${srcdir}/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: ${srcdir}/parm/atm/berror/hybvar_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: ${srcdir}/parm/atm/obs/config - executable: ${bindir}/bin/fv3jedi_var.x - obs_list: ${srcdir}/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: ${gdasfix} - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C48 - case_enkf: C48 - staticb_type: gsibec - dohybvar: true - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: ${machine} - account: da-cpu - queue: batch - partition: ${partition} - walltime: '30:00' - ntasks: 6 - modulepath: ${srcdir}/modulefiles -EOF - -# Execute run_jedi_exe.py -if [ -e stdout.txt ]; then - rm -f stdout.txt -fi -${srcdir}/ush/run_jedi_exe.py -c ./3denvar_example.yaml > stdout.txt 2>&1 -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Wait and ensure buffers flushed to disk -sleep 5 -sync stdout.txt - -# Check for job submission error -error=$(grep "sbatch: error" stdout.txt | wc -l) -if [ $error -ne 0 ]; then - rc=$error - exit $rc -fi - -# Cancel submitted job -jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}') -scancel $jobid -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Check for valid yaml files -ylist="3denvar_example.yaml gdas_variational.yaml" -for yfile in $ylist; do - python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile - rc=$? - if [ $rc -ne 0 ]; then - exit $rc - fi -done - -exit $rc diff --git a/test/atm/global-workflow/run_jedi_exe_3dhofx.sh b/test/atm/global-workflow/run_jedi_exe_3dhofx.sh deleted file mode 100755 index 0cb06d109..000000000 --- a/test/atm/global-workflow/run_jedi_exe_3dhofx.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -set -x - -bindir=$1 -srcdir=$2 - -# Identify machine -if [[ -d /scratch1 ]] ; then - machine="hera" -elif [[ -d /work ]] ; then - machine="orion" -else - echo "UNSUPPORTED MACHINE. ABORT" - exit 99 -fi - -# Load modules -#set +x -#module use ${srcdir}/modulefiles -#module load GDAS/${machine} -#set -x -module list - -# Set machine dependent variables -if [ "$machine" = "hera" ] ; then - partition="hera" - gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix" -elif [ "$machine" = "orion" ]; then - partition="orion" - gdasfix="/work2/noaa/da/cmartin/GDASApp/fix" -fi - -# Setup python path for workflow utilities and tasks -export HOMEgfs=$srcdir/../../ # TODO: HOMEgfs had to be hard-coded in config -echo $HOMEgfs -wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src" -PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}" -export PYTHONPATH - -# Create test run directory -mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_hofx3d -cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_hofx3d - -# Create input yaml -cat > ./3dhofx_example.yaml << EOF -working directory: ./ -GDASApp home: ${srcdir} -GDASApp mode: hofx -template: ${srcdir}/parm/atm/hofx/hofx_nomodel.yaml -config: - obs_yaml_dir: ${srcdir}/parm/atm/obs/config - executable: ${bindir}/bin/fv3jedi_hofx_nomodel.x - obs_list: ${srcdir}/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: ${gdasfix} - atm: true - layout_x: 3 - layout_y: 2 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - levs: 128 - interp_method: barycentric -job options: - machine: ${machine} - account: da-cpu - queue: batch - partition: ${partition} - walltime: '30:00' - ntasks: 36 - ntasks-per-node: 9 - modulepath: ${srcdir}/modulefiles -EOF - -# Execute run_jedi_exe.py -if [ -e stdout.txt ]; then - rm -f stdout.txt -fi -${srcdir}/ush/run_jedi_exe.py -c ./3dhofx_example.yaml > stdout.txt 2>&1 -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Wait and ensure buffers flushed to disk -sleep 5 -sync stdout.txt - -# Check for job submission error -error=$(grep "sbatch: error" stdout.txt | wc -l) -if [ $error -ne 0 ]; then - rc=$error - exit $rc -fi - -# Cancel submitted job -jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}') -scancel $jobid -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Check for valid yaml files -ylist="3dhofx_example.yaml gdas_hofx.yaml" -for yfile in $ylist; do - python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile - rc=$? - if [ $rc -ne 0 ]; then - exit $rc - fi -done - -exit $rc diff --git a/test/atm/global-workflow/run_jedi_exe_3dvar.sh b/test/atm/global-workflow/run_jedi_exe_3dvar.sh deleted file mode 100755 index 65b201504..000000000 --- a/test/atm/global-workflow/run_jedi_exe_3dvar.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -set -x - -bindir=$1 -srcdir=$2 - -# Identify machine -if [[ -d /scratch1 ]] ; then - machine="hera" -elif [[ -d /work ]] ; then - machine="orion" -else - echo "UNSUPPORTED MACHINE. ABORT" - exit 99 -fi - -# Load modules -#set +x -#module use ${srcdir}/modulefiles -#module load GDAS/${machine} -#set -x -module list - -# Set machine dependent variables -if [ "$machine" = "hera" ] ; then - partition="hera" - gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix" -elif [ "$machine" = "orion" ]; then - partition="orion" - gdasfix="/work2/noaa/da/cmartin/GDASApp/fix" -fi - -# Setup python path for workflow utilities and tasks -export HOMEgfs=$srcdir/../../ # TODO: HOMEgfs had to be hard-coded in config -echo $HOMEgfs -wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src" -PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}" -export PYTHONPATH - -# Create test run directory -mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3dvar -cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_3dvar - -# Create input yaml -cat > ./3dvar_example.yaml << EOF -working directory: ./ -GDASApp home: ${srcdir} -GDASApp mode: variational -template: ${srcdir}/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: ${srcdir}/parm/atm/berror/staticb_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: ${srcdir}/parm/atm/obs/config - executable: ${bindir}/bin/fv3jedi_var.x - obs_list: ${srcdir}/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: ${gdasfix} - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C96 - staticb_type: gsibec - dohybvar: false - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: ${machine} - account: da-cpu - queue: batch - partition: ${partition} - walltime: '30:00' - ntasks: 6 - modulepath: ${srcdir}/modulefiles -EOF - -# Execute run_jedi_exe.py -if [ -e stdout.txt ]; then - rm -f stdout.txt -fi -${srcdir}/ush/run_jedi_exe.py -c ./3dvar_example.yaml > stdout.txt 2>&1 -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Wait and ensure buffers flushed to disk -sleep 5 -sync stdout.txt - -# Check for job submission error -error=$(grep "sbatch: error" stdout.txt | wc -l) -if [ $error -ne 0 ]; then - rc=$error - exit $rc -fi - -# Cancel submitted job -jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}') -scancel $jobid -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Check for valid yaml files -ylist="3dvar_example.yaml gdas_variational.yaml" -for yfile in $ylist; do - python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile - rc=$? - if [ $rc -ne 0 ]; then - exit $rc - fi -done - -exit $rc diff --git a/test/atm/global-workflow/run_jedi_exe_letkf.sh b/test/atm/global-workflow/run_jedi_exe_letkf.sh deleted file mode 100755 index d3db2f8c4..000000000 --- a/test/atm/global-workflow/run_jedi_exe_letkf.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash -set -x - -bindir=$1 -srcdir=$2 - -# Identify machine -if [[ -d /scratch1 ]] ; then - machine="hera" -elif [[ -d /work ]] ; then - machine="orion" -else - echo "UNSUPPORTED MACHINE. ABORT" - exit 99 -fi - -# Load modules -#set +x -#module use ${srcdir}/modulefiles -#module load GDAS/${machine} -#set -x -module list - -# Set machine dependent variables -if [ "$machine" = "hera" ] ; then - partition="hera" - gdasfix="/scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix" -elif [ "$machine" = "orion" ]; then - partition="orion" - gdasfix="/work2/noaa/da/cmartin/GDASApp/fix" -fi - -# Setup python path for workflow utilities and tasks -export HOMEgfs=$srcdir/../../ # TODO: HOMEgfs had to be hard-coded in config -echo $HOMEgfs -wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src" -PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}" -export PYTHONPATH - -# Create test run directory -mkdir -p ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_letkf -cd ${bindir}/test/atm/global-workflow/testrun/gdas_single_test_letkf - -# Create input yaml -cat > ./letkf_example.yaml << EOF -working directory: ./ -GDASApp home: ${srcdir} -GDASApp mode: letkf -template: ${srcdir}/parm/atm/lgetkf/lgetkf.yaml -config: - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: ${srcdir}/parm/atm/obs/config - executable: ${bindir}/bin/fv3jedi_letkf.x - obs_list: ${srcdir}/parm/atm/obs/lists/lgetkf_prototype.yaml - gdas_fix_root: ${gdasfix} - atm: true - layout_x: 3 - layout_y: 2 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C48 - case_anl: C48 - staticb_type: gsibec - dohybvar: no - levs: 128 - nmem: 5 - interp_method: barycentric -job options: - machine: ${machine} - account: da-cpu - queue: batch - partition: ${partition} - walltime: '30:00' - ntasks: 36 - modulepath: ${srcdir}/modulefiles -EOF - -# Execute run_jedi_exe.py -if [ -e stdout.txt ]; then - rm -f stdout.txt -fi -${srcdir}/ush/run_jedi_exe.py -c ./letkf_example.yaml > stdout.txt 2>&1 -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Wait and ensure buffers flushed to disk -sleep 5 -sync stdout.txt - -# Check for job submission error -error=$(grep "sbatch: error" stdout.txt | wc -l) -if [ $error -ne 0 ]; then - rc=$error - exit $rc -fi - -# Cancel submitted job -jobid=$(grep "Submitted" stdout.txt | awk -F' ' '{print $4}') -scancel $jobid -rc=$? -if [ $rc -ne 0 ]; then - exit $rc -fi - -# Check for valid yaml files -ylist="letkf_example.yaml gdas_letkf.yaml" -for yfile in $ylist; do - python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $yfile - rc=$? - if [ $rc -ne 0 ]; then - exit $rc - fi -done - -exit $rc diff --git a/test/genYAML_prep.sh b/test/genYAML_prep.sh deleted file mode 100755 index b0255ab39..000000000 --- a/test/genYAML_prep.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -bindir=$1 -srcdir=$2 - -cat > testoutput/genYAML_example.yaml << EOF -template: ${srcdir}/parm/atm/variational/3dvar_dripcg.yaml -output: ${bindir}/test/testoutput/genYAML_output_3dvar.yaml -config: - BERROR_YAML: \${PARMgfs}/atm/berror/staticb_bump.yaml - OBS_YAML_DIR: \${PARMgfs}/atm/obs/config - COMPONENT: atmos - layout_x: '1' - layout_y: '2' - OBS_LIST: ${srcdir}/parm/atm/obs/lists/gdas_prototype.yaml - OPREFIX: gdas.t00z. - CDATE: '2022033000' - PDY: '20220330' - cyc: '00' - valid_time: '2022-03-30T00:00:00Z' - atm_window_length: PT6H - CASE: 'C48' - CASE_ANL: 'C48' - LEVS: '128' -EOF diff --git a/test/genYAML_prep_aero.sh b/test/genYAML_prep_aero.sh deleted file mode 100755 index 0ed964196..000000000 --- a/test/genYAML_prep_aero.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -bindir=$1 -srcdir=$2 - -cat > testoutput/genYAML_example_aero.yaml << EOF -template: ${srcdir}/parm/aero/variational/3dvar_gfs_aero.yaml -output: ${bindir}/test/testoutput/genYAML_output_3dvar_gfs_aero.yaml -config: - BERROR_YAML: \${PARMgfs}/aero/berror/staticb_bump.yaml - OBS_YAML_DIR: \${PARMgfs}/aero/obs/config - COMPONENT: chem - layout_x: '8' - layout_y: '8' - OBS_LIST: ${srcdir}/parm/aero/obs/lists/gdas_aero_prototype.yaml - OPREFIX: gdas.t06z. - CDATE: '2019061400' - PDY: '20190614' - cyc: '06' - valid_time: '2019-06-14T06:00:00Z' - aero_window_length: PT6H - CASE: 'C96' - CASE_ANL: 'C48' - LEVS: '128' -EOF diff --git a/test/genYAML_prep_land.sh b/test/genYAML_prep_land.sh deleted file mode 100755 index 242619ae3..000000000 --- a/test/genYAML_prep_land.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -bindir=$1 -srcdir=$2 - -cat > testoutput/genYAML_example_land.yaml << EOF -template: ${srcdir}/parm/land/letkfoi/letkfoi.yaml -output: ${bindir}/test/testoutput/genYAML_output_letkfoi.yaml -config: - BERROR_YAML: \${PARMgfs}/atm/berror/staticb_bump.yaml - OBS_YAML_DIR: \${PARMgfs}/land/obs/config - COMPONENT: land - layout_x: '1' - layout_y: '2' - OBS_LIST: ${srcdir}/parm/land/obs/lists/gdas_land_prototype.yaml - OPREFIX: gdas.t18z. - CDATE: '2021032318' - PDY: '20210323' - cyc: '18' - valid_time: '2021-03-23T18:00:00Z' - atm_window_length: PT6H - land_window_length: PT6H - CASE: 'C48' - CASE_ANL: 'C48' - LEVS: '128' -EOF diff --git a/ush/land/genYAML_output_letkfoi.yaml b/test/land/letkfoi_land.yaml similarity index 100% rename from ush/land/genYAML_output_letkfoi.yaml rename to test/land/letkfoi_land.yaml diff --git a/test/land/letkfoi_snowda.sh b/test/land/letkfoi_snowda.sh index e6ca740f0..64086ba07 100755 --- a/test/land/letkfoi_snowda.sh +++ b/test/land/letkfoi_snowda.sh @@ -67,7 +67,7 @@ mkdir -p Data diags mkdir -p Data/fieldmetadata ln -s ${project_source_dir}/parm/io/fv3jedi_fieldmetadata_restart.yaml Data/fieldmetadata/. ln -s ${project_binary_dir}/fv3-jedi/test/Data/fv3files Data/fv3files -ln -s ${project_source_dir}/ush/land/genYAML_output_letkfoi.yaml letkf_land.yaml +ln -s ${project_source_dir}/test/land/letkfoi_land.yaml letkf_land.yaml ln -s ${OBSDIR}/snow_depth/GTS/202103/adpsfc_snow_2021032318.nc4 adpsfc_snow.nc4 ln -s ${OBSDIR} Data/land echo 'do_landDA: calling fv3-jedi' diff --git a/ush/examples/run_jedi_exe/3denvar_hera.yaml b/ush/examples/run_jedi_exe/3denvar_hera.yaml deleted file mode 100644 index 363c6235d..000000000 --- a/ush/examples/run_jedi_exe/3denvar_hera.yaml +++ /dev/null @@ -1,37 +0,0 @@ -working directory: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/gdas_single_test_3denvar -GDASApp home: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp -GDASApp mode: variational -template: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/berror/hybvar_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/build/bin/fv3jedi_var.x - obs_list: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C48 - case_enkf: C48 - staticb_type: gsibec - dohybvar: true - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: hera - account: da-cpu - queue: debug - partition: hera - walltime: '30:00' - ntasks: 6 - modulepath: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/3denvar_orion.yaml b/ush/examples/run_jedi_exe/3denvar_orion.yaml deleted file mode 100644 index 8c196bfaa..000000000 --- a/ush/examples/run_jedi_exe/3denvar_orion.yaml +++ /dev/null @@ -1,37 +0,0 @@ -working directory: /work2/noaa/stmp/cmartin/gdas_single_test_3denvar -GDASApp home: /work2/noaa/da/cmartin/GDASApp/work/GDASApp -GDASApp mode: variational -template: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/berror/hybvar_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/build/bin/fv3jedi_var.x - obs_list: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /work2/noaa/da/cmartin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C48 - case_enkf: C48 - staticb_type: gsibec - dohybvar: true - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: orion - account: da-cpu - queue: debug - partition: debug - walltime: '30:00' - ntasks: 6 - modulepath: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/3dhofx_hera.yaml b/ush/examples/run_jedi_exe/3dhofx_hera.yaml deleted file mode 100644 index bca193b78..000000000 --- a/ush/examples/run_jedi_exe/3dhofx_hera.yaml +++ /dev/null @@ -1,27 +0,0 @@ -working directory: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/gdas_single_test_hofx3d -GDASApp home: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp -GDASApp mode: hofx -template: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/hofx/hofx_nomodel.yaml -config: - obs_yaml_dir: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/build/bin/fv3jedi_hofx_nomodel.x - obs_list: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-08-01T00:00:00Z - dump: gdas - case: C768 - levs: 128 - interp_method: barycentric -job options: - machine: hera - account: da-cpu - queue: debug - partition: hera - walltime: '30:00' - ntasks: 6 - ntasks-per-node: 2 - modulepath: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/3dhofx_orion.yaml b/ush/examples/run_jedi_exe/3dhofx_orion.yaml deleted file mode 100644 index 121109797..000000000 --- a/ush/examples/run_jedi_exe/3dhofx_orion.yaml +++ /dev/null @@ -1,27 +0,0 @@ -working directory: /work2/noaa/stmp/cmartin/gdas_single_test_hofx3d -GDASApp home: /work2/noaa/da/cmartin/GDASApp/work/GDASApp -GDASApp mode: hofx -template: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/hofx/hofx_nomodel.yaml -config: - obs_yaml_dir: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/build/bin/fv3jedi_hofx_nomodel.x - obs_list: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /work2/noaa/da/cmartin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-08-01T00:00:00Z - dump: gdas - case: C768 - levs: 128 - interp_method: barycentric -job options: - machine: orion - account: da-cpu - queue: debug - partition: debug - walltime: '30:00' - ntasks: 6 - ntasks-per-node: 2 - modulepath: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/3dvar_hera.yaml b/ush/examples/run_jedi_exe/3dvar_hera.yaml deleted file mode 100644 index 882dc545d..000000000 --- a/ush/examples/run_jedi_exe/3dvar_hera.yaml +++ /dev/null @@ -1,36 +0,0 @@ -working directory: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/gdas_single_test_3dvar -GDASApp home: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp -GDASApp mode: variational -template: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/berror/staticb_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/build/bin/fv3jedi_var.x - obs_list: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C96 - staticb_type: gsibec - dohybvar: false - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: hera - account: da-cpu - queue: debug - partition: hera - walltime: '30:00' - ntasks: 6 - modulepath: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/3dvar_orion.yaml b/ush/examples/run_jedi_exe/3dvar_orion.yaml deleted file mode 100644 index dc563620d..000000000 --- a/ush/examples/run_jedi_exe/3dvar_orion.yaml +++ /dev/null @@ -1,36 +0,0 @@ -working directory: /work2/noaa/stmp/cmartin/gdas_single_test_3dvar -GDASApp home: /work2/noaa/da/cmartin/GDASApp/work/GDASApp -GDASApp mode: variational -template: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/variational/3dvar_dripcg.yaml -config: - berror_yaml: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/berror/staticb_gsibec.yaml - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/build/bin/fv3jedi_var.x - obs_list: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_3d.yaml - gdas_fix_root: /work2/noaa/da/cmartin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C96 - case_anl: C96 - staticb_type: gsibec - dohybvar: false - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: orion - account: da-cpu - queue: debug - partition: debug - walltime: '30:00' - ntasks: 6 - modulepath: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/4dhofx_hera.yaml b/ush/examples/run_jedi_exe/4dhofx_hera.yaml deleted file mode 100644 index 08baaf08d..000000000 --- a/ush/examples/run_jedi_exe/4dhofx_hera.yaml +++ /dev/null @@ -1,28 +0,0 @@ -working directory: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/gdas_single_test_hofx4d -GDASApp home: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp -GDASApp mode: hofx -template: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/hofx/hofx4d.yaml -config: - obs_yaml_dir: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/build/bin/fv3jedi_hofx.x - obs_list: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_4d.yaml - gdas_fix_root: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - forecast_step: PT1H - valid_time: 2021-08-01T00:00:00Z - dump: gdas - case: C768 - levs: 128 - interp_method: barycentric -job options: - machine: hera - account: da-cpu - queue: debug - partition: hera - walltime: '30:00' - ntasks: 6 - ntasks-per-node: 1 - modulepath: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/4dhofx_orion.yaml b/ush/examples/run_jedi_exe/4dhofx_orion.yaml deleted file mode 100644 index cabc2fde8..000000000 --- a/ush/examples/run_jedi_exe/4dhofx_orion.yaml +++ /dev/null @@ -1,28 +0,0 @@ -working directory: /work2/noaa/stmp/cmartin/gdas_single_test_hofx4d -GDASApp home: /work2/noaa/da/cmartin/GDASApp/work/GDASApp -GDASApp mode: hofx -template: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/hofx/hofx4d.yaml -config: - obs_yaml_dir: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/build/bin/fv3jedi_hofx.x - obs_list: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/lists/gdas_prototype_4d.yaml - gdas_fix_root: /work2/noaa/da/cmartin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - forecast_step: PT1H - valid_time: 2021-08-01T00:00:00Z - dump: gdas - case: C768 - levs: 128 - interp_method: barycentric -job options: - machine: orion - account: da-cpu - queue: debug - partition: debug - walltime: '30:00' - ntasks: 6 - ntasks-per-node: 1 - modulepath: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/letkf_hera.yaml b/ush/examples/run_jedi_exe/letkf_hera.yaml deleted file mode 100644 index 24eb2d609..000000000 --- a/ush/examples/run_jedi_exe/letkf_hera.yaml +++ /dev/null @@ -1,33 +0,0 @@ -working directory: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/gdas_single_test_letkf -GDASApp home: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp -GDASApp mode: letkf -template: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/lgetkf/lgetkf.yaml -config: - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/build/bin/fv3jedi_letkf.x - obs_list: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/parm/atm/obs/lists/lgetkf_prototype.yaml - gdas_fix_root: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C48 - case_enkf: C48 - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: hera - account: da-cpu - queue: debug - partition: hera - walltime: '30:00' - ntasks: 6 - modulepath: /scratch1/NCEPDEV/da/Cory.R.Martin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/examples/run_jedi_exe/letkf_orion.yaml b/ush/examples/run_jedi_exe/letkf_orion.yaml deleted file mode 100644 index 58a78c2d0..000000000 --- a/ush/examples/run_jedi_exe/letkf_orion.yaml +++ /dev/null @@ -1,33 +0,0 @@ -working directory: /work2/noaa/stmp/cmartin/gdas_single_test_letkf -GDASApp home: /work2/noaa/da/cmartin/GDASApp/work/GDASApp -GDASApp mode: letkf -template: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/lgetkf/lgetkf.yaml -config: - obs_dir: obs - diag_dir: diags - crtm_coeff_dir: crtm - bias_in_dir: obs - bias_out_dir: bc - obs_yaml_dir: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/config - executable: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/build/bin/fv3jedi_letkf.x - obs_list: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/parm/atm/obs/lists/lgetkf_prototype.yaml - gdas_fix_root: /work2/noaa/da/cmartin/GDASApp/fix - atm: true - layout_x: 1 - layout_y: 1 - atm_window_length: PT6H - valid_time: 2021-12-21T06:00:00Z - dump: gdas - case: C48 - case_enkf: C48 - levs: 128 - nmem: 10 - interp_method: barycentric -job options: - machine: orion - account: da-cpu - queue: debug - partition: debug - walltime: '30:00' - ntasks: 6 - modulepath: /work2/noaa/da/cmartin/GDASApp/work/GDASApp/modulefiles diff --git a/ush/genYAML b/ush/genYAML index 79960fd5d..e6f06c19a 100755 --- a/ush/genYAML +++ b/ush/genYAML @@ -7,12 +7,21 @@ import datetime as dt import logging import os import re -import yaml +from wxflow, import parse_j2yaml, cast_strdict_as_dtypedict, save_as_yaml -from ufsda.genYAML import genYAML + +def genYAML(input_yaml, output_yaml, config): + # read in YAML/Jinja template + final_config = parse_j2yaml(input_yaml, config) + save_as_yaml(final_config, output_yaml) if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', type=str, help='Input YAML Configuration', required=True) + parser.add_argument('-i', '--input', type=str, help='Input YAML Template', required=True) + parser.add_argument('-o', '--output', type=str, help='Output YAML File', required=True) args = parser.parse_args() - genYAML(args.config) + + # Take configuration from environment and cast it as python dictionary + config = cast_strdict_as_dtypedict(os.environ) + + genYAML(args.input, args.output, config) diff --git a/ush/run_jedi_exe.py b/ush/run_jedi_exe.py deleted file mode 100755 index 442339281..000000000 --- a/ush/run_jedi_exe.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import datetime as dt -import logging -import os -import re -import subprocess -import sys -import yaml -import wxflow -from wxflow import parse_j2yaml, save_as_yaml - - -def export_envar(yamlfile, bashout): - - # open YAML file to get config - f = open(yamlfile, "r") - envar_dict = yaml.safe_load(f) - - # open up a file for writing - f = open(bashout, 'w') - f.write('#!/bin/bash\n') - - # Loop through variables - for v in envar_dict: - batch = f"""export {v}={envar_dict[v]}\n""" - f.write(batch) - - -def run_jedi_exe(yamlconfig): - logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') - # open YAML file to get config - try: - with open(yamlconfig, 'r') as yamlconfig_opened: - all_config_dict = yaml.safe_load(yamlconfig_opened) - logging.info(f'Loading configuration from {yamlconfig}') - except Exception as e: - logging.error(f'Error occurred when attempting to load: {yamlconfig}, error: {e}') - - # check if the specified app mode is valid - app_mode = all_config_dict['GDASApp mode'] - supported_app_modes = ['hofx', 'variational', 'letkf'] - if app_mode not in supported_app_modes: - raise KeyError(f"'{app_mode}' not supported. " + - "Current GDASApp modes supported are: " + - f"{' | '.join(supported_app_modes)}") - - # create working directory - workdir = all_config_dict['working directory'] - try: - os.makedirs(workdir, exist_ok=True) - logging.info(f'Created working directory {workdir}') - except OSError as error: - logging.error(f'Error creating {workdir}: {error}') - - # add your ufsda python package to path - ufsda_path = os.path.join(all_config_dict['GDASApp home'], 'ush') - sys.path.append(ufsda_path) - import ufsda - from ufsda.misc_utils import calc_fcst_steps - from ufsda.stage import gdas_single_cycle, gdas_fix, background_ens, atm_obs, bias_obs - from ufsda.genYAML import genYAML - - # compute config for YAML for executable - executable_subconfig = all_config_dict['config'] - valid_time = executable_subconfig['valid_time'] - assim_freq = int(executable_subconfig.get('assim_freq', 6)) - h = re.findall('PT(\\d+)H', executable_subconfig['atm_window_length'])[0] - prev_cycle = valid_time - dt.timedelta(hours=int(h)) - window_begin = valid_time - dt.timedelta(hours=int(h)/2) - cyc = valid_time.strftime("%H") - gcyc = prev_cycle.strftime("%H") - gPDY = prev_cycle.strftime("%Y%m%d") - pdy = valid_time.strftime("%Y%m%d") - os.environ['PDY'] = str(pdy) - os.environ['cyc'] = str(cyc) - os.environ['assim_freq'] = str(assim_freq) - oprefix = executable_subconfig['dump'] + ".t" + str(cyc) + "z." - gprefix = executable_subconfig['dump'] + ".t" + str(gcyc) + "z." - comin = executable_subconfig.get('gdas_fix_root', './') - comin_ges_ens = os.path.join(comin, 'cases', 'enkfgdas.' + str(gPDY), str(gcyc)) - dump = executable_subconfig['dump'] - output_file = os.path.join(workdir, f"gdas_{app_mode}.yaml") - - single_exec = True - var_config = { - 'DATA': os.path.join(workdir), - 'APREFIX': str(oprefix), - 'OPREFIX': str(oprefix), - 'GPREFIX': str(gprefix), - 'BERROR_YAML': executable_subconfig.get('berror_yaml', './'), - 'STATICB_TYPE': executable_subconfig.get('staticb_type', 'gsibec'), - 'OBS_YAML_DIR': executable_subconfig['obs_yaml_dir'], - 'OBS_LIST': executable_subconfig['obs_list'], - 'atm': executable_subconfig.get('atm', False), - 'layout_x': str(executable_subconfig['layout_x']), - 'layout_y': str(executable_subconfig['layout_y']), - 'BKG_DIR': os.path.join(workdir, 'bkg'), - 'fv3jedi_fix_dir': os.path.join(workdir, 'fv3jedi'), - 'fv3jedi_fieldmetadata_dir': os.path.join(workdir, 'fv3jedi'), - 'ANL_DIR': os.path.join(workdir, 'anl'), - 'fv3jedi_staticb_dir': os.path.join(workdir, 'berror'), - 'BIAS_IN_DIR': os.path.join(workdir, 'obs'), - 'BIAS_OUT_DIR': os.path.join(workdir, 'bc'), - 'CRTM_COEFF_DIR': os.path.join(workdir, 'crtm'), - 'BIAS_PREFIX': f"{executable_subconfig['dump']}.t{gcyc}z.", - 'BIAS_DATE': f"{gPDY}{gcyc}", - 'DIAG_DIR': os.path.join(workdir, 'diags'), - 'OBS_DIR': os.path.join(workdir, 'obs'), - 'OBS_PREFIX': f"{executable_subconfig['dump']}.t{cyc}z.", - 'OBS_DATE': f"{pdy}{cyc}", - 'PDY': f"{pdy}", - 'cyc': f"{cyc}", - 'gPDY': f"{gPDY}", - 'gcyc': f"{gcyc}", - 'valid_time': f"{valid_time.strftime('%Y-%m-%dT%H:%M:%SZ')}", - 'window_begin': f"{window_begin.strftime('%Y-%m-%dT%H:%M:%SZ')}", - 'prev_valid_time': f"{prev_cycle.strftime('%Y-%m-%dT%H:%M:%SZ')}", - 'previous_cycle': f"{prev_cycle}", - 'current_cycle': f"{valid_time}", - 'atm_window_length': executable_subconfig['atm_window_length'], - 'ATM_WINDOW_LENGTH': f"PT{assim_freq}H", - 'ATM_WINDOW_BEGIN': f"{window_begin.strftime('%Y-%m-%dT%H:%M:%SZ')}", - 'COMOUT': os.path.join(workdir, 'obs'), - 'CASE': executable_subconfig['case'], - 'CASE_ANL': executable_subconfig.get('case_anl', executable_subconfig['case']), - 'CASE_ENS': executable_subconfig.get('case_enkf', executable_subconfig['case']), - 'DOHYBVAR': executable_subconfig.get('dohybvar', False), - 'LEVS': str(executable_subconfig['levs']), - 'NMEM_ENS': executable_subconfig.get('nmem', 0), - 'COMIN_GES_ENS': f"{comin_ges_ens}", - 'forecast_steps': calc_fcst_steps(executable_subconfig.get('forecast_step', 'PT6H'), - executable_subconfig['atm_window_length']), - 'BKG_TSTEP': executable_subconfig.get('forecast_step', 'PT6H'), - 'INTERP_METHOD': executable_subconfig.get('interp_method', 'barycentric'), - 'output_file': os.path.join(workdir, f"gdas_{app_mode}.yaml"), - 'dump': f"{dump}", - 'output_file': f"{output_file}", - } - - # set some environment variables - os.environ['PARMgfs'] = os.path.join(all_config_dict['GDASApp home'], 'parm') - for key, value in var_config.items(): - os.environ[key] = str(value) - # generate YAML for executable based on input config - logging.info(f'Using yamlconfig {yamlconfig}') - - local_dict = { - 'npx_ges': f"{int(os.environ['CASE'][1:]) + 1}", - 'npy_ges': f"{int(os.environ['CASE'][1:]) + 1}", - 'npz_ges': f"{int(os.environ['LEVS']) - 1}", - 'npz': f"{int(os.environ['LEVS']) - 1}", - 'npx_anl': f"{int(os.environ['CASE_ANL'][1:]) + 1}", - 'npy_anl': f"{int(os.environ['CASE_ANL'][1:]) + 1}", - 'npz_anl': f"{int(os.environ['LEVS']) - 1}", - 'NMEM_ENS': f"{int(os.environ['NMEM_ENS'])}", - 'ATM_WINDOW_BEGIN': window_begin, - 'ATM_WINDOW_LENGTH': f"PT{assim_freq}H", - 'BKG_TSTEP': executable_subconfig.get('forecast_step', 'PT6H'), - 'OPREFIX': f"{dump}.t{cyc}z.", # TODO: CDUMP is being replaced by RUN - 'APREFIX': f"{dump}.t{cyc}z.", # TODO: CDUMP is being replaced by RUN - 'GPREFIX': f"gdas.t{gcyc}z.", - 'DATA': os.path.join(workdir), - 'layout_x': str(executable_subconfig['layout_x']), - 'layout_y': str(executable_subconfig['layout_y']), - 'previous_cycle': prev_cycle, - 'current_cycle': valid_time, - } - - varda_yaml = parse_j2yaml(all_config_dict['template'], local_dict) - save_as_yaml(varda_yaml, output_file) - - logging.info(f'Wrote YAML file to {output_file}') - # use R2D2 to stage backgrounds, obs, bias correction files, etc. - if app_mode in ['variational', 'hofx']: - ufsda.stage.gdas_single_cycle(var_config, local_dict) - # stage ensemble backgrouns for letkf - if app_mode in ['letkf']: - ufsda.stage.background_ens(var_config) - ufsda.stage.atm_obs(var_config, local_dict) - ufsda.stage.bias_obs(var_config, local_dict) - - # link additional fix files needed (CRTM, fieldmetadata, etc.) - gdasfix = executable_subconfig['gdas_fix_root'] - ufsda.stage.gdas_fix(gdasfix, workdir, var_config) - # link executable - baseexe = os.path.basename(executable_subconfig['executable']) - ufsda.disk_utils.symlink(executable_subconfig['executable'], os.path.join(workdir, baseexe)) - # create output directories - ufsda.disk_utils.mkdir(os.path.join(workdir, 'diags')) - if app_mode in ['variational', 'letkf']: - ufsda.disk_utils.mkdir(os.path.join(workdir, 'anl')) - ufsda.disk_utils.mkdir(os.path.join(workdir, 'bc')) - baseexe = os.path.join(workdir, baseexe) - - # generate job submission script - job_script = ufsda.misc_utils.create_batch_job(all_config_dict['job options'], - workdir, - baseexe, - output_file, - single_exec=single_exec) - # submit job to queue - ufsda.misc_utils.submit_batch_job(all_config_dict['job options'], workdir, job_script) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', type=str, help='Input YAML Configuration', required=True) - args = parser.parse_args() - run_jedi_exe(args.config) diff --git a/ush/ufoeval/run_ufo_hofx_test.sh b/ush/ufoeval/run_ufo_hofx_test.sh index 41fef967e..5e8f55b00 100755 --- a/ush/ufoeval/run_ufo_hofx_test.sh +++ b/ush/ufoeval/run_ufo_hofx_test.sh @@ -172,21 +172,19 @@ echo "Generating YAML" # Copy/generate YAML for test executable # First, create the input YAMLs for the genYAML script -cat > $workdir/obslist.yaml << EOF -- !INC $yamlpath -EOF +export DATA=./ +export COMPONENT=atmos +export OPREFIX=gdas.t${cyc}z +export APREFIX=gdas.t${cyc}z +export GPREFIX=gdas.t${gcyc}z + cat > $workdir/temp.yaml << EOF -template: $GDASApp/parm/atm/hofx/hofx_ufotest.yaml -output: $workdir/${obtype}_${cycle}.yaml -config: - COMPONENT: atmos - OBS_LIST: $workdir/obslist.yaml - DATA: ./ - OPREFIX: gdas.t${cyc}z - APREFIX: gdas.t${cyc}z - GPREFIX: gdas.t${gcyc}z +window begin: '{{ATM_WINDOW_BEGIN}}' +window end: '{{ATM_WINDOW_END}}' +observations: +- !INC $yamlpath EOF -$GDASApp/ush/genYAML --config $workdir/temp.yaml +$GDASApp/ush/genYAML --input $workdir/temp.yaml --output $workdir/${obtype}_${cycle}.yaml if [ $? -ne 0 ]; then echo "YAML creation failed" diff --git a/ush/ufsda/__init__.py b/ush/ufsda/__init__.py index fa31c2cf8..e74304171 100644 --- a/ush/ufsda/__init__.py +++ b/ush/ufsda/__init__.py @@ -4,5 +4,4 @@ import ufsda.r2d2 import ufsda.post import ufsda.yamltools -import ufsda.genYAML from .misc_utils import isTrue, create_batch_job, submit_batch_job diff --git a/ush/ufsda/genYAML.py b/ush/ufsda/genYAML.py deleted file mode 100644 index f6ffbda6b..000000000 --- a/ush/ufsda/genYAML.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 -# genYAML -# generate YAML using ufsda python module, -# current runtime env, and optional input YAML -import argparse -import datetime as dt -import logging -import os -import re -import yaml -from wxflow import Template, TemplateConstants, YAMLFile - - -def genYAML(yamlconfig, output=None): - logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') - # open YAML file to get config - try: - with open(yamlconfig, 'r') as yamlconfig_opened: - all_config_dict = yaml.safe_load(yamlconfig_opened) - logging.info(f'Loading configuration from {yamlconfig}') - except Exception as e: - logging.error(f'Error occurred when attempting to load: {yamlconfig}, error: {e}') - - if not output: - output_file = all_config_dict['output'] - else: - output_file = output - - template = all_config_dict['template'] - config_dict = all_config_dict['config'] - # what if the config_dict has environment variables that need substituted? - pattern = re.compile(r'.*?\${(\w+)}.*?') - for key, value in config_dict.items(): - if type(value) is str: - match = pattern.findall(value) - if match: - fullvalue = value - for g in match: - config_dict[key] = fullvalue.replace( - f'${{{g}}}', os.environ.get(g, f'${{{g}}}') - ) - # NOTE the following is a hack until YAMLFile can take in an input config dict - # if something in the template is expected to be an env var - # but it is not defined in the env, problems will arise - # so we set the env var in this subprocess for the substitution to occur - for key, value in config_dict.items(): - os.environ[key] = str(value) - # next we need to compute a few things - runtime_config = get_runtime_config(dict(os.environ, **config_dict)) - # now run the global-workflow parser - outconfig = YAMLFile(path=template) - outconfig = Template.substitute_structure(outconfig, TemplateConstants.DOUBLE_CURLY_BRACES, config_dict.get) - outconfig = Template.substitute_structure(outconfig, TemplateConstants.DOLLAR_PARENTHESES, config_dict.get) - outconfig = Template.substitute_structure(outconfig, TemplateConstants.DOUBLE_CURLY_BRACES, runtime_config.get) - outconfig = Template.substitute_structure(outconfig, TemplateConstants.DOLLAR_PARENTHESES, runtime_config.get) - outconfig.save(output_file) - - -def get_runtime_config(config_dict): - # compute some runtime variables - # this will probably need pulled out somewhere else eventually - # a temporary hack to get UFO evaluation stuff and ATM VAR going again - vpdy = dt.datetime.strptime(config_dict['PDY'], '%Y%m%d') - vcyc = dt.datetime.strptime(config_dict['cyc'], '%H') - vdate = int(config_dict.get('PDY'))*100 + int(config_dict.get('cyc')) - valid_time = dt.datetime.strptime(str(vdate), '%Y%m%d%H') - assim_freq = int(config_dict.get('assim_freq', 6)) - window_begin = valid_time - dt.timedelta(hours=assim_freq/2) - window_end = valid_time + dt.timedelta(hours=assim_freq/2) - bkg_tstep_default = f"PT{assim_freq}H" - bkg_tstep = str(config_dict.get('BKG_TSTEP', f"PT{assim_freq}H")) - component_dict = { - 'atmos': 'ATM', - 'chem': 'AERO', - 'ocean': 'SOCA', - 'land': 'LAND', - } - win_begin_var = component_dict[config_dict.get('COMPONENT', 'atmos')] + '_WINDOW_BEGIN' - win_end_var = component_dict[config_dict.get('COMPONENT', 'atmos')] + '_WINDOW_END' - win_len_var = component_dict[config_dict.get('COMPONENT', 'atmos')] + '_WINDOW_LENGTH' - fv3_begin_var = 'ATM_BEGIN_YYYYmmddHHMMSS' - bkg_string_var = 'BKG_YYYYmmddHHMMSS' - bkg_isotime_var = 'BKG_ISOTIME' - bkg_tstep_var = 'BKG_TSTEP' - if 'land_window_length' in config_dict.keys(): - win_begin_var = component_dict[config_dict.get('COMPONENT', 'land')] + '_WINDOW_BEGIN' - win_end_var = component_dict[config_dict.get('COMPONENT', 'land')] + '_WINDOW_END' - win_len_var = component_dict[config_dict.get('COMPONENT', 'land')] + '_WINDOW_LENGTH' - fv3_begin_var = 'LAND_BEGIN_YYYYmmddHHMMSS' - bkg_string_var = 'LAND_BKG_YYYYmmddHHMMSS' - bkg_isotime_var = 'LAND_BKG_ISOTIME' - if 'aero_window_length' in config_dict.keys(): - win_begin_var = component_dict[config_dict.get('COMPONENT', 'aero')] + '_WINDOW_BEGIN' - win_end_var = component_dict[config_dict.get('COMPONENT', 'aero')] + '_WINDOW_END' - win_len_var = component_dict[config_dict.get('COMPONENT', 'aero')] + '_WINDOW_LENGTH' - fv3_begin_var = 'AERO_BEGIN_YYYYmmddHHMMSS' - bkg_string_var = 'AERO_BKG_YYYYmmddHHMMSS' - bkg_isotime_var = 'AERO_BKG_ISOTIME' - npx_ges_var = 'npx_ges' - npy_ges_var = 'npy_ges' - npz_ges_var = 'npz_ges' - npx_anl_var = 'npx_anl' - npy_anl_var = 'npy_anl' - npz_anl_var = 'npz_anl' - - runtime_config = { - win_begin_var: f"{window_begin.strftime('%Y-%m-%dT%H:%M:%SZ')}", - win_end_var: f"{window_end.strftime('%Y-%m-%dT%H:%M:%SZ')}", - win_len_var: f"PT{assim_freq}H", - fv3_begin_var: f"{window_begin.strftime('%Y%m%d.%H%M%S')}", - bkg_string_var: f"{valid_time.strftime('%Y%m%d.%H%M%S')}", - bkg_isotime_var: f"{valid_time.strftime('%Y-%m-%dT%H:%M:%SZ')}", - bkg_tstep_var: f"{bkg_tstep}", - npx_ges_var: f"{int(os.environ['CASE'][1:]) + 1}", - npy_ges_var: f"{int(os.environ['CASE'][1:]) + 1}", - npz_ges_var: f"{int(os.environ['LEVS']) - 1}", - npx_anl_var: f"{int(os.environ['CASE_ANL'][1:]) + 1}", - npy_anl_var: f"{int(os.environ['CASE_ANL'][1:]) + 1}", - npz_anl_var: f"{int(os.environ['LEVS']) - 1}", - } - - return runtime_config