Skip to content

Commit

Permalink
Prepare v0.16.1 (numpy<2) release (#309)
Browse files Browse the repository at this point in the history
* Fix and filter warnings, remove old plotting module

* Update CI build
  • Loading branch information
wpreimes authored Nov 12, 2024
1 parent ff31706 commit ad981a2
Show file tree
Hide file tree
Showing 20 changed files with 342 additions and 448 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:
- name: Export Environment
shell: bash -l {0}
run: |
mkdir -p .artifacts
mkdir -p artifacts
filename=env_py${{ matrix.python-version }}_${{ matrix.os }}.yml
conda env export --no-builds | grep -v "prefix" > .artifacts/$filename
conda env export --no-builds | grep -v "prefix" > artifacts/$filename
- name: Install package and test
shell: bash -l {0}
run: |
Expand All @@ -71,22 +71,23 @@ jobs:
shell: bash -l {0}
run: |
git status
pip install setuptools_scm
pip install setuptools_scm twine
if [ ${{ matrix.os }} == "windows-latest" ]
then
# build whls on windows
pip install wheel
python setup.py bdist_wheel --dist-dir .artifacts/dist
python setup.py bdist_wheel --dist-dir artifacts/dist
else
# build dist on linux
python setup.py sdist --dist-dir .artifacts/dist
python setup.py sdist --dist-dir artifacts/dist
fi
ls .artifacts/dist
ls artifacts/dist
twine check artifacts/dist/*
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts-${{ matrix.python-version }}-${{ matrix.os }}
path: .artifacts/*
path: artifacts/*
coveralls:
name: Submit Coveralls 👚
needs: build
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog

Unreleased changes in master
============================

Version 0.16.1, 2024-11-13
==========================
- THIS VERSION IS STILL COMPATIBLE WITH ``NUMPY<2.0``, from v0.17 on pytesmo will require ``numpy>=2.0``
- Old ``pytesmo.timeseries.plotting`` module was removed
- Fixed and filtered many warnings that were printed by tests until now
- Fixed an issue with the intra-annual metrics adapter when an empty time series is passed (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
- Metapackage updated (pyscaffold 4.5) (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
- C modules were outdated and could not be compiled, therefore rebuilt (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- numpy<2.0.0
- numba
- scipy>=0.12
- pandas>=0.11.0,!=0.15.2
- pandas>=0.23.0
- netcdf4>=1.0.1,!=1.6.2
- cython>=0.29.21
- scikit-learn
Expand All @@ -34,7 +34,7 @@ dependencies:
- ipykernel
- sphinx_rtd_theme
- ascat>=2.0
- ismn==1.3.4
- ismn==1.5.1
- pytest
- pytest-cov
- pytest-mpl
Expand Down
10 changes: 9 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install_requires =
importlib-metadata; python_version<"3.8"
numpy>=1.7.0,<2.0.0
scipy>=0.12
pandas>=0.11.0,!=0.15.2
pandas>=0.23.0
matplotlib>=1.2.0
netCDF4>=1.0.1,!=1.6.2
pygeogrids
Expand Down Expand Up @@ -103,6 +103,7 @@ norecursedirs =
markers =
full_framework : marks slow test that use the whole validation framework (deselect with '-m "not full_framework"')
slow : marks slow tests (deselect with '-m "not slow"')
doc_example : marks slow tests that test python code from documentation
testpaths = tests
# This removes some of the warnings that show up with pytest but are not an issue
filterwarnings =
Expand All @@ -122,6 +123,13 @@ filterwarnings =
ignore:`np.bool` is a deprecated alias for the builtin `bool`
# this comes from the `test_cci` in `test_data_averager`
ignore: IOError in reading ISMN data
# old CDF matching method
ignore:Use the new implementation 'cdf_match' instead.:DeprecationWarning
# ascat package prints some warnings, doesn't matter for pytesmo
ignore::UserWarning:^ascat
# ismn package used deprecated version of this, doesn't matter for pytesmo
ignore:The 'parallel_process_async' method was renamed to `parallel_process`.:DeprecationWarning


[aliases]
dists = bdist_wheel
Expand Down
8 changes: 7 additions & 1 deletion src/pytesmo/time_series/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def filter(self, idx: pd.DatetimeIndex):
# selection = dat.query(" | ".join(cond)).index

if self.yearless_date_ranges is not None:
cols = {}

for i, gdrange in enumerate(self.yearless_date_ranges):
for y in np.unique(idx.year):
start = gdrange[0]
Expand All @@ -385,7 +387,11 @@ def filter(self, idx: pd.DatetimeIndex):

end_dt = end.to_datetime(years=y)

mask[f"gen_range{y}-{i}"] = (idx >= start_dt) & (
cols[f"gen_range{y}-{i}"] = (idx >= start_dt) & (
idx <= end_dt)

mask = pd.concat(
[mask, pd.DataFrame(index=mask.index, data=cols)],
axis=1)

return mask.any(axis=1, bool_only=True)
160 changes: 0 additions & 160 deletions src/pytesmo/time_series/plotting.py

This file was deleted.

6 changes: 2 additions & 4 deletions src/pytesmo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def rootdir() -> Path:

def deprecated(message: str = None):
"""
Decorator for classes or functions to mark them as deprecated.
Decorator for class methods or functions to mark them as deprecated.
If the decorator is applied without a specific message (`@deprecated()`),
the default warning is shown when using the function/class. To specify
a custom message use it like:
Expand All @@ -67,13 +67,11 @@ def decorator(src):

@functools.wraps(src)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)

warnings.warn(
default_msg if message is None else message,
category=DeprecationWarning,
stacklevel=2)
warnings.simplefilter('default', DeprecationWarning)

return src(*args, **kwargs)

return new_func
Expand Down
4 changes: 2 additions & 2 deletions src/pytesmo/validation_framework/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,9 @@ def _adapt(self, data: DataFrame) -> DataFrame:

if self.drop_original:
if self.time_offset_fields is not None:
data.drop(columns=self.time_offset_fields, inplace=True)
data = data.drop(columns=self.time_offset_fields)
if self.base_time_field in data.columns:
data.drop(columns=[self.base_time_field], inplace=True)
data = data.drop(columns=[self.base_time_field])

# Remove NaNs from index, if present
data = data.loc[data.index.dropna()]
Expand Down
Loading

0 comments on commit ad981a2

Please sign in to comment.