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

Reduce DeprecationWarnings in Testing #582

Merged
merged 23 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
55db30c
set data.chunks inputs to include dims
cyschneck Mar 22, 2024
619b888
filter invalid sqrt warning
cyschneck Mar 25, 2024
c7f76e2
Merge branch 'NCAR:main' into deprecation_477
cyschneck Mar 25, 2024
21a842c
update release-notes.rst
cyschneck Mar 26, 2024
2d36ce5
Merge branch 'NCAR:main' into deprecation_477
cyschneck Mar 28, 2024
57f5ac8
Merge branch 'NCAR:main' into deprecation_477
cyschneck Mar 29, 2024
50bd77e
update release-notes.rst
cyschneck Mar 29, 2024
8bb8c84
filter out of bounds warning
cyschneck Mar 30, 2024
44b7e94
Merge branch 'NCAR:main' into deprecation_477
cyschneck Apr 2, 2024
cf42ec0
revert interpolation to data.chunk
cyschneck Apr 3, 2024
f18214c
remove interpolation filter warning
cyschneck Apr 4, 2024
db18810
Merge branch 'NCAR:main' into deprecation_477
cyschneck Apr 9, 2024
f8165dd
remove directly invoking setup.py
cyschneck Apr 9, 2024
ccd10d9
Update docs/release-notes.rst
cyschneck Apr 9, 2024
fc0dc5a
update redirect links, fix PR links
cyschneck Apr 10, 2024
4f7a45a
Merge branch 'deprecation_477' of https://github.com/cyschneck/geocat…
cyschneck Apr 10, 2024
3fc4aaa
Update docs/contrib.rst
cyschneck Apr 16, 2024
244c594
Merge branch 'NCAR:main' into deprecation_477
cyschneck Apr 16, 2024
00c9903
ignore redirects from doi
cyschneck Apr 16, 2024
a594df9
Merge branch 'deprecation_477' of https://github.com/cyschneck/geocat…
cyschneck Apr 16, 2024
3cb90e0
ignore redirects for google forms, update docs for stable URL
cyschneck Apr 16, 2024
b75a39f
github.com issues redirect regex
cyschneck Apr 16, 2024
bffe381
remove filter warnings with heat_index negative sqrt
cyschneck Apr 16, 2024
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
8 changes: 8 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
Release Notes
=============

v2024.03.0 (Unreleased)
---------------------------
Upcoming release
cyschneck marked this conversation as resolved.
Show resolved Hide resolved

Internal Changes
^^^^^^^^^^^^^^^^
* Reduce DeprecationWarnings in testing by `Cora Schneck`_ in (:pr:`582`)

v2024.03.0 (March 29, 2024)
---------------------------
This release includes a bug fix for ``delta_pressure``.
Expand Down
15 changes: 7 additions & 8 deletions geocat/comp/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,18 +459,17 @@ def interp_hybrid_to_pressure(data: xr.DataArray,
# }},
# )

# If an unchunked Xarray input is given, chunk it just with its dims
if data.chunks is None:
cyschneck marked this conversation as resolved.
Show resolved Hide resolved
data_chunk = dict([
(k, v) for (k, v) in zip(list(data.dims), list(data.shape))
])
data = data.chunk(data_chunk)
# set chunked Xarray input to chunk with dims
data_chunk = dict([
(k, v) for (k, v) in zip(list(data.dims), list(data.shape))
])
data = data.chunk(data_chunk)

# Chunk pressure equal to data's chunks
pressure = pressure.chunk(data.chunks)
pressure = pressure.chunk(data_chunk)

# Output data structure elements
out_chunks = list(data.chunks)
out_chunks = list(zip((data_chunk.values())))
out_chunks[interp_axis] = (new_levels.size,)
out_chunks = tuple(out_chunks)
# ''' end of boilerplate
Expand Down
1 change: 1 addition & 0 deletions test/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_dewtemp_dask(self):
assert isinstance((out - 273.15).data, dask.array.Array)
assert np.allclose(out - 273.15, dt_2, atol=0.1)

@pytest.mark.filterwarnings("ignore:invalid value encountered in sqrt")
cyschneck marked this conversation as resolved.
Show resolved Hide resolved
def test_heat_index_dask(self):

ncl_gt_1 = [
Expand Down
2 changes: 2 additions & 0 deletions test/test_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def test_interp_hybrid_to_pressure_extrap_temp(self, temp_in, press_in,
temp_extrap_expected = ds_out.Tpx.rename(lev_p='plev')
xr.testing.assert_allclose(temp_extrap_expected, result)

@pytest.mark.filterwarnings(
cyschneck marked this conversation as resolved.
Show resolved Hide resolved
"ignore: Interpolation point out of data bounds encountered")
def test_interp_hybrid_to_pressure_extrap_geopotential(
self, geopotential_in, press_in, _hyam, _hybm, t_bot, phis,
ds_out) -> None:
Expand Down
6 changes: 6 additions & 0 deletions test/test_meteorology.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def test_alt_coef(self) -> None:
self.ncl_gt_2,
atol=0.005)

@pytest.mark.filterwarnings(
"ignore:invalid value encountered in sqrt"
) # ignores RuntimeWarning sqrt is negative, np.sqrt produces nan
def test_xarray_alt_coef(self) -> None:
assert np.allclose(heat_index(xr.DataArray(self.t2),
xr.DataArray(self.rh2), True),
Expand All @@ -110,6 +113,9 @@ def test_list_input(self) -> None:
self.ncl_gt_1,
atol=0.005)

@pytest.mark.filterwarnings(
cyschneck marked this conversation as resolved.
Show resolved Hide resolved
"ignore:invalid value encountered in sqrt"
) # ignores RuntimeWarning sqrt is negative, np.sqrt produces nan
def test_xarray_input(self) -> None:
t = xr.DataArray(self.t1)
rh = xr.DataArray(self.rh1)
Expand Down
Loading