Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop]: Use yaml format for specifying experiment parameters #778

Merged

Conversation

danielabdi-noaa
Copy link
Collaborator

@danielabdi-noaa danielabdi-noaa commented May 23, 2022

DESCRIPTION OF CHANGES:

Use structured yaml configs for specifying experiment parameters. This helps in better management of the recent proliferation of tasks and their associated parameters. However, one can still use shell scripts for configuring experiments by changing config script extension to sh in config_defaults.yaml

EXPT_CONFIG_FN: "config.sh"

Furthermore, a utility for converting shell config scripts to yaml config is provided.

$ ./config_utils.py --help
usage: config_utils.py [-h] --cfg CFG [--output-type OUT_TYPE] [--flatten] [--template-cfg TEMPLATE] [--keys KEYS [KEYS ...]] [--validate-cfg VALIDATE]

Utility for managing different config formats.

optional arguments:
  -h, --help            show this help message and exit
  --cfg CFG, -c CFG     Config file to parse
  --output-type OUT_TYPE, -o OUT_TYPE
                        Output format: can be any of ["shell", "yaml", "ini", "json", "xml"]
  --flatten, -f         Flatten resulting dictionary
  --template-cfg TEMPLATE, -t TEMPLATE
                        Template config file used to structure a given config file
  --keys KEYS [KEYS ...], -k KEYS [KEYS ...]
                        Include only these keys of dictionary for processing. Keys can be python regex expression.
  --validate-cfg VALIDATE, -v VALIDATE
                        Validation config file used to validate a given config file

To convert a shell config script to yaml config script, for example config.community.sh

$ ./config_utils.py -c $PWD/config.community.sh -t $PWD/config_defaults.yaml -o yaml
user:
  RUN_ENVIR: community
  MACHINE: hera
  ACCOUNT: an_account
platform:
  MODEL: FV3_GFS_v16_CONUS_25km
  MET_INSTALL_DIR: path/to/MET
  METPLUS_PATH: path/to/METPlus
  CCPA_OBS_DIR: /path/to/processed/CCPA/data
  MRMS_OBS_DIR: /path/to/processed/MRMS/data
  NDAS_OBS_DIR: /path/to/processed/NDAS/data
workflow:
  EXPT_SUBDIR: test_community
  CCPP_PHYS_SUITE: FV3_GFS_v16
  DATE_FIRST_CYCL: '20190615'
  DATE_LAST_CYCL: '20190615'
  CYCL_HRS:
    - 18
  FCST_LEN_HRS: 12
  PREEXISTING_DIR_METHOD: rename
  VERBOSE: true
  COMPILER: intel
workflow_switches:
  RUN_TASK_MAKE_GRID: true
  RUN_TASK_MAKE_OROG: true
  RUN_TASK_MAKE_SFC_CLIMO: true
  RUN_TASK_GET_OBS_CCPA: false
  RUN_TASK_GET_OBS_MRMS: false
  RUN_TASK_GET_OBS_NDAS: false
  RUN_TASK_VX_GRIDSTAT: false
  RUN_TASK_VX_POINTSTAT: false
  RUN_TASK_VX_ENSGRID: false
  RUN_TASK_VX_ENSPOINT: false
task_run_fcst:
  WTIME_RUN_FCST: 02:00:00
  QUILTING: true
  PREDEF_GRID_NAME: RRFS_CONUS_25km
task_get_extrn_ics:
  EXTRN_MDL_NAME_ICS: FV3GFS
  FV3GFS_FILE_FMT_ICS: grib2
task_get_extrn_lbcs:
  EXTRN_MDL_NAME_LBCS: FV3GFS
  LBC_SPEC_INTVL_HRS: 6
  FV3GFS_FILE_FMT_LBCS: grib2
global:
  DO_ENSEMBLE: false
  NUM_ENS_MEMBERS: 2

To check validity of existing yaml or shell config

$ ./config_utils.py -c $PWD/config.community.yaml -v $PWD/config_defaults.yaml
SUCCESS

TESTS CONDUCTED:

I have run tests successfully on HERA, JET, GAEA and CHEYNNE gnu+intel

GAEA and CHEYNNE tested through Jenkins shown in this page.

