Skip to content

Commit

Permalink
code cleanup; review requests; include python3.12 in ci testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Courtney Peverley committed Apr 22, 2024
1 parent a4548a0 commit 930c3db
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 4 additions & 2 deletions scripts/ccpp_capgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,16 @@ def capgen(run_env, return_db=False):
scheme_headers, scheme_tdict = parse_scheme_files(scheme_files, run_env)
# Pull out the dynamic constituent routines, if any
dyn_const_dict = {}
dyn_val_dict = {}
for table in scheme_tdict:
routine_name = scheme_tdict[table].dyn_const_routine
if routine_name is not None:
if routine_name not in dyn_const_dict.values():
if routine_name not in dyn_val_dict:
dyn_const_dict[table] = routine_name
dyn_val_dict[routine_name] = table
else:
# dynamic constituent routines must have unique names
scheme_name = list(dyn_const_dict.keys())[list(dyn_const_dict.values()).index(routine_name)]
scheme_name = dyn_val_dict[routine_name]
errmsg = f"ERROR: Dynamic constituent routine names must be unique. Cannot add " \
f"{routine_name} for {table}. Routine already exists in {scheme_name}. "
raise CCPPError(errmsg)
Expand Down
3 changes: 1 addition & 2 deletions scripts/constituents.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def write_host_routines(cap, host, reg_funcname, init_funcname, num_const_funcna
# XXgoldyXX: ^ need to generalize host model error var type support
# First up, the registration routine
substmt = f"subroutine {reg_funcname}"
args = "suite_list, host_constituents, dynamic_constituents "
args = "host_constituents, dynamic_constituents "
stmt = f"{substmt}({args}, {err_dummy_str})"
cap.write(stmt, 1)
cap.comment("Create constituent object for suites in <suite_list>", 2)
Expand All @@ -488,7 +488,6 @@ def write_host_routines(cap, host, reg_funcname, init_funcname, num_const_funcna
# end if
cap.blank_line()
cap.comment("Dummy arguments", 2)
cap.write("character(len=*), intent(in) :: suite_list(:)", 2)
cap.write(f"type({CONST_PROP_TYPE}), target, intent(in) :: " + \
"host_constituents(:)", 2)
cap.write(f"type({CONST_PROP_TYPE}), allocatable, target, intent(inout) :: " + \
Expand Down
6 changes: 3 additions & 3 deletions test/advection_test/test_host.F90
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ subroutine test_host(retval, test_suites)
errcode=errflg, errmsg=errmsg)
call check_errflg(subname//'.initialize', errflg, errmsg, errflg_final)
if (errflg == 0) then
call test_host_ccpp_register_constituents(suite_names(:), &
host_constituents, dynamic_constituents=dynamic_constituents, &
errmsg=errmsg, errflg=errflg)
call test_host_ccpp_register_constituents(host_constituents, &
dynamic_constituents=dynamic_constituents, &
errmsg=errmsg, errflg=errflg)
end if
if (errflg /= 0) then
write(6, '(2a)') 'ERROR register_constituents: ', trim(errmsg)
Expand Down

0 comments on commit 930c3db

Please sign in to comment.