Skip to content
Merged
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
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ addopts = "--cov=xcdat --cov-report term --cov-report html:tests_coverage_report
python_files = ["tests.py", "test_*.py"]
# These markers are defined in `xarray.tests` and must be included to avoid warnings when importing from this module.
markers = ["flaky", "network"]
# Ignore warnings related to xgcm Axis deprecation, which will always appear
# until they are removed in a future xgcm release (last release was v0.8.1 in
# Nov 2022).
filterwarnings = [
"ignore:From version 0.8.0 the Axis computation methods will be removed, in favour of using the Grid computation methods instead. i.e. use `Grid.transform` instead of `Axis.transform`:FutureWarning:xgcm.grid",
"ignore:The `xgcm.Axis` class will be deprecated in the future. Please make sure to use the `xgcm.Grid` methods for your work instead.:DeprecationWarning:xgcm.grid",
]

[tool.mypy]
# Docs: https://mypy.readthedocs.io/en/stable/config_file.html
Expand Down
25 changes: 23 additions & 2 deletions tests/test_regrid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import re
import sys
import warnings
from unittest import mock

import numpy as np
Expand All @@ -13,6 +14,26 @@

np.set_printoptions(threshold=sys.maxsize, suppress=True)

# Ignore warnings related to xgcm Axis deprecation, which will always appear
# until they are removed in a future xgcm release (last release was v0.8.1 in
# Nov 2022).
warnings.filterwarnings(
"ignore",
message=(
"From version 0.8.0 the Axis computation methods will be removed, in favour of using the Grid computation methods instead. i.e. use `Grid.transform` instead of `Axis.transform`"
),
category=FutureWarning,
module="xgcm.grid",
)
warnings.filterwarnings(
"ignore",
message=(
"The `xgcm.Axis` class will be deprecated in the future. Please make sure to use the `xgcm.Grid` methods for your work instead."
),
category=DeprecationWarning,
module="xgcm.grid",
)


def gen_uniform_axis(start, stop, step, name, axis):
temp = np.arange(start, stop, step)
Expand Down Expand Up @@ -518,7 +539,7 @@ def test_vertical_placeholder(self):

regridder = regrid2.Regrid2Regridder(ds, output_grid)

with pytest.raises(NotImplementedError, match=""):
with pytest.raises(NotImplementedError):
regridder.vertical("so", ds)

@pytest.mark.filterwarnings("ignore:.*invalid value.*divide.*:RuntimeWarning")
Expand Down Expand Up @@ -881,7 +902,7 @@ def test_vertical_placeholder(self):

regridder = xesmf.XESMFRegridder(ds, self.new_grid, "bilinear")

with pytest.raises(NotImplementedError, match=""):
with pytest.raises(NotImplementedError):
regridder.vertical("ts", ds)

def test_regrid(self):
Expand Down
2 changes: 1 addition & 1 deletion xcdat/bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def get_bounds(
raise KeyError(
f"No bounds data variables were found for the '{axis}' axis. Make sure "
"the dataset has bound data vars and their names match the 'bounds' "
"attributes found on their related time coordinate variables. "
"attributes found on their related coordinate variables. "
"Alternatively, you can add bounds with `ds.bounds.add_missing_bounds()` "
"or `ds.bounds.add_bounds()`."
)
Expand Down
Loading