File tree Expand file tree Collapse file tree 2 files changed +28
-13
lines changed
Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -319,8 +319,9 @@ def scc():
319319 self .logger .info ("Processing SCC calculation ..." )
320320 if self .fit_type == "quantreg" :
321321 self .full_uncertainty_iqr
322- self .calculate_scc
323- self .stat_uncertainty_iqr
322+ if len (self .fair_aggregation ) > 0 :
323+ self .calculate_scc
324+ self .stat_uncertainty_iqr
324325 else :
325326 if len (self .fair_aggregation ) > 0 :
326327 self .stream_discount_factors
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def ce_from_chunk(
2121 zero ,
2222 socioec ,
2323 ce_batch_coords ,
24+ quantreg ,
2425):
2526 year = chunk .year .values
2627 ssp = chunk .ssp .values
@@ -44,13 +45,19 @@ def ce_from_chunk(
4445 raise NotImplementedError ("Pass 'cc' or 'no_cc' to reduction." )
4546
4647 if recipe == "adding_up" :
47- result = mean_func (
48- np .maximum (
49- calculation ,
50- bottom_code ,
51- ),
52- "batch" ,
53- )
48+ if not quantreg :
49+ result = mean_func (
50+ np .maximum (
51+ calculation ,
52+ bottom_code ,
53+ ),
54+ "batch" ,
55+ )
56+ else :
57+ result = np .maximum (
58+ calculation ,
59+ bottom_code ,
60+ )
5461 elif recipe == "risk_aversion" :
5562 result = ce_func (
5663 np .maximum (
@@ -73,6 +80,7 @@ def reduce_damages(
7380 socioec ,
7481 bottom_coding_gdppc = 39.39265060424805 ,
7582 zero = False ,
83+ quantreg = False ,
7684):
7785 if recipe == "adding_up" :
7886 assert (
@@ -112,10 +120,15 @@ def reduce_damages(
112120 "model" : 1 ,
113121 "ssp" : 1 ,
114122 }
115-
116- ce_batch_dims = [i for i in gdppc .dims ] + [
117- i for i in ds .dims if i not in gdppc .dims and i != "batch"
118- ]
123+ if quantreg :
124+ chunkies ['batch' ] = 1
125+ ce_batch_dims = [i for i in gdppc .dims ] + [
126+ i for i in ds .dims if i not in gdppc .dims
127+ ]
128+ else :
129+ ce_batch_dims = [i for i in gdppc .dims ] + [
130+ i for i in ds .dims if i not in gdppc .dims and i != "batch"
131+ ]
119132 ce_batch_coords = {c : ds [c ].values for c in ce_batch_dims }
120133 ce_batch_coords ["region" ] = [
121134 i for i in gdppc .region .values if i in ce_batch_coords ["region" ]
@@ -143,6 +156,7 @@ def reduce_damages(
143156 zero = zero ,
144157 socioec = socioec ,
145158 ce_batch_coords = ce_batch_coords ,
159+ quantreg = quantreg ,
146160 ),
147161 template = template ,
148162 )
You can’t perform that action at this time.
0 commit comments