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
Changes from 16 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: 4 additions & 4 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -15,10 +15,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine check-manifest
python -m pip install build twine check-manifest
- name: Build tarball and wheels
run: |
python setup.py sdist bdist_wheel
python -m build
python -m pip wheel . -w dist --no-deps
- name: Test the artifacts
run: |
@@ -39,10 +39,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine check-manifest
python -m pip install build twine check-manifest
- name: Build tarball and wheels
run: |
python setup.py sdist bdist_wheel
python -m build
python -m pip wheel . -w dist --no-deps
- name: Test the artifacts
run: |
10 changes: 5 additions & 5 deletions docs/contrib.rst
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@ in working on an issue, please comment on the issue to let us know you are
working on it. This will help us avoid duplicate work.

The code for ``geocat-comp`` is hosted on GitHub. If you do not have one, you
will need to create a `free GitHub account <https://github.com/signup/free>`__.
will need to create a `free GitHub account <https://github.com/signup>`__.
The `GitHub Quickstart Guide
<https://docs.github.com/en/get-started/quickstart>`__ is a great place to get
<https://docs.github.com/en/get-started/start-your-journey>`__ is a great place to get
started with git and GitHub.

**************
@@ -63,7 +63,7 @@ you used to do in NCL? See our `feature request template
to get started.

You can also use our `Feature Request Form
<https://forms.gle/6DTo3ELLri4DAGfG8>`__ to submit a feature request.
<https://docs.google.com/forms/d/e/1FAIpQLSeWuogl8Z671et3DdrmglenBPKGFmHVHkpSamTQeoPGuytLZw/viewform>`__ to submit a feature request.


***********************
@@ -130,7 +130,7 @@ repository.
cd geocat-comp git remote add upstream https://github.com/NCAR/geocat-comp.git

For more information, see the `GitHub quickstart section on forking a repository
<https://docs.github.com/en/get-started/quickstart/fork-a-repo>`__.
<https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo>`__.

Create a development environment
--------------------------------
@@ -301,7 +301,7 @@ need to modify to incorporate your code into the package. These include:
Write and run tests
-------------------

``geocat-comp`` uses `pytest <https://pytest.org/>`__ for unit tests, so we
``geocat-comp`` uses `pytest <https://docs.pytest.org/en/8.0.x/>`__ for unit tests, so we
encourage you to write new tests using ``pytest`` as well.

