Skip to content

Commit f7e4af9

Browse files
committed
enable override of params file in execute_pyciam
1 parent b9b6349 commit f7e4af9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pyCIAM/run.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ def execute_pyciam(
951951
diaz_config=False,
952952
dask_client_func=Client,
953953
storage_options=None,
954+
params_override={},
954955
**model_kwargs,
955956
):
956957
"""Execute the full pyCIAM model. The following inputs are assumed:
@@ -1082,6 +1083,8 @@ def execute_pyciam(
10821083
reflected in `storage_options["token"]`. Other cloud storage providers will have
10831084
different authentication methods and have not yet been tested with this
10841085
function.
1086+
params_override : dict, default {}
1087+
Used to override params specified in `params_path`
10851088
**model_kwargs
10861089
Passed directly to :py:func:`pyCIAM.calc_costs`
10871090
"""
@@ -1115,6 +1118,7 @@ def execute_pyciam(
11151118

11161119
# read parameters
11171120
params = pd.read_json(params_path)["values"]
1121+
params.update(params_override)
11181122

11191123
# determine whether to check for finished jobs
11201124
if output_path is None:
@@ -1276,6 +1280,10 @@ def execute_pyciam(
12761280
compute=False,
12771281
mode="w",
12781282
storage_options=storage_options,
1283+
encoding={
1284+
"costs": {"fill_value": "NaN"},
1285+
"optimal_case": {"fill_value": 255},
1286+
},
12791287
)
12801288

12811289
####################################################
@@ -1470,8 +1478,6 @@ def execute_pyciam(
14701478
.costs.notnull()
14711479
.all()
14721480
)
1473-
client.cluster.close()
1474-
client.close()
14751481
if remove_tmpfile:
14761482
if isinstance(tmp_output_path, CloudPath):
14771483
tmp_output_path.rmtree()

0 commit comments

Comments
 (0)