Skip to content

Commit ad981a2

Browse files
authored
Prepare v0.16.1 (numpy<2) release (#309)
* Fix and filter warnings, remove old plotting module * Update CI build
1 parent ff31706 commit ad981a2

File tree

20 files changed

+342
-448
lines changed

20 files changed

+342
-448
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ jobs:
5151
- name: Export Environment
5252
shell: bash -l {0}
5353
run: |
54-
mkdir -p .artifacts
54+
mkdir -p artifacts
5555
filename=env_py${{ matrix.python-version }}_${{ matrix.os }}.yml
56-
conda env export --no-builds | grep -v "prefix" > .artifacts/$filename
56+
conda env export --no-builds | grep -v "prefix" > artifacts/$filename
5757
- name: Install package and test
5858
shell: bash -l {0}
5959
run: |
@@ -71,22 +71,23 @@ jobs:
7171
shell: bash -l {0}
7272
run: |
7373
git status
74-
pip install setuptools_scm
74+
pip install setuptools_scm twine
7575
if [ ${{ matrix.os }} == "windows-latest" ]
7676
then
7777
# build whls on windows
7878
pip install wheel
79-
python setup.py bdist_wheel --dist-dir .artifacts/dist
79+
python setup.py bdist_wheel --dist-dir artifacts/dist
8080
else
8181
# build dist on linux
82-
python setup.py sdist --dist-dir .artifacts/dist
82+
python setup.py sdist --dist-dir artifacts/dist
8383
fi
84-
ls .artifacts/dist
84+
ls artifacts/dist
85+
twine check artifacts/dist/*
8586
- name: Upload Artifacts
8687
uses: actions/upload-artifact@v4
8788
with:
8889
name: Artifacts-${{ matrix.python-version }}-${{ matrix.os }}
89-
path: .artifacts/*
90+
path: artifacts/*
9091
coveralls:
9192
name: Submit Coveralls 👚
9293
needs: build

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Changelog
44

55
Unreleased changes in master
66
============================
7+
8+
Version 0.16.1, 2024-11-13
9+
==========================
10+
- THIS VERSION IS STILL COMPATIBLE WITH ``NUMPY<2.0``, from v0.17 on pytesmo will require ``numpy>=2.0``
11+
- Old ``pytesmo.timeseries.plotting`` module was removed
12+
- Fixed and filtered many warnings that were printed by tests until now
713
- 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>`_)
814
- Metapackage updated (pyscaffold 4.5) (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
915
- C modules were outdated and could not be compiled, therefore rebuilt (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- numpy<2.0.0
1111
- numba
1212
- scipy>=0.12
13-
- pandas>=0.11.0,!=0.15.2
13+
- pandas>=0.23.0
1414
- netcdf4>=1.0.1,!=1.6.2
1515
- cython>=0.29.21
1616
- scikit-learn
@@ -34,7 +34,7 @@ dependencies:
3434
- ipykernel
3535
- sphinx_rtd_theme
3636
- ascat>=2.0
37-
- ismn==1.3.4
37+
- ismn==1.5.1
3838
- pytest
3939
- pytest-cov
4040
- pytest-mpl

setup.cfg

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ install_requires =
3333
importlib-metadata; python_version<"3.8"
3434
numpy>=1.7.0,<2.0.0
3535
scipy>=0.12
36-
pandas>=0.11.0,!=0.15.2
36+
pandas>=0.23.0
3737
matplotlib>=1.2.0
3838
netCDF4>=1.0.1,!=1.6.2
3939
pygeogrids
@@ -103,6 +103,7 @@ norecursedirs =
103103
markers =
104104
full_framework : marks slow test that use the whole validation framework (deselect with '-m "not full_framework"')
105105
slow : marks slow tests (deselect with '-m "not slow"')
106+
doc_example : marks slow tests that test python code from documentation
106107
testpaths = tests
107108
# This removes some of the warnings that show up with pytest but are not an issue
108109
filterwarnings =
@@ -122,6 +123,13 @@ filterwarnings =
122123
ignore:`np.bool` is a deprecated alias for the builtin `bool`
123124
# this comes from the `test_cci` in `test_data_averager`
124125
ignore: IOError in reading ISMN data
126+
# old CDF matching method
127+
ignore:Use the new implementation 'cdf_match' instead.:DeprecationWarning
128+
# ascat package prints some warnings, doesn't matter for pytesmo
129+
ignore::UserWarning:^ascat
130+
# ismn package used deprecated version of this, doesn't matter for pytesmo
131+
ignore:The 'parallel_process_async' method was renamed to `parallel_process`.:DeprecationWarning
132+
125133

126134
[aliases]
127135
dists = bdist_wheel

src/pytesmo/time_series/grouping.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ def filter(self, idx: pd.DatetimeIndex):
366366
# selection = dat.query(" | ".join(cond)).index
367367

368368
if self.yearless_date_ranges is not None:
369+
cols = {}
370+
369371
for i, gdrange in enumerate(self.yearless_date_ranges):
370372
for y in np.unique(idx.year):
371373
start = gdrange[0]
@@ -385,7 +387,11 @@ def filter(self, idx: pd.DatetimeIndex):
385387

386388
end_dt = end.to_datetime(years=y)
387389

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

393+
mask = pd.concat(
394+
[mask, pd.DataFrame(index=mask.index, data=cols)],
395+
axis=1)
396+
391397
return mask.any(axis=1, bool_only=True)

src/pytesmo/time_series/plotting.py

Lines changed: 0 additions & 160 deletions
This file was deleted.

src/pytesmo/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def rootdir() -> Path:
4747

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

6868
@functools.wraps(src)
6969
def new_func(*args, **kwargs):
70-
warnings.simplefilter('always', DeprecationWarning)
71-
7270
warnings.warn(
7371
default_msg if message is None else message,
7472
category=DeprecationWarning,
7573
stacklevel=2)
76-
warnings.simplefilter('default', DeprecationWarning)
74+
7775
return src(*args, **kwargs)
7876

7977
return new_func

src/pytesmo/validation_framework/adapters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,9 @@ def _adapt(self, data: DataFrame) -> DataFrame:
699699

700700
if self.drop_original:
701701
if self.time_offset_fields is not None:
702-
data.drop(columns=self.time_offset_fields, inplace=True)
702+
data = data.drop(columns=self.time_offset_fields)
703703
if self.base_time_field in data.columns:
704-
data.drop(columns=[self.base_time_field], inplace=True)
704+
data = data.drop(columns=[self.base_time_field])
705705

706706
# Remove NaNs from index, if present
707707
data = data.loc[data.index.dropna()]

0 commit comments

Comments
 (0)