2222import logging
2323
2424import numpy as np
25+ import scipy .sparse as sparse
2526
2627from ..util .checker import size
2728from ..util .forecast import Forecast
@@ -149,7 +150,7 @@ def min(self):
149150 A HazardForecast object with the min intensity and fraction.
150151 """
151152 red_intensity = sparse .csr_matrix (self .intensity .min (axis = 0 ))
152- red_fraction = sparse .csr_matrix (self .fraction .sum ( ))
153+ red_fraction = sparse .csr_matrix (self .fraction .min ( axis = 0 ))
153154 reduced_attrs = self ._reduce_attrs ("min" )
154155 return HazardForecast (
155156 lead_time = reduced_attrs ["lead_time" ],
@@ -163,7 +164,7 @@ def min(self):
163164 frequency_unit = self .frequency_unit ,
164165 event_name = reduced_attrs ["event_name" ],
165166 date = reduced_attrs ["date" ],
166- orig = hazard . orig ,
167+ orig = reduced_attrs [ " orig" ] ,
167168 intensity = red_intensity ,
168169 fraction = red_fraction ,
169170 )
@@ -182,8 +183,8 @@ def max(self):
182183 HazardForecast
183184 A HazardForecast object with the min intensity and fraction.
184185 """
185- red_intensity = sparse .csr_matrix (self .intensity .min (axis = 0 ))
186- red_fraction = sparse .csr_matrix (self .fraction .sum ( ))
186+ red_intensity = sparse .csr_matrix (self .intensity .max (axis = 0 ))
187+ red_fraction = sparse .csr_matrix (self .fraction .max ( axis = 0 ))
187188 reduced_attrs = self ._reduce_attrs ("max" )
188189 return HazardForecast (
189190 lead_time = reduced_attrs ["lead_time" ],
@@ -197,7 +198,7 @@ def max(self):
197198 frequency_unit = self .frequency_unit ,
198199 event_name = reduced_attrs ["event_name" ],
199200 date = reduced_attrs ["date" ],
200- orig = hazard . orig ,
201+ orig = reduced_attrs [ " orig" ] ,
201202 intensity = red_intensity ,
202203 fraction = red_fraction ,
203204 )
@@ -218,8 +219,8 @@ def mean(self):
218219 HazardForecast
219220 A HazardForecast object with the min intensity and fraction.
220221 """
221- red_intensity = sparse .csr_matrix (self .intensity .min (axis = 0 ))
222- red_fraction = sparse .csr_matrix (self .fraction .sum ( ))
222+ red_intensity = sparse .csr_matrix (self .intensity .mean (axis = 0 ))
223+ red_fraction = sparse .csr_matrix (self .fraction .mean ( axis = 0 ))
223224 reduced_attrs = self ._reduce_attrs ("mean" )
224225 return HazardForecast (
225226 lead_time = reduced_attrs ["lead_time" ],
@@ -233,7 +234,7 @@ def mean(self):
233234 frequency_unit = self .frequency_unit ,
234235 event_name = reduced_attrs ["event_name" ],
235236 date = reduced_attrs ["date" ],
236- orig = hazard . orig ,
237+ orig = reduced_attrs [ " orig" ] ,
237238 intensity = red_intensity ,
238239 fraction = red_fraction ,
239240 )
0 commit comments