Out of 56 tests

  • community_ensemble_008mems
  • community_ensemble_2mems
  • deactivate_tasks
  • grid_CONUS_25km_GFDLgrid_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_CONUS_3km_GFDLgrid_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_AK_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_AK_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUS_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2
  • grid_RRFS_CONUS_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_2017_gfdlmp
  • grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_2017_gfdlmp_regional
  • grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2
  • grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_RAP_suite_HRRR
  • grid_RRFS_CONUS_25km_ics_GSMGFS_lbcs_GSMGFS_suite_GFS_2017_gfdlmp
  • grid_RRFS_CONUS_25km_ics_GSMGFS_lbcs_GSMGFS_suite_GFS_v15p2
  • grid_RRFS_CONUS_25km_ics_NAM_lbcs_NAM_suite_HRRR
  • grid_RRFS_CONUS_25km_ics_NAM_lbcs_NAM_suite_RRFS_v1beta
  • grid_RRFS_CONUS_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2
  • grid_RRFS_CONUS_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15_thompson_mynn_lam3km
  • grid_RRFS_CONUS_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUScompact_13km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUScompact_13km_ics_HRRR_lbcs_RAP_suite_HRRR
  • grid_RRFS_CONUScompact_13km_ics_HRRR_lbcs_RAP_suite_RRFS_v1alpha
  • grid_RRFS_CONUScompact_13km_ics_HRRR_lbcs_RAP_suite_RRFS_v1beta
  • grid_RRFS_CONUScompact_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_HRRR_suite_HRRR
  • grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_HRRR_suite_RRFS_v1beta
  • grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_RAP_suite_HRRR
  • grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_RAP_suite_RRFS_v1alpha
  • grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_RAP_suite_RRFS_v1beta
  • grid_RRFS_CONUScompact_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_CONUScompact_3km_ics_HRRR_lbcs_RAP_suite_GFS_v15p2
  • grid_RRFS_CONUScompact_3km_ics_HRRR_lbcs_RAP_suite_HRRR
  • grid_RRFS_CONUScompact_3km_ics_HRRR_lbcs_RAP_suite_RRFS_v1alpha
  • grid_RRFS_CONUScompact_3km_ics_HRRR_lbcs_RAP_suite_RRFS_v1beta
  • grid_RRFS_NA_13km_ics_FV3GFS_lbcs_FV3GFS_suite_RRFS_v1beta
  • grid_RRFS_SUBCONUS_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_RRFS_SUBCONUS_3km_ics_HRRR_lbcs_RAP_suite_GFS_v15p2
  • grid_SUBCONUS_Ind_3km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v16
  • grid_SUBCONUS_Ind_3km_ics_HRRR_lbcs_RAP_suite_HRRR
  • grid_SUBCONUS_Ind_3km_ics_HRRR_lbcs_RAP_suite_RRFS_v1beta
  • inline_post
  • MET_ensemble_verification
  • MET_verification
  • nco_ensemble
  • nco_grid_RRFS_CONUScompact_25km_ics_HRRR_lbcs_RAP_suite_HRRR
  • custom_ESGgrid
  • custom_GFDLgrid
  • custom_GFDLgrid__GFDLgrid_USE_GFDLgrid_RES_IN_FILENAMES_eq_FALSE
  • custom_GFDLgrid__GFDLgrid_USE_GFDLgrid_RES_IN_FILENAMES_eq_TRUE
  • pregen_grid_orog_sfc_climo
  • specify_DOT_OR_USCORE
  • specify_DT_ATMOS_LAYOUT_XY_BLOCKSIZE
  • specify_RESTART_INTERVAL
  • specify_template_filenames

HERA
0 failures

JET
5 failures

DEPENDENCIES:

None

DOCUMENTATION:

None

ISSUE:

To be opened later

CONTRIBUTORS:

@christinaholtNOAA

@panll
Copy link
Collaborator

panll commented Sep 6, 2022

I used develop branch. The details can be found in the file /scratch2/BMC/det/lpan/review/09012022/test/ufs-srweather-app/Externals.cfg.

