11
11
import os
12
12
import shutil
13
13
import itertools
14
+ import glob
14
15
15
16
# Extensions
16
17
import f90nml
@@ -30,15 +31,11 @@ def __init__(self, expt, name, config):
30
31
self .model_type = 'staged_cable'
31
32
self .default_exec = 'cable'
32
33
33
- # We want people to be able to use payu during testing, which
34
- # often means additions of new namelists due to new science
35
- # modules. I would like to set
36
- # optional_config_files = glob.glob("*.nml")
37
- # but this feels like a bit of an abuse of feature.
38
34
self .config_files = ['stage_config.yaml' ]
39
- self .optional_config_files = ['cable.nml' , 'cru.nml' ,
40
- 'luc.nml' , 'met_names.nml' ,
41
- 'bios.nml' ]
35
+
36
+ # To support different branches of cable, which may have different
37
+ # namelists, add all found namelists to the optional_config_files
38
+ self .optional_config_files = glob .glob ('*.nml' )
42
39
43
40
def setup (self ):
44
41
super (StagedCable , self ).setup ()
@@ -178,13 +175,13 @@ def _apply_stage_namelists(self, stage_name):
178
175
for namelist in namelists :
179
176
write_target = os .path .join (self .work_input_path , namelist )
180
177
stage_nml = os .path .join (self .control_path , stage_name , namelist )
178
+ master_nml = os .path .join (self .control_path , namelist )
181
179
182
- if os .path .isfile (os . path . join ( self . control_path , namelist ) ):
180
+ if os .path .isfile (master_nml ):
183
181
# Instance where there is a master and stage namelist
184
182
with open (stage_nml ) as stage_nml_f :
185
183
stage_namelist = f90nml .read (stage_nml_f )
186
184
187
- master_nml = os .path .join (self .control_path , namelist )
188
185
f90nml .patch (master_nml , stage_namelist , write_target )
189
186
else :
190
187
# Instance where there is only a stage namelist
0 commit comments