To run the tests locally, use the following command from the root of the
2 changes: 1 addition & 1 deletion docs/examples/calendar_average.ipynb
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
"\n",
"We will get the data from the [geocat-datafiles](https://github.com/NCAR/geocat-datafiles) package. This package contains example data used in many of the examples for geocat packages.\n",
"\n",
"Then, we use xarray's [open_dataset](http://xarray.pydata.org/en/stable/generated/xarray.open_dataset.html) function to read the data into an xarray dataset, choose a single model from the ensemble run, and extract its surface temperature data into `temp`"
"Then, we use xarray's [open_dataset](https://docs.xarray.dev/en/stable/generated/xarray.open_dataset.html) function to read the data into an xarray dataset, choose a single model from the ensemble run, and extract its surface temperature data into `temp`"
]
},
{
4 changes: 2 additions & 2 deletions docs/getting_started/overview.rst
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ a plethora of scientific analysis packages designed for general use or for niche
for learning Python basics and for data analysis workflows. Python also enables scalability through parallel computation
which was never possible with NCL, enabling geoscientists to tackle analysis workflows on large volumes of data.

GeoCAT-comp draws from well-established analysis packages like `NumPy <https://numpy.org/>`__, `Xarray <https://docs.xarray.dev/>`__,
GeoCAT-comp draws from well-established analysis packages like `NumPy <https://numpy.org/>`__, `Xarray <https://docs.xarray.dev/en/stable/>`__,
`SciPy <https://scipy.org/>`__, and `MetPy <https://unidata.github.io/MetPy/>`__ to recreate and expand upon NCL
functions in pure Python. With so many tools being used under the hood, GeoCAT-comp users have access to geoscience
specific computational tools without needing extensive working knowledge of `Pangeo <https://pangeo.io/>`__ stack.
@@ -42,4 +42,4 @@ GeoCAT-f2py
While our goal is to recreate NCL functions in pure Python, translating some NCL routines is challenging and time
consuming. To ensure GeoCAT users have access to those functions while we work on full Python versions, the Fortran code
they are based upon is wrapped in Python in the GeoCAT-f2py package. Information about
GeoCAT-f2py can be found on the `package's homepage <https://geocat-f2py.readthedocs.io/>`__.
GeoCAT-f2py can be found on the `package's homepage <https://geocat-f2py.readthedocs.io/en/latest/>`__.
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ Installing GeoCAT-comp via Conda in a New Environment
-----------------------------------------------------

The easiest way to install GeoCAT-comp is using
`Conda <http://conda.pydata.org/docs/>`__::
`Conda <https://docs.conda.io/projects/conda/en/latest/>`__::

conda create -n geocat -c conda-forge geocat-comp

12 changes: 10 additions & 2 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
@@ -5,6 +5,14 @@
Release Notes
=============

v2024.04.0 (Unreleased)
-----------------------
Upcoming release

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``.
@@ -138,7 +146,7 @@ Contributor's Guide to the documentation.
New Features
^^^^^^^^^^^^
* User-defined seasonal boundaries, ``custom_seasons``, enabled for
``climatology_average`` by `Julia Kent`_ in (:pr:`441`)
``climatology_average`` by `Julia Kent`_ in (:pr:`411`)

Bug Fixes
^^^^^^^^^
@@ -183,7 +191,7 @@ Breaking Changes

Bug Fixes
^^^^^^^^^
* Fix bug in ``_temp_extrapolate`` used by ``interp_hybrid_to_pressure`` by `Katelyn FitzGerald`_ in (:pr:`422`)
* Fix bug in ``_temp_extrapolate`` used by ``interp_hybrid_to_pressure`` by `Katelyn FitzGerald`_ in (:pr:`424`)


v2023.05.0 (4 May 2023)
2 changes: 1 addition & 1 deletion docs/user_api/index.rst
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ Gradient
gradient

Interpolation
^^^^^^^^^^^^
^^^^^^^^^^^^^
.. currentmodule:: geocat.comp.interpolation
.. autosummary::
:nosignatures:
2 changes: 1 addition & 1 deletion geocat/comp/climatologies.py
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ def _calculate_center_of_time_bounds(

Notes
-----
See `xarray.cftime_range <http://xarray.pydata.org/en/stable/generated/xarray.cftime_range.html>`__ for accepted values for `freq` and `calendar`.
See `xarray.cftime_range <https://docs.xarray.dev/en/stable/generated/xarray.cftime_range.html>`__ for accepted values for `freq` and `calendar`.
"""

time_bounds = xr.cftime_range(start, end, freq=freq, calendar=calendar)
4 changes: 2 additions & 2 deletions geocat/comp/interpolation.py
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ def _vertical_remap(func_interpolate, new_levels, xcoords, data, interp_axis=0):
def _temp_extrapolate(data, lev_dim, lev, p_sfc, ps, phi_sfc):
r"""This helper function extrapolates temperature below ground using the
ECMWF formulation described in `Vertical Interpolation and Truncation of
Model-Coordinate Data <http://dx.doi.org/10.5065/D6HX19NH>`__ by Trenberth,
Model-Coordinate Data <https://opensky.ucar.edu/islandora/object/technotes:168>`__ by Trenberth,
Berry, & Buja [NCAR/TN-396, 1993]. Specifically equation 16 is used:

.. math::
@@ -191,7 +191,7 @@ def _temp_extrapolate(data, lev_dim, lev, p_sfc, ps, phi_sfc):
def _geo_height_extrapolate(t_bot, lev, p_sfc, ps, phi_sfc):
r"""This helper function extrapolates geopotential height below ground using
the ECMWF formulation described in `Vertical Interpolation and Truncation
of Model-Coordinate Data <http://dx.doi.org/10.5065/D6HX19NH>`__ by
of Model-Coordinate Data <https://opensky.ucar.edu/islandora/object/technotes:168>`__ by
Trenberth, Berry, & Buja [NCAR/TN-396, 1993]. Specifically equation 15 is
used:

1 change: 1 addition & 0 deletions test/test_dask.py
Original file line number Diff line number Diff line change
@@ -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")
def test_heat_index_dask(self):

ncl_gt_1 = [
6 changes: 6 additions & 0 deletions test/test_meteorology.py
Original file line number Diff line number Diff line change
@@ -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),
@@ -110,6 +113,9 @@ def test_list_input(self) -> None:
self.ncl_gt_1,
atol=0.005)

@pytest.mark.filterwarnings(
"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)