diff test/expt_dirs/test_community/2019061518/dynf000.nc test1/expt_dirs/test_community/2019061518/dynf000.nc
Binary files test/expt_dirs/test_community/2019061518/dynf000.nc and test1/expt_dirs/test_community/2019061518/dynf000.nc differ

@danielabdi-noaa
Copy link
Collaborator Author

danielabdi-noaa commented Sep 6, 2022

@panll The community test case also matches bit for bit whether i use shell or a yaml config using this PR.
However, it does not match your yaml or shell result for some reason? Maybe different binaries for usf-weather-model?
I will run on develop branch shortly.

@panll
Copy link
Collaborator

panll commented Sep 6, 2022

The weather model code used for test and test1 are same, which can be verified in the file Externals.cfg.

@danielabdi-noaa
Copy link
Collaborator Author

@panll I am talking about my result for yaml not matching your result for yaml. I would expect that to match unless there is a difference in ufs-weather-model build or something of that sort.

@danielabdi-noaa
Copy link
Collaborator Author

@panll I think I found what is causing the difference in develop branch. The bit-for-bit difference starts from the grid generation.
If you do a diff in the grid namelist between your two runs, delx & dely is truncated to 10 digists while develop keeps 7 more digits.

$ diff /scratch2/BMC/det/lpan/review/09012022/test/expt_dirs/test_community/grid/tmp/regional_grid.nml /scratch2/BMC/det/lpan/review/09012022/test1/expt_dirs/test_community/grid/tmp/regional_grid.nml 
2,3c2,3
<     delx = 0.11241167188497128
<     dely = 0.11241167188497128
---
>     delx = 0.1124116719
>     dely = 0.1124116719
5a6
>     pazi = 0.0

The change came from the very latest commit in the yaml PR that rounds this variable ush/set_gridparams_ESGgrid.py

I don't need to change it again in this PR because I believe the original shell script returns rounded values anyway.

@gsketefian
Copy link
Collaborator

gsketefian commented Sep 6, 2022

@danielabdi-noaa I ran 3 WE2E tests on Hera with a version of this PR from Wednesday. They all passed, but the jobs in my crontab weren't cleared afterwards. I will rerun them with the latest version, maybe I made a mistake.

# Now remove trailing whitespace.
#
test_desc="${test_desc%"${test_desc##*[![:space:]]}"}"
config_fn="config.${test_name}.yaml"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generated a csv file containing test info and after opening it in google sheets, I found a couple of issues. At least in some places in the test descriptions, newlines are dropped and single quotes (apostrophes) are replaced with double quotes. For example, for the test custom_GFDLgrid__GFDLgrid_USE_NUM_CELLS_IN_FILENAMES_eq_TRUE, the description in the yaml file is:

metadata:
  description: >-
    This test checks the capability of the workflow to have the user
    specify a new grid (as opposed to one of the predefined ones in the
    workflow) of GFDLgrid type.  Note that this test sets the workflow
    variable
      GFDLgrid_USE_NUM_CELLS_IN_FILENAMES
    to "FALSE"; see the UFS SRW App's User's Guide for a description of
    this variable.

but in the csv file, it becomes:

This test checks the capability of the workflow to have the user specify a new grid (as opposed to one of the predefined ones in the workflow) of GFDLgrid type.  Note that this test sets the workflow variable   GFDLgrid_USE_NUM_CELLS_IN_FILENAMES to "FALSE"; see the UFS SRW App"s User"s Guide for a description of this variable.

So the newline/indentation is ignored and the apostrophes in App's User's Guide are changed to double quotes. Any chance we can fix that up?

Copy link
Collaborator

@gsketefian gsketefian Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just randomly checking other descriptions in the google sheet, I see a similar issue for the test deactivate_tasks: extra spaces added and newlines ignored. Is there a way to have yaml treat the description verbatim?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsketefian Yes, I replace single quotes with double quotes, not only in we2e test description but also in comments in crontab contents. Usually you get empty crontab content but Venita's automated testing setup had crontab contents with comments that had single quotes. Please take a look at PR #816 that describs the issue and how I solved it. I didn't find a better solution than that at the time ...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielabdi-noaa In this case of the test descriptions, it doesn't seem to make sense to do that replacement. What you really want to do is take the description and put it into the csv file exactly as is. Replacing apostrophes with double quotes would be very confusing to someone reading the test description in the csv. Since this is separate from the treatment of crontab lines, is it possible to not do the replacement when dealing with these descriptions? There must be a way to just take a literal string from the yaml file (even one that includes single quotes and newlines) and place it exactly as-is into the csv.

Copy link
Collaborator Author

@danielabdi-noaa danielabdi-noaa Sep 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsketefian I have made the we2e test description specifically (not var_defns.sh or other places) to keep existing single quotes and new lines. Pyyamls folds newlines when >- is used for multiline string, so I had to replace that with |-. Even then when you write the multiline string back with yaml.dump it will not keep the format. I needed to use a hack to make pyyaml use block format when dumping multiline strings, but seems to work fine now.

For the record though, I liked the way it was where the test description is one long line, because, in the excel sheet it will be wrapped around cell width and looks natural. While with this new fix that keeps the format first used in the config file, widening the cell has no effect. Also now it is not consistent with the test description in var_defns.sh, that must replace single quotes and newlines to work properly. In any case, please test it and let me know what you think about it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielabdi-noaa Sorry I wasn't clear about the newlines (or suggested the wrong thing). Yes, I like it to be one long string too (that's how it is now) because that's what works best in a spreadsheet, except when there is a blank line, which signifies a new paragraph or newline. Currently, if you have this in the description in the test config file (in bash):

