@@ -247,17 +247,17 @@ def __init__(
247247 self .logger = logging .getLogger (__name__ )
248248
249249 if self .quantreg_quantiles is not None :
250- assert len (self .quantreg_quantiles ) == len (
251- self . quantreg_weights
252- ), "Length of quantreg quantiles does not match length of weights."
250+ assert len (self .quantreg_quantiles ) == len (self . quantreg_weights ), (
251+ "Length of quantreg quantiles does not match length of weights."
252+ )
253253
254- assert (
255- self . discounting_type in self .DISCOUNT_TYPES
256- ), f"Discount type not implemented. Try one of { self . DISCOUNT_TYPES } ."
254+ assert self . discounting_type in self . DISCOUNT_TYPES , (
255+ f"Discount type not implemented. Try one of { self .DISCOUNT_TYPES } ."
256+ )
257257
258- assert (
259- self . formula in self .FORMULAS
260- ), f"Formula not implemented. Try one of { self . FORMULAS } ."
258+ assert self . formula in self . FORMULAS , (
259+ f"Formula not implemented. Try one of { self .FORMULAS } ."
260+ )
261261
262262 # Set stream of discounts to None if discounting_type is 'constant'
263263 # 'constant_model_collapsed' should be here except that we allow
@@ -488,10 +488,7 @@ def _aggregate_by_geography(
488488 return data # No aggregation needed
489489
490490 elif geography == "country" :
491- if (
492- hasattr (self , "country_mapping" )
493- and self .country_mapping is not None
494- ):
491+ if hasattr (self , "country_mapping" ) and self .country_mapping is not None :
495492 return self ._aggregate_to_country (data )
496493 else :
497494 raise ValueError (
@@ -530,9 +527,7 @@ def _aggregate_to_country(self, data: xr.DataArray) -> xr.DataArray:
530527 else "nopop"
531528 for _ , row in self .country_mapping .iterrows ()
532529 }
533- territories = [
534- mapping .get (str (r )[:3 ], "unknown" ) for r in data .region .values
535- ]
530+ territories = [mapping .get (str (r )[:3 ], "unknown" ) for r in data .region .values ]
536531 return data .assign_coords ({"region" : territories }).groupby ("region" ).sum ()
537532
538533 def damages_dataset (self , geography : str = "globe" ) -> xr .Dataset :
@@ -579,9 +574,7 @@ def _filter_illegal_combinations_xr(self, ds: xr.Dataset) -> xr.Dataset:
579574 xr.Dataset
580575 Filtered dataset with illegal combinations set to NaN
581576 """
582- if "ssp" in ds .coords and any (
583- ssp in ds .ssp .values for ssp in ["SSP1" , "SSP5" ]
584- ):
577+ if "ssp" in ds .coords and any (ssp in ds .ssp .values for ssp in ["SSP1" , "SSP5" ]):
585578 self .logger .info ("Dropping illegal model combinations." )
586579 illegal = ((ds .ssp == "SSP1" ) & (ds .rcp == "rcp85" )) | (
587580 (ds .ssp == "SSP5" ) & (ds .rcp == "rcp45" )
0 commit comments