Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #408

Merged
merged 4 commits into from
Oct 29, 2023
Merged

merge #408

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions xskillscore/core/contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
FORECASTS_NAME = "forecasts"


def _get_category_bounds(category_edges: XArray | np.array) -> List[str]:
def _get_category_bounds(category_edges: XArray | np.ndarray) -> List[str]:
"""Return formatted string of category bounds given list of category edges"""
bounds = [
f"[{str(category_edges[i])}, {str(category_edges[i + 1])})"
Expand Down Expand Up @@ -104,8 +104,8 @@ def __init__(
self,
observations: XArray,
forecasts: XArray,
observation_category_edges: xr.DataArray | np.array,
forecast_category_edges: xr.DataArray | np.array,
observation_category_edges: xr.DataArray | np.ndarray,
forecast_category_edges: xr.DataArray | np.ndarray,
dim: Dim,
):
self._observations = observations.copy()
Expand Down
2 changes: 1 addition & 1 deletion xskillscore/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _helper_bool_to_int(da):

def _check_identical_xr_types(a, b):
"""Check that a and b are both xr.Dataset or both xr.DataArray."""
if type(a) != type(b):
if not isinstance(a, type(b)):
raise ValueError(f"a and b must be same type, found {type(a)} and {type(b)}")
for d in [a, b]:
if not isinstance(d, (xr.Dataset, xr.DataArray)):
Expand Down
2 changes: 1 addition & 1 deletion xskillscore/tests/test_probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def assert_keep_attrs(actual, o, keep_attrs):


def assign_type_input_output(actual, o):
assert type(o) == type(actual)
assert isinstance(o, type(actual))


@pytest.mark.parametrize("chunk_bool", [True, False])
Expand Down
2 changes: 1 addition & 1 deletion xskillscore/tests/test_resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_resample_inputs(a_1d, func, input, chunk, replace):
# check dask collection preserved
assert is_dask_collection(actual) if chunk else not is_dask_collection(actual)
# input type preserved
assert type(actual) == type(a_1d)
assert isinstance(a_1d, type(actual))


@pytest.mark.parametrize("func", resample_iterations_funcs)
Expand Down
Loading