# Hello there.  This is a description of 
# this test.  Define a couple of variables:
#
#   MY_VAR1 = "abcd"
#   MY_VAR2 = "efgh${MY_VAR1}"
#   MY_VAR3 = 'klmn${MY_VAR2}'
#
# Done with description.

it will show up like this in a cell in the spreadsheet:

Hello there.  This is a description of this test.  Define a variable:

  MY_VAR1 = "abcd"
  MY_VAR2 = "efgh${MY_VAR1}"
  MY_VAR3 = 'klmn${MY_VAR2}'

Done with description.

So the lines without a blank line in between get concatenated into one long line, but the blank lines cause there to be a newline to be inserted. Also, the indentations for the lines MY_VAR... = ... are kept, and no changes are made to single and double quotes. Maybe there is a way to specify a newline character, e.g. \n, so it can be used only where required (i.e. where we want a blank line). Anyway, I'll leave it up to you to decide what is best. Feel free to change the |- back to >- (I actually prefer that).

@danielabdi-noaa
Copy link
Collaborator Author

danielabdi-noaa commented Sep 6, 2022

@panll I run the community test case with the develop branch, the yaml branch with both yaml and shell config formats and they are all identical after you "fix" develop branch with the following patch in ush/set_gridparams_ESGgrid.py

