Skip to content

Commit

Permalink
Fixed isort checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobwes committed Sep 24, 2023
1 parent a48f658 commit 2b5815b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions ibicus/debias/_isimip.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def _step6_adjust_values_between_thresholds(
cm_future_sorted_entries_between_thresholds.size == 1
or obs_future_sorted_entries_between_thresholds.size <= 1
):
logger.warning(
logger.info(
"ISIMIP step 6: There are too few values between thresholds in cm_future or the pseudo-future observations for a parametric CDF fit. Instead using nonparametric quantile mapping, between the values in cm_future and the pseudo future observations to calculate the values between threshold."
)

Expand Down Expand Up @@ -886,7 +886,7 @@ def _step6_adjust_values_between_thresholds(

except Exception as e:
# If cdf-fits fail quantile map parametrically instead
logger.warning(
logger.info(
"ISIMIP step 6: Parametric CDF fit to the cm_future values between thresholds or the pseudo future observations between thresholds failed. This might be due to too few datapoints in each category or numerical optimization issues. Applying nonparametric quantile mapping instead. Error: %s"
% e
)
Expand Down Expand Up @@ -1264,8 +1264,9 @@ def step6(self, obs_hist, obs_future, cm_hist, cm_future):
self._get_values_between_thresholds(cm_future_sorted),
)
else:
warnings.warn(
"""ISIMIP step6: no pseudo-future observations between thresholds to quantile map to. Leaving %s values unadjusted."""
logger = get_library_logger()
logger.warning(
"""ISIMIP step 6: no pseudo-future observations between thresholds to quantile map to. Leaving %s values unadjusted."""
% mask_for_entries_not_set_to_either_bound.sum(),
stacklevel=2,
)
Expand Down
7 changes: 3 additions & 4 deletions ibicus/debias/_scaled_distribution_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

import warnings
from typing import Union

import attrs
Expand All @@ -16,6 +15,7 @@

from ..utils import (
StatisticalModel,
get_library_logger,
interp_sorted_cdf_vals_on_given_length,
threshold_cdf_vals,
)
Expand Down Expand Up @@ -190,7 +190,6 @@ def for_precipitation(cls, pr_lower_threshold=0.1 / 86400, **kwargs):
return cls.from_variable("pr", pr_lower_threshold=pr_lower_threshold, **kwargs)

def apply_location_relative_sdm(self, obs, cm_hist, cm_future):

# Preparation: sort arrays
obs = np.sort(obs)
cm_hist = np.sort(cm_hist)
Expand Down Expand Up @@ -231,7 +230,8 @@ def apply_location_relative_sdm(self, obs, cm_hist, cm_future):
)

if expected_nr_rainy_days_cm_future > mask_rainy_days_cm_future.sum():
warnings.warn(
logger = get_library_logger()
logger.warning(
"""The relative ScaledDistributionMapping does not currently support adjusting the number of rainy days upwards: so to transform dry days into rainy ones in cm_future.
The number of dry and rainy days is left unadjusted.""",
stacklevel=2,
Expand Down Expand Up @@ -320,7 +320,6 @@ def apply_location_relative_sdm(self, obs, cm_hist, cm_future):
return cm_future[reverse_sorting_idx]

def apply_location_absolute_sdm(self, obs, cm_hist, cm_future):

# Step 1
obs_detrended = detrend(obs, type="constant")
cm_hist_detrended = detrend(cm_hist, type="constant")
Expand Down

0 comments on commit 2b5815b

Please sign in to comment.