@@ -95,20 +95,20 @@ class Task:
95
95
96
96
def __init__ (
97
97
self ,
98
- repo : Model ,
98
+ model : Model ,
99
99
met_forcing_file : str ,
100
100
sci_conf_id : int ,
101
101
sci_config : dict ,
102
102
) -> None :
103
- self .repo = repo
103
+ self .model = model
104
104
self .met_forcing_file = met_forcing_file
105
105
self .sci_conf_id = sci_conf_id
106
106
self .sci_config = sci_config
107
107
108
108
def get_task_name (self ) -> str :
109
109
"""Returns the file name convention used for this task."""
110
110
met_forcing_base_filename = self .met_forcing_file .split ("." )[0 ]
111
- return f"{ met_forcing_base_filename } _R{ self .repo . repo_id } _S{ self .sci_conf_id } "
111
+ return f"{ met_forcing_base_filename } _R{ self .model . model_id } _S{ self .sci_conf_id } "
112
112
113
113
def get_output_filename (self ) -> str :
114
114
"""Returns the file name convention used for the netcdf output file."""
@@ -188,19 +188,19 @@ def setup_task(self, verbose=False):
188
188
print (f" Adding science configurations to CABLE namelist file { nml_path } " )
189
189
patch_namelist (nml_path , self .sci_config )
190
190
191
- if self .repo .patch :
191
+ if self .model .patch :
192
192
if verbose :
193
193
print (
194
194
f" Adding branch specific configurations to CABLE namelist file { nml_path } "
195
195
)
196
- patch_namelist (nml_path , self .repo .patch )
196
+ patch_namelist (nml_path , self .model .patch )
197
197
198
- if self .repo .patch_remove :
198
+ if self .model .patch_remove :
199
199
if verbose :
200
200
print (
201
201
f" Removing branch specific configurations from CABLE namelist file { nml_path } "
202
202
)
203
- patch_remove_namelist (nml_path , self .repo .patch_remove )
203
+ patch_remove_namelist (nml_path , self .model .patch_remove )
204
204
205
205
def clean_task (self , verbose = False ):
206
206
"""Cleans output files, namelist files, log files and cable executables if they exist."""
@@ -264,7 +264,7 @@ def fetch_files(self, verbose=False):
264
264
self .root_dir / internal .NAMELIST_DIR , task_dir , dirs_exist_ok = True
265
265
)
266
266
267
- exe_src = self .repo .get_exe_path ()
267
+ exe_src = self .model .get_exe_path ()
268
268
exe_dest = task_dir / internal .CABLE_EXE
269
269
270
270
if verbose :
@@ -343,28 +343,28 @@ def add_provenance_info(self, verbose=False):
343
343
).items ()
344
344
},
345
345
** {
346
- "cable_branch" : self .repo .svn_info_show_item ( "url" ),
347
- "svn_revision_number" : self .repo .svn_info_show_item ( "revision" ),
346
+ "cable_branch" : self .model . repo .get_branch_name ( ),
347
+ "svn_revision_number" : self .model . repo .get_revision ( ),
348
348
"benchcab_version" : __version__ ,
349
349
},
350
350
}
351
351
)
352
352
353
353
354
354
def get_fluxsite_tasks (
355
- repos : list [Model ],
355
+ models : list [Model ],
356
356
science_configurations : list [dict ],
357
357
fluxsite_forcing_file_names : list [str ],
358
358
) -> list [Task ]:
359
359
"""Returns a list of fluxsite tasks to run."""
360
360
tasks = [
361
361
Task (
362
- repo = repo ,
362
+ model = model ,
363
363
met_forcing_file = file_name ,
364
364
sci_conf_id = sci_conf_id ,
365
365
sci_config = sci_config ,
366
366
)
367
- for repo in repos
367
+ for model in models
368
368
for file_name in fluxsite_forcing_file_names
369
369
for sci_conf_id , sci_config in enumerate (science_configurations )
370
370
]
@@ -403,14 +403,14 @@ def get_fluxsite_comparisons(
403
403
output_dir / task_b .get_output_filename (),
404
404
),
405
405
task_name = get_comparison_name (
406
- task_a .repo , task_b .repo , task_a .met_forcing_file , task_a .sci_conf_id
406
+ task_a .model , task_b .model , task_a .met_forcing_file , task_a .sci_conf_id
407
407
),
408
408
)
409
409
for task_a in tasks
410
410
for task_b in tasks
411
411
if task_a .met_forcing_file == task_b .met_forcing_file
412
412
and task_a .sci_conf_id == task_b .sci_conf_id
413
- and task_a .repo . repo_id < task_b .repo . repo_id
413
+ and task_a .model . model_id < task_b .model . model_id
414
414
# TODO(Sean): Review later - the following code avoids using a double
415
415
# for loop to generate pair wise combinations, however we would have
416
416
# to re-initialize task instances to get access to the output file path
@@ -425,14 +425,14 @@ def get_fluxsite_comparisons(
425
425
426
426
427
427
def get_comparison_name (
428
- repo_a : Model ,
429
- repo_b : Model ,
428
+ model_a : Model ,
429
+ model_b : Model ,
430
430
met_forcing_file : str ,
431
431
sci_conf_id : int ,
432
432
) -> str :
433
433
"""Returns the naming convention used for bitwise comparisons."""
434
434
met_forcing_base_filename = met_forcing_file .split ("." )[0 ]
435
435
return (
436
436
f"{ met_forcing_base_filename } _S{ sci_conf_id } "
437
- f"_R{ repo_a . repo_id } _R{ repo_b . repo_id } "
437
+ f"_R{ model_a . model_id } _R{ model_b . model_id } "
438
438
)
0 commit comments