@@ -504,7 +504,8 @@ def calc_costs(
504504 # --------- ELEVATION DISTRIBUTION-DEPENENT COSTS ----------
505505 def calc_elev_bin_weights (slr , lb_elevs , bin_width ):
506506 """Calculates the fraction of a cell inundated/abandoned given a defined
507- slr/retreat height."""
507+ slr/retreat height.
508+ """
508509 return _pos (np .minimum (slr - lb_elevs , bin_width )) / bin_width
509510
510511 # loop over each elevation band to sum up elevation-distribution-dependent costs
@@ -832,7 +833,6 @@ def select_optimal_case(
832833 ``optimalfixed``, which represents the optimal adaptation choice for this region
833834 for each socioeconomic and SLR trajectory.
834835 """
835-
836836 opt_case = (
837837 xr .open_zarr (
838838 str (all_case_cost_path ), chunks = None , storage_options = storage_options
@@ -898,7 +898,7 @@ def execute_pyciam(
898898 diaz_config = False ,
899899 dask_client_func = Client ,
900900 storage_options = None ,
901- ** model_kwargs
901+ ** model_kwargs ,
902902):
903903 """Execute the full pyCIAM model. The following inputs are assumed:
904904
@@ -1032,7 +1032,6 @@ def execute_pyciam(
10321032 **model_kwargs
10331033 Passed directly to :py:func:`pyCIAM.calc_costs`
10341034 """
1035-
10361035 # convert filepaths to appropriate path representation
10371036 (
10381037 params_path ,
@@ -1190,7 +1189,7 @@ def execute_pyciam(
11901189 "case" : CASES ,
11911190 "costtype" : COSTTYPES ,
11921191 seg_var : ciam_in [seg_var ].values ,
1193- "scenario" : slr .scenario ,
1192+ "scenario" : slr .scenario . astype ( "unicode" ) ,
11941193 "quantile" : quantiles ,
11951194 "year" : np .arange (params .model_start , ciam_in .year .max ().item () + 1 ),
11961195 ** {
@@ -1251,7 +1250,7 @@ def execute_pyciam(
12511250 quantiles = quantiles ,
12521251 diaz_inputs = diaz_inputs ,
12531252 eps = eps ,
1254- ** model_kwargs
1253+ ** model_kwargs ,
12551254 ),
12561255 dim = "seg" ,
12571256 )
@@ -1316,7 +1315,7 @@ def execute_pyciam(
13161315 storage_options = storage_options ,
13171316 diaz_inputs = diaz_inputs ,
13181317 check = check ,
1319- ** model_kwargs
1318+ ** model_kwargs ,
13201319 )
13211320 )
13221321
@@ -1365,7 +1364,7 @@ def execute_pyciam(
13651364 seg_var = seg_var ,
13661365 eps = eps ,
13671366 check = check ,
1368- storage_options = storage_options
1367+ storage_options = storage_options ,
13691368 ),
13701369 axis = 1 ,
13711370 )
@@ -1439,7 +1438,7 @@ def get_refA(
14391438 quantiles = [0.5 ],
14401439 eps = 1 ,
14411440 diaz_inputs = False ,
1442- ** model_kwargs
1441+ ** model_kwargs ,
14431442):
14441443 if diaz_inputs :
14451444 inputs , slr = load_diaz_inputs (
@@ -1463,7 +1462,7 @@ def get_refA(
14631462 include_ncc = True ,
14641463 storage_options = storage_options ,
14651464 quantiles = quantiles ,
1466- ** params .refA_scenario_selectors
1465+ ** params .refA_scenario_selectors ,
14671466 )
14681467 slr = slr .unstack ("scen_mc" )
14691468 slr = slr .squeeze (drop = True )
@@ -1514,7 +1513,7 @@ def calc_all_cases(
15141513 storage_options = {},
15151514 check = True ,
15161515 diaz_inputs = False ,
1517- ** model_kwargs
1516+ ** model_kwargs ,
15181517):
15191518 if check_finished_zarr_workflow (
15201519 finalstore = output_path if check else None ,
@@ -1565,7 +1564,7 @@ def calc_all_cases(
15651564 surge_lookup = surge ,
15661565 elev_chunksize = None ,
15671566 min_R_noadapt = refA ,
1568- ** model_kwargs
1567+ ** model_kwargs ,
15691568 ).to_dataset (name = "costs" )
15701569 if seg_var != "seg" :
15711570 out = out .rename (seg = seg_var )
@@ -1589,7 +1588,7 @@ def optimize_case(
15891588 seg_var = "seg_adm" ,
15901589 check = True ,
15911590 eps = 1 ,
1592- storage_options = {}
1591+ storage_options = {},
15931592):
15941593 # use last fpath to check if this task has already been run
15951594 if check and check_finished_zarr_workflow (
0 commit comments