Skip to content

Commit

Permalink
Formatting corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
brhooper committed May 15, 2023
1 parent 5ef3d87 commit b4e002e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"<=",
),
("percentile", "wind_speed", "0.0", "1.1", ">="),
("realization", "surface_temperature", "0.0", "0.9", "<=")
("realization", "surface_temperature", "0.0", "0.9", "<="),
),
)
def test_enforce_consistent_forecasts(
Expand Down
38 changes: 21 additions & 17 deletions improver_tests/utilities/test_enforce_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from improver.synthetic_data.set_up_test_cubes import (
set_up_percentile_cube,
set_up_probability_cube,
set_up_variable_cube
set_up_variable_cube,
)
from improver.utilities.enforce_consistency import EnforceConsistentForecasts

Expand Down Expand Up @@ -117,17 +117,17 @@ def get_expected(forecast_data, bound_data, comparison_operator):
"forecast_type, additive_amount, multiplicative_amount, reference_value, "
"forecast_value, comparison_operator",
(
("probability", 0, 1, 0.5, 0.4, ">="),
("probability", 0, 1, 0.4, 0.5, "<="),
("probability", 0, 1, 0.4, 0.5, ">="), # no change required
("percentile", 0, 1.1, 50, 40, ">="),
("percentile", 0, 0.9, 40, 50, "<="),
("percentile", 10, 1, 50, 40, ">="),
("percentile", -10, 0.8, 50, 40, ">="), # no change required
("realization", 0, 1.1, 20, 25, "<="),
("realization", 5, 1.2, 20, 15, ">="),
("realization", -5, 0.75, 20, 5, "<="), # no change required
)
("probability", 0, 1, 0.5, 0.4, ">="),
("probability", 0, 1, 0.4, 0.5, "<="),
("probability", 0, 1, 0.4, 0.5, ">="), # no change required
("percentile", 0, 1.1, 50, 40, ">="),
("percentile", 0, 0.9, 40, 50, "<="),
("percentile", 10, 1, 50, 40, ">="),
("percentile", -10, 0.8, 50, 40, ">="), # no change required
("realization", 0, 1.1, 20, 25, "<="),
("realization", 5, 1.2, 20, 15, ">="),
("realization", -5, 0.75, 20, 5, "<="), # no change required
),
)
def test_basic(
forecast_type,
Expand Down Expand Up @@ -185,7 +185,13 @@ def test_basic(
(
("percentile", 10, 50, ">=", 30), # change too big
("percentile", 20, 30, "=", 30), # bad comparison operator
("probability", 0.4, 0.6, ">=", 0.5), # check that additive and multiplicative amounts aren't used
(
"probability",
0.4,
0.6,
">=",
0.5,
), # check that additive and multiplicative amounts aren't used
("realization", 15, 293.15, ">=", 30), # mismatching units
),
)
Expand Down Expand Up @@ -230,10 +236,8 @@ def test_exceptions(
EnforceConsistentForecasts(
additive_amount=additive_amount,
multiplicative_amount=multiplicative_amount,
comparison_operator=comparison_operator
)(
forecast_cube, reference_cube
)
comparison_operator=comparison_operator,
)(forecast_cube, reference_cube)
elif forecast_type == "realization":
reference_cube.units = "K"
with pytest.raises(ValueError, match="The units in the forecast"):
Expand Down

0 comments on commit b4e002e

Please sign in to comment.