diff --git a/ush/set_gridparams_ESGgrid.py b/ush/set_gridparams_ESGgrid.py
index 722c2f27..1831ae86 100644
--- a/ush/set_gridparams_ESGgrid.py
+++ b/ush/set_gridparams_ESGgrid.py
@@ -72,8 +72,8 @@ def set_gridparams_ESGgrid(lon_ctr,lat_ctr,nx,ny,halo_width,delx,dely,pazi):
     #-----------------------------------------------------------------------
     #

     return (lon_ctr,lat_ctr,nx,ny,pazi,halo_width,stretch_factor,
-            del_angle_x_sg,
-            del_angle_y_sg,
+            round(del_angle_x_sg,10),
+            round(del_angle_y_sg,10),

The results are here:

/scratch2/BMC/gsd-hpcs/Daniel.Abdi/expt_dirs-community

The develop branch is half way through the forecast but all 6 netcdf files match bit-for-bit with the others.

Edit Tests have finished and all netcdf files match. I have updated the location of the test directory for future reference.

#
test_descs_esc_sq=()
for (( i=0; i<=$((num_tests-1)); i++ )); do
test_descs_esc_sq[$i]=$( printf "%s" "${test_descs[$i]}" | \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess removal of this substitution is what's causing the apostrophes (single quotes) to become double quotes.

Copy link
Collaborator Author

@danielabdi-noaa danielabdi-noaa Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacement is done whenever you produce a shell string equivalent of other formats. Bash does not like single quotes since they have been causing me problems in unexpected places (two places I already mentioned but there were of others too), so I decided to get rid of them in the config parser:

            # replace some problematic chars
            v1 = v1.replace("'", '"')
            v1 = v1.replace("\n", " ")
            # end problematic
            shell_str += f"{k}='{v1}'\n"

Also I replace newlines with space for the same reason, without which I would not be able to store the test description in var_defns.sh. It is debatable whether that is needed there but new lines and single quotes in strings does cause lots of problems in bash scripts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example var_denfs.sh file with a test description

# [metadata]
description='This test checks the capability of the workflow to have the user specify a new grid (as opposed to one of the predefined ones in the workflow) of GFDLgrid type.  Note that this test sets the workflow variable   GFDLgrid_USE_NUM_CELLS_IN_FILENAMES to "TRUE" (which is its default value); see the UFS SRW User"s Guide for a description of this variable. The difference between this test and the one named   custom_GFDLgrid__GFDLgrid_USE_NUM_CELLS_IN_FILENAMES_eq_TRUE is that this one uses almost no stretching by setting the workflow variable GFDLgrid_STRETCH_FAC very close to 1.  Setting it exactly to 1 used to cause the workflow to fail because it caused the GFDL grid generator to assume a global grid.  This bug should be rechecked, e.g. by setting GFDLgrid_STRETCH_FAC to exactly 1 below.  If the grid generation succeeds, then this test can be removed.'
version='1.0'

# [user]
RUN_ENVIR='community'
MACHINE='HERA'
MACHINE_FILE='/scratch2/BMC/gsd-hpcs/Daniel.Abdi/ufs-srweather-app/regional_workflow/ush/machine/hera.sh'
ACCOUNT='zrtrr'

# [platform]
WORKFLOW_MANAGER='rocoto'
NCORES_PER_NODE='40'

That multiline description would cause problems if it had "single quotes" or "new line" characters.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. I didn't know the test description goes in var_defns.sh. It didn't used to and it's not necessary since it's not used by any tasks (as far as I know), but that's fine if you feel it should be there. And yes, it would be a problem to have single quotes and newlines in there. I wonder if you can escape them. But I'll leave it up to you how you want to handle it (also see my other comment above in this file).

@danielabdi-noaa
Copy link
Collaborator Author

@danielabdi-noaa I ran 3 WE2E tests on Hera with a version of this PR from Wednesday. They all passed, but the jobs in my crontab weren't cleared afterwards. I will rerun them with the latest version, maybe I made a mistake.

It should clear them. I have run 68 we2e test cases simultaneously on Hera and my crontab was empty after all is done.
Note that this PR does not change anything related to crontab management so if there is an issue it must come from develop.

Sorry I closed this PR by accident, pressed "closed with comment" instead of "comment"

- 0
FCST_LEN_HRS: 6
PREEXISTING_DIR_METHOD: rename
task_run_fcst:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to list the different task dictionaries in the order in which they appear in the xml, both in these test config files and in config_defaults.yaml, i.e.

task_make_grid
task_make_orog
task_make_sfc_climo
task_get_extrn_ics
task_get_extrn_lbcs
task_make_ics
task_make_lbcs
task_run_fcst
task_run_post
task_get_obs_ccpp
task_get_obs_mrms
task_get_obs_ndas
task_run_vx_... (the vx tasks are still changing)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsketefian I have made the change you suggested to both config_defaults.yaml and the we2e config files.
Will push later once I run some tests.

@danielabdi-noaa danielabdi-noaa added the ci-hera-intel-WE Kicks off automated workflow test on hera with intel label Sep 6, 2022
@venitahagerty venitahagerty removed the ci-hera-intel-WE Kicks off automated workflow test on hera with intel label Sep 6, 2022
@ufs-community ufs-community deleted a comment from venitahagerty Sep 6, 2022
@mkavulich
Copy link
Collaborator

@danielabdi-noaa We discussed this PR in the DTC meeting just now and we are comfortable merging the PR today provided we can ensure bit-for-bit equivalence. Is it possible to modify your code to do this fairly easily? My understanding in the problem is simply in a truncation of the digits in the regional_grid.nml; can you modify your code to use the full, un-truncated precision as currently occurs in develop? We understand that this precision isn't scientifically relevant, but given the size of the PR if we can ensure there is bit-for-bit equivalence that would make us much more comfortable with the merge.

@danielabdi-noaa
Copy link
Collaborator Author

danielabdi-noaa commented Sep 7, 2022

@mkavulich Ok thanks, I have just pushed a commit that uses un-trunctated values for the grid parameters. This change in the yaml PR came in very recently so all the tests I did before used un-truncated values and were matching develop bit-for-bit. Here, you can find my test results with 9 test cases, and 5 different formats = 35 runs. The shell workflow is run with develop branch:

/scratch2/BMC/gsd-hpcs/Daniel.Abdi/expt_dirs-save

The forecast output (netcdf files) match for all 5 formats per test.

Yesterday, I have run the community test case, but with truncated versions for both develop and yaml PR branches. Results are here:

/scratch2/BMC/gsd-hpcs/Daniel.Abdi/expt_dirs-community

There are three test cases in there run with develop, this PR with shell config, and this PR with yaml. They all match bit-for-bit.

The original shell script does truncation to 10 digits like this:

  del_angle_x_sg=$( bc -l <<< "(${delx}/(2.0*${radius_Earth}))*${degs_per_radian}" )
  del_angle_x_sg=$( printf "%0.10f\n" ${del_angle_x_sg} )

  del_angle_y_sg=$( bc -l <<< "(${dely}/(2.0*${radius_Earth}))*${degs_per_radian}" )
  del_angle_y_sg=$( printf "%0.10f\n" ${del_angle_y_sg} )

The python version of develop keeps all digits because I thought it didn't hurt to be more accurate.

I will run more tests if necessary.

Just to make sure nothing is changed after the last commit i.e. with a non-truncated version, I run one more test on Hera, and it matches bit-for-bit

/scratch1/BMC/zrtrr/Daniel.Abdi/rrfs/benchmark-test

@@ -1,10 +1,13 @@
#!/usr/bin/env python3

from textwrap import dedent

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielabdi-noaa Just wondering why you still need this script. The bash version of this script was something I had written to handle arguments for bash scripts/functions. Doesn't argparse take care of arguments now? (I would grep for this myself but Hera is down at the moment.)

@@ -0,0 +1,2252 @@
#----------------------------
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielabdi-noaa Can you describe a bit how/where the different sections (dictionaries) in the config file (is it called config.yaml?) are accessed? I think the idea behind dividing the variables into sections was to only use those sections that are necessary for a given rocoto task. Where are those determined for each task? Thx.

Copy link
Collaborator Author

@danielabdi-noaa danielabdi-noaa Sep 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsketefian There is this now closed PR #789 that did what you described. The variables needed only for the specific task being run are sourced. I may revive it once the dust is settled on this PR.

Copy link
Collaborator

@panll panll Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on Jet. (Hera is under maintenance today). It's byte-for-byte match now. Thanks! @danielabdi-noaa @JeffBeck-NOAA @mkavulich

@danielabdi-noaa
Copy link
Collaborator Author

danielabdi-noaa commented Sep 8, 2022

@panll Thanks for testing on Jet! I did one more test on Hera, now that it is up, including the last change. The results match bit-for-bit located here:

/scratch1/BMC/zrtrr/Daniel.Abdi/rrfs/benchmark-test

Comparing checksums

$ ls -l
total 8
drwxr-sr-x 9 Daniel.Abdi zrtrr 4096 Sep  8 01:11 grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop
drwxr-sr-x 9 Daniel.Abdi zrtrr 4096 Sep  8 00:34 grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml

$ sha256sum grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/*.nc
e50fa915134a4249f793de459b14c7f4a0d4a265b8d9434b7bc63bd9e684d636  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/atmos_4xdaily.nc
69d3dafd81e2f14ffdf111edb1e6830b29d22da500f0527189dfedf864ddbecd  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/atmos_static.nc
4da1050816c15df117d7541dca380d7f006f7ab3b5845d6468d38062a6d6eb3e  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf000.nc
485c7efbe46993ba2198bb57800649cb861b4781bf65f06a3232c08a0ee28d3f  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf001.nc
7c44f2604f43ebfd1dd7b273aa4b792575d8175719e31539475cef3017a74de2  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf002.nc
4d6cfaf370695259236f16ece06c7186a693e9f02184344600ab679fe42b2377  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf003.nc
21f7a45f7bd6465ecd12680d99439b32c9ec5ea7d0e65d0cee9dcc9855fcd186  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf004.nc
00590a0cdddf6a8a96bde4de779e8081e9beb64a26159aabfdba6da9e745d11c  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf005.nc
cfe1557d78687fa1784fd6c163d430da37340b8d05f5ef5d5c0202b39acda9fc  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/dynf006.nc
bdfd16b862b4612815c12c6cf7eb6dc5587bedf0c54feb8c25374087f0e59876  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/grid_spec.nc
f4549a0e01d0aef9ade65ac198c1f259718a972f33d4fe274362ce5095555fd1  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf000.nc
8480babb4847fcb317c813fb69323f03fde55c5e86e322656736a580d21bb411  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf001.nc
bde7b8b26c32198cde9f191cea5354ea8577c9b284c791dabd63b2e252d4a0f6  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf002.nc
7b8f60d2db4c3ec4aa7837cf77981b866c3560773f927271a90fee82aba1e174  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf003.nc
eae77d7c10375955a5c4214226e3b741877cd3ab451d03b4628f833974361b17  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf004.nc
7ba1100c9e24a7523ede677c46a09c244721425293d7663f15c54993055bf26d  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf005.nc
a03d13b37f4f0ebcd930f3f398cd94071697f69a15819bb9bf0065edf14ff619  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-develop/2019070100/phyf006.nc

$ sha256sum grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/*.nc
e50fa915134a4249f793de459b14c7f4a0d4a265b8d9434b7bc63bd9e684d636  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/atmos_4xdaily.nc
69d3dafd81e2f14ffdf111edb1e6830b29d22da500f0527189dfedf864ddbecd  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/atmos_static.nc
4da1050816c15df117d7541dca380d7f006f7ab3b5845d6468d38062a6d6eb3e  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf000.nc
485c7efbe46993ba2198bb57800649cb861b4781bf65f06a3232c08a0ee28d3f  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf001.nc
7c44f2604f43ebfd1dd7b273aa4b792575d8175719e31539475cef3017a74de2  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf002.nc
4d6cfaf370695259236f16ece06c7186a693e9f02184344600ab679fe42b2377  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf003.nc
21f7a45f7bd6465ecd12680d99439b32c9ec5ea7d0e65d0cee9dcc9855fcd186  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf004.nc
00590a0cdddf6a8a96bde4de779e8081e9beb64a26159aabfdba6da9e745d11c  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf005.nc
cfe1557d78687fa1784fd6c163d430da37340b8d05f5ef5d5c0202b39acda9fc  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/dynf006.nc
bdfd16b862b4612815c12c6cf7eb6dc5587bedf0c54feb8c25374087f0e59876  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/grid_spec.nc
f4549a0e01d0aef9ade65ac198c1f259718a972f33d4fe274362ce5095555fd1  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf000.nc
8480babb4847fcb317c813fb69323f03fde55c5e86e322656736a580d21bb411  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf001.nc
bde7b8b26c32198cde9f191cea5354ea8577c9b284c791dabd63b2e252d4a0f6  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf002.nc
7b8f60d2db4c3ec4aa7837cf77981b866c3560773f927271a90fee82aba1e174  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf003.nc
eae77d7c10375955a5c4214226e3b741877cd3ab451d03b4628f833974361b17  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf004.nc
7ba1100c9e24a7523ede677c46a09c244721425293d7663f15c54993055bf26d  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf005.nc
a03d13b37f4f0ebcd930f3f398cd94071697f69a15819bb9bf0065edf14ff619  grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2-yaml/2019070100/phyf006.nc

Copy link
Collaborator

@JeffBeck-NOAA JeffBeck-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving based on @linlin-pan's testing and @gsketefian's review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tested on Cheyenne Successfully tested on NCAR Cheyenne machine Tested on Hera Tested successfully on Hera machine Tested on Jet Successfully tested on Jet machine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants