File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1616
1717"""
1818
19+ import re
20+
1921from CIME .SystemTests .system_tests_compare_two import SystemTestsCompareTwo
2022from CIME .XML .standard_module_setup import *
2123from CIME .SystemTests .test_utils .user_nl_utils import append_to_user_nl_files
@@ -53,13 +55,16 @@ def _case_one_setup(self):
5355 user_nl_clm_path = os .path .join (self ._get_caseroot (), "user_nl_clm" )
5456 with open (user_nl_clm_path ) as f :
5557 user_nl_clm_text = f .read ()
56- for grain_output in re .findall ("GRAIN\w*" , user_nl_clm_text ):
57- user_nl_clm_text = user_nl_clm_text .replace (
58- grain_output ,
58+
59+ def replace_grain (match ):
60+ grain_output = match .group ()
61+ return (
5962 grain_output .replace ("GRAIN" , "REPRODUCTIVE1" )
6063 + "', '"
61- + grain_output .replace ("GRAIN" , "REPRODUCTIVE2" ),
64+ + grain_output .replace ("GRAIN" , "REPRODUCTIVE2" )
6265 )
66+
67+ user_nl_clm_text = re .sub (r"GRAIN\w*" , replace_grain , user_nl_clm_text )
6368 with open (user_nl_clm_path , "w" ) as f :
6469 f .write (user_nl_clm_text )
6570
You can’t perform that action at this time.
0 commit comments