Skip to content

Commit

Permalink
Adds an alternative python workflow generation path (#698)
Browse files Browse the repository at this point in the history
* Workflow in python starting to work.

* Use new python_utils package structure.

* Some bug fixes.

* Use uppercase TRUE/FALSE in var_dfns

* Use config.sh by default.

* Minor bug fixes.

* Remove config.yaml

* Update to the latest develop

* Remove quotes from numbers in predef grid.

* Minor bug fix.

* Move validity checker to the bottom of setup

* Add more unit tests.

* Update with python_utils changes.

* Update to latest develop additions (Need to re-run regression test)

* Use set_namelist and fill_jinja_template as python functions.

* Replace sed regex searches with python re.

* Use python realpath.

* Construct settings as dictionary before passing to fill_jinja and set_namelist

* Use yaml for setting predefined grid parameters.

* Use xml parser for ccpp phys suite definition file.

* Remove more run_command calls.

* Simplify some func argument processing.

* Move different config format parsers to same file.

* Use os.path.join for the sake of macosx

* Remove remaining func argument processing via os.environ.

* Minor bug fix in set_extrn_mdl_params.sh

* Add suite defn in test_data.

* Minor fixes on unittest on jet.

* Simplify boolean condition checks.

* Include old in renaming of old directories

* Fix conflicting yaml !join tag for paths and strings.

* Bug fix with setting sfcperst dict.

* Imitate "readlink -m" with os.path.realpath instead of os.readlink

* Don't use /tmp as that is shared by multiple users.

* Bug fix with cron line, maintain quotes around TRUE/FALSE.

* Update to latest develop (untested)

* Bug fix with existing cron line and quotes.

* Bug fix with case-sensitive MACHINE name, and empty EXPT_DIR.

* Update to latest develop

* More updates.

* Bug fix thanks to @willmayfield! Check both starting/ending
characters are brackets for shell variable to be considered an array.

* Make empty EXPT_BASEDIR workable.

* Update to latest develop

* Update in predef grid.

* Check f90nml as well.

Co-authored-by: Daniel Abdi <dabdi@Orion-login-2.HPC.MsState.Edu>
  • Loading branch information
danielabdi-noaa and Daniel Abdi authored Apr 26, 2022
1 parent 43aa291 commit 35c3684
Show file tree
Hide file tree
Showing 61 changed files with 8,946 additions and 142 deletions.
30 changes: 30 additions & 0 deletions ush/check_ruc_lsm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import os
import unittest

from python_utils import set_env_var, print_input_args, \
load_xml_file, has_tag_with_value

def check_ruc_lsm(ccpp_phys_suite_fp):
""" This file defines a function that checks whether the RUC land surface
model (LSM) parameterization is being called by the selected physics suite.
Args:
ccpp_phys_suite_fp: full path to CCPP physics suite xml file
Returns:
Boolean
"""

print_input_args(locals())

tree = load_xml_file(ccpp_phys_suite_fp)
has_ruc = has_tag_with_value(tree, "scheme", "lsm_ruc")
return has_ruc

class Testing(unittest.TestCase):
def test_check_ruc_lsm(self):
self.assertTrue( check_ruc_lsm(ccpp_phys_suite_fp=f"test_data{os.sep}suite_FV3_GSD_SAR.xml") )
def setUp(self):
set_env_var('DEBUG',True)

Loading

0 comments on commit 35c3684

Please sign in to comment.