Skip to content

Bug fix and improvement for ccpp_track_variables tool#451

Merged
grantfirl merged 3 commits into
NCAR:mainfrom
mkavulich:feature/improve_track_variables
May 25, 2022
Merged

Bug fix and improvement for ccpp_track_variables tool#451
grantfirl merged 3 commits into
NCAR:mainfrom
mkavulich:feature/improve_track_variables

Conversation

@mkavulich
Copy link
Copy Markdown
Collaborator

@mkavulich mkavulich commented May 11, 2022

This PR changes the output slightly, so that the ordered lists of schemes are now broken down by group. This is done because different groups in a physics suite can be called in different orders depending on the logic of the host model, so only within each group is a set of schemes guaranteed to be called in that order.

This PR also fixes a bug in ccpp_track_variables.py that double-counted variables in schemes that have .meta files containing descriptions of more than one scheme.

Finally, this PR has some small improvements suggested by pylint, including removing trailing whitespace and trimming long lines.

Cases with partial matches or no matches found will not be affected by this change.

User interface changes?: No

Fixes: #450 (duplicate counting of schemes)

Testing:
Ran script against multiple xmls and confirmed new behavior removes duplicate schemes in script output. Also output is now broken down by group.

Here is an example of old output vs new:

Old

framework/scripts/ccpp_track_variables.py --config=config/ccpp_prebuild_config.py -s=suites/suite_FV3_GFS_v16_noahmp.xml -v air_temperature_of_new_state -m ./physics/physics/
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_gas_optics_rrtmgp
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_arry
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_1scl
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_2str
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_nstr
For suite suites/suite_FV3_GFS_v16_noahmp.xml, the following schemes (in order) use the variable air_temperature_of_new_state:
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
get_phi_fv3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
dcyc2t3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
ozphys_2015_run (intent in)
get_phi_fv3_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
GFS_DCNV_generic_pre_run (intent in)
GFS_DCNV_generic_post_run (intent in)
samfdeepcnv_run (intent inout)
GFS_DCNV_generic_pre_run (intent in)
GFS_DCNV_generic_post_run (intent in)
GFS_SCNV_generic_pre_run (intent in)
GFS_SCNV_generic_post_run (intent in)
samfshalcnv_run (intent inout)
GFS_SCNV_generic_pre_run (intent in)
GFS_SCNV_generic_post_run (intent in)
GFS_suite_stateout_reset_run (intent out)
GFS_suite_stateout_update_run (intent out)
GFS_suite_interstitial_3_run (intent in)
GFS_MP_generic_pre_run (intent in)
GFS_MP_generic_post_run (intent in)
gfdl_cloud_microphys_run (intent inout)
GFS_MP_generic_pre_run (intent in)
GFS_MP_generic_post_run (intent in)
maximum_hourly_diagnostics_run (intent in)
GFS_stochastics_run (intent inout)

New

framework/scripts/ccpp_track_variables.py --config=config/ccpp_prebuild_config.py -s=suites/suite_FV3_GFS_v16_noahmp.xml -v air_temperature_of_new_state -m ./physics/physics/
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_gas_optics_rrtmgp
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_arry
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_1scl
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_2str
WARNING:root:Encountered closing statement "end type" without type name; assume type_name is ty_optical_props_nstr
For suite suites/suite_FV3_GFS_v16_noahmp.xml, the following schemes (in order for each group) use the variable air_temperature_of_new_state:
In group physics
  GFS_suite_stateout_reset_run (intent out)
  dcyc2t3_run (intent in)
  GFS_suite_stateout_update_run (intent out)
  ozphys_2015_run (intent in)
  get_phi_fv3_run (intent in)
  GFS_suite_interstitial_3_run (intent in)
  GFS_DCNV_generic_pre_run (intent in)
  samfdeepcnv_run (intent inout)
  GFS_DCNV_generic_post_run (intent in)
  GFS_SCNV_generic_pre_run (intent in)
  samfshalcnv_run (intent inout)
  GFS_SCNV_generic_post_run (intent in)
  GFS_MP_generic_pre_run (intent in)
  gfdl_cloud_microphys_run (intent inout)
  GFS_MP_generic_post_run (intent in)
  maximum_hourly_diagnostics_run (intent in)
In group stochastics
  GFS_stochastics_run (intent inout)

mkavulich added 2 commits May 11, 2022 11:19
…es based on the xml file,

output a list of schemes broken down by group (since groups can be called in different orders
based on the logic in the host model)
…ation for multiple schemes, which led to incorrect duplication of schemes listed in output
@ligiabernardet ligiabernardet added CCPP v6 Needed for CCPP v6 public release bug For issues describing bugs, or PRs fixing bugs labels May 12, 2022
Copy link
Copy Markdown
Collaborator

@grantfirl grantfirl left a comment

Choose a reason for hiding this comment

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

Looks OK to me.

@gold2718 gold2718 added bugfix Fix for issue with 'bug' label. and removed bug For issues describing bugs, or PRs fixing bugs labels May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix for issue with 'bug' label. CCPP v6 Needed for CCPP v6 public release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug results in over-counting some schemes in new ccpp_track_variables.py script

5 participants