diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e6cfbfe..7e7153804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,8 @@ Removed: - Reduce memory requirements of `TropCyclone.from_tracks` [#749](https://github.com/CLIMADA-project/climada_python/pull/749) - Support for different wind speed and pressure units in `TCTracks` when running `TropCyclone.from_tracks` [#749](https://github.com/CLIMADA-project/climada_python/pull/749) - Changed the parallel package from Pathos to Multiproess in the unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763) - +- Allow setting the loglevel in unsequa module [#765](https://github.com/CLIMADA-project/climada_python/pull/765) +- ### Fixed - `util.lines_polys_handler` solve polygon disaggregation issue in metre-based projection [#666](https://github.com/CLIMADA-project/climada_python/pull/666) diff --git a/climada/engine/unsequa/calc_cost_benefit.py b/climada/engine/unsequa/calc_cost_benefit.py index e01c05615..18b968b0b 100644 --- a/climada/engine/unsequa/calc_cost_benefit.py +++ b/climada/engine/unsequa/calc_cost_benefit.py @@ -129,7 +129,7 @@ def __init__( - def uncertainty(self, unc_data, processes=1, **cost_benefit_kwargs): + def uncertainty(self, unc_data, processes=1, loglevel='ERROR', **cost_benefit_kwargs): """ Computes the cost benefit for each sample in unc_output.sample_df. @@ -152,6 +152,9 @@ def uncertainty(self, unc_data, processes=1, **cost_benefit_kwargs): processes : int, optional Number of CPUs to use for parralel computations. The default is 1 (not parallel) + loglevel: str + Level of warning for the climada logger during the computation. + The default is "ERROR". cost_benefit_kwargs : keyword arguments Keyword arguments passed on to climada.engine.CostBenefit.calc() @@ -170,7 +173,9 @@ def uncertainty(self, unc_data, processes=1, **cost_benefit_kwargs): See Also -------- climada.engine.cost_benefit: - Compute risk and adptation option cost benefits. + compute risk and adptation option cost benefits. + climada.util.log_level: + set log level """ @@ -205,7 +210,7 @@ def uncertainty(self, unc_data, processes=1, **cost_benefit_kwargs): self.est_comp_time(unc_data.n_samples, elapsed_time, processes) #Compute impact distributions - with log_level(level='ERROR', name_prefix='climada'): + with log_level(level=loglevel, name_prefix='climada'): p_iterator = self._sample_parallel_iterator( samples_df.iterrows(), ent_input_var=self.ent_input_var, @@ -227,7 +232,7 @@ def uncertainty(self, unc_data, processes=1, **cost_benefit_kwargs): ) #Perform the actual computation - with log_level(level='ERROR', name_prefix='climada'): + with log_level(level=loglevel, name_prefix='climada'): [imp_meas_present, imp_meas_future, tot_climate_risk, diff --git a/climada/engine/unsequa/calc_impact.py b/climada/engine/unsequa/calc_impact.py index 2fe8b5157..ce364b9de 100644 --- a/climada/engine/unsequa/calc_impact.py +++ b/climada/engine/unsequa/calc_impact.py @@ -122,7 +122,8 @@ def uncertainty(self, rp=None, calc_eai_exp=False, calc_at_event=False, - processes=1 + processes=1, + loglevel='ERROR' ): """ Computes the impact for each sample in unc_data.sample_df. @@ -160,6 +161,9 @@ def uncertainty(self, processes : int, optional Number of CPUs to use for parralel computations. The default is 1 (not parallel) + loglevel: str + Level of warning for the climada logger during the computation. + The default is "ERROR". Returns ------- @@ -175,7 +179,10 @@ def uncertainty(self, See Also -------- - climada.engine.impact: Compute risk. + climada.engine.impact: + compute impact and risk. + climada.util.log_level: + set log level """ @@ -212,7 +219,7 @@ def uncertainty(self, self.est_comp_time(unc_sample.n_samples, elapsed_time, processes) #Compute impact distributions - with log_level(level='ERROR', name_prefix='climada'): + with log_level(level=loglevel, name_prefix='climada'): p_iterator = self._sample_parallel_iterator( samples_df.iterrows(), exp_input_var=self.exp_input_var, @@ -235,7 +242,7 @@ def uncertainty(self, ) #Perform the actual computation - with log_level(level='ERROR', name_prefix='climada'): + with log_level(level=loglevel, name_prefix='climada'): [aai_agg_list, freq_curve_list, eai_exp_list, at_event_list] = list(zip(*imp_metrics))