Skip to content

Commit 25f4a36

Browse files
authored
Merge pull request #126 from pysat/tst/ga_update
MAINT/BUG: GA updates, pandas 2.0+ compatibility
2 parents cf4f0ca + 919c71e commit 25f4a36

File tree

10 files changed

+57
-14
lines changed

10 files changed

+57
-14
lines changed

.github/workflows/pip_rc_install.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies and the latest RC of pysatNASA from test pypi.
2+
# This test should be manually run before a pysatModels RC is officially approved and versioned.
3+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
4+
5+
name: Test install of latest RC from pip
6+
7+
on: [workflow_dispatch]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
15+
python-version: ["3.8", "3.9", "3.10"] # Keep this version at the highest supported Python version
16+
17+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install standard dependencies
27+
run: pip install -r requirements.txt
28+
29+
- name: Install pysatModels RC
30+
run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysatModels
31+
32+
- name: Set up pysat
33+
run: |
34+
mkdir pysatData
35+
python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'"
36+
37+
- name: Check that install imports correctly
38+
run: |
39+
cd ..
40+
python -c "import pysatModels; print(pysatModels.__version__)"

.github/workflows/pysat_rc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will install Python dependencies (including the latest RC
1+
# This workflow will install Python dependencies (including the latest RC
22
# for pysat packages) and run tests for supported operating systems.
33
# For more information see:
44
# https://help.github.com/actions/language-and-framework-guides/
@@ -27,7 +27,7 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828

2929
- name: Install RC package
30-
run: pip install --no-deps -i https://test.pypi.org/simple/ ${{ matrix.rc-package }}
30+
run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${{ matrix.rc-package }}
3131

3232
- name: Install standard dependencies
3333
run: |

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1010
* Switched pydineof_dineof load code to use newer `pysat.utils.io.load_netcdf`
1111
* Updated NEP29 and GitHub actions versions
1212
* Added manual test for pysat and pysatNASA Release Candidates
13+
* Added manual test for pysatModels RC pip install
14+
* Updated tests to new pysat and pytest standards
1315
* Documentation
1416
* Added badges and instructions for PyPi and Zenodo
1517

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ the Space Physics community. This module officially supports Python 3.6+.
3030
| Common modules | Community modules |
3131
| ------------------ | ----------------- |
3232
| numpy | pyForecastTools |
33-
| pandas | pysat >= 3.0.4 |
33+
| pandas >= 1.4.0 | pysat >= 3.0.4 |
3434
| requests | pysatNASA |
3535
| scipy | |
3636
| xarray | |

pysatModels/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_multidayload(self):
235235
assert meta_two_days == meta_one_days
236236

237237
# Confirm time index information
238-
assert data_two_days.indexes['time'].is_monotonic
238+
assert data_two_days.indexes['time'].is_monotonic_increasing
239239
assert data_two_days.indexes['time'][0] >= test_date
240240
assert data_two_days.indexes['time'][0] < date
241241
assert data_two_days.indexes['time'][-1] > date

pysatModels/tests/test_utils_compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class TestUtilsCompare(object):
1212
"""Unit tests for utils.compare."""
1313

14-
def setup(self):
14+
def setup_method(self):
1515
"""Set up the unit test environment for each method."""
1616

1717
coords = {"lat": np.arange(-90, 90, 10), "alt": np.arange(200, 800, 10)}
@@ -29,7 +29,7 @@ def setup(self):
2929
self.out_units = dict()
3030
return
3131

32-
def teardown(self):
32+
def teardown_method(self):
3333
"""Clean up the unit test environment after each method."""
3434

3535
del self.dat_key, self.mod_key, self.units, self.pairs, self.input_args

pysatModels/tests/test_utils_match.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
class TestUtilsMatchCollectInstModPairs(object):
1414
"""Unit tests for utils.match.collect_inst_model_pairs."""
1515

16-
def setup(self):
16+
def setup_method(self):
1717
"""Set up the unit test environment for each method."""
1818

19-
self.inst = pysat.Instrument(platform='pysat', name='testing')
19+
self.inst = pysat.Instrument(platform='pysat', name='testing',
20+
use_header=True)
2021
self.stime = pysat.instruments.pysat_testing._test_dates['']['']
2122
self.inst.load(date=self.stime)
2223
self.input_args = [self.stime, self.stime + dt.timedelta(days=1),
2324
dt.timedelta(days=1), self.inst]
2425
self.ref_col = 'dummy1'
2526
self.model = pysat.Instrument(platform='pysat', name='testmodel',
26-
tag='', num_samples=10)
27+
tag='', num_samples=10, use_header=True)
2728
self.required_kwargs = {"model_load_kwargs":
2829
{"model_inst": self.model},
2930
"inst_clean_rout": lambda x: True,
@@ -37,7 +38,7 @@ def setup(self):
3738
self.out = None
3839
return
3940

40-
def teardown(self):
41+
def teardown_method(self):
4142
"""Clean up the unit test environment after each method."""
4243

4344
del self.input_args, self.required_kwargs, self.inst, self.model

pysatModels/utils/match.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def collect_inst_model_pairs(start, stop, tinc, inst, inst_download_kwargs=None,
163163
if not skip_download and (stop
164164
- start).days != len(inst.files[start:stop]):
165165
missing_times = [tt for tt in pds.date_range(start, stop, freq='1D',
166-
closed='left')
166+
inclusive='left')
167167
if tt not in inst.files[start:stop].index]
168168
for tt in missing_times:
169169
inst.download(start=tt, stop=tt + pds.DateOffset(days=1),

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
numpy
22
packaging
3-
pandas
3+
pandas >= 1.4.0
44
pyForecastTools
55
pysat >= 3.0.4
66
pysatNASA

test_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
coveralls
22
flake8
33
flake8-docstrings
4-
hacking>=1.0
4+
hacking>=1.0,<6.0
55
m2r2
66
numpydoc
77
pytest-cov
88
pytest-ordering
9-
sphinx
9+
sphinx<7.0
1010
sphinx_rtd_theme

0 commit comments

Comments
 (0)