Skip to content

Commit

Permalink
Merge pull request #126 from pysat/tst/ga_update
Browse files Browse the repository at this point in the history
MAINT/BUG: GA updates, pandas 2.0+ compatibility
  • Loading branch information
jklenzing authored May 19, 2023
2 parents cf4f0ca + 919c71e commit 25f4a36
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 14 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pip_rc_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies and the latest RC of pysatNASA from test pypi.
# This test should be manually run before a pysatModels RC is officially approved and versioned.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test install of latest RC from pip

on: [workflow_dispatch]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"] # Keep this version at the highest supported Python version

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install standard dependencies
run: pip install -r requirements.txt

- name: Install pysatModels RC
run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysatModels

- name: Set up pysat
run: |
mkdir pysatData
python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'"
- name: Check that install imports correctly
run: |
cd ..
python -c "import pysatModels; print(pysatModels.__version__)"
4 changes: 2 additions & 2 deletions .github/workflows/pysat_rc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies (including the latest RC
# This workflow will install Python dependencies (including the latest RC
# for pysat packages) and run tests for supported operating systems.
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
python-version: ${{ matrix.python-version }}

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

- name: Install standard dependencies
run: |
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* Switched pydineof_dineof load code to use newer `pysat.utils.io.load_netcdf`
* Updated NEP29 and GitHub actions versions
* Added manual test for pysat and pysatNASA Release Candidates
* Added manual test for pysatModels RC pip install
* Updated tests to new pysat and pytest standards
* Documentation
* Added badges and instructions for PyPi and Zenodo

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ the Space Physics community. This module officially supports Python 3.6+.
| Common modules | Community modules |
| ------------------ | ----------------- |
| numpy | pyForecastTools |
| pandas | pysat >= 3.0.4 |
| pandas >= 1.4.0 | pysat >= 3.0.4 |
| requests | pysatNASA |
| scipy | |
| xarray | |
Expand Down
2 changes: 1 addition & 1 deletion pysatModels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_multidayload(self):
assert meta_two_days == meta_one_days

# Confirm time index information
assert data_two_days.indexes['time'].is_monotonic
assert data_two_days.indexes['time'].is_monotonic_increasing
assert data_two_days.indexes['time'][0] >= test_date
assert data_two_days.indexes['time'][0] < date
assert data_two_days.indexes['time'][-1] > date
Expand Down
4 changes: 2 additions & 2 deletions pysatModels/tests/test_utils_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class TestUtilsCompare(object):
"""Unit tests for utils.compare."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

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

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.dat_key, self.mod_key, self.units, self.pairs, self.input_args
Expand Down
9 changes: 5 additions & 4 deletions pysatModels/tests/test_utils_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
class TestUtilsMatchCollectInstModPairs(object):
"""Unit tests for utils.match.collect_inst_model_pairs."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing')
self.inst = pysat.Instrument(platform='pysat', name='testing',
use_header=True)
self.stime = pysat.instruments.pysat_testing._test_dates['']['']
self.inst.load(date=self.stime)
self.input_args = [self.stime, self.stime + dt.timedelta(days=1),
dt.timedelta(days=1), self.inst]
self.ref_col = 'dummy1'
self.model = pysat.Instrument(platform='pysat', name='testmodel',
tag='', num_samples=10)
tag='', num_samples=10, use_header=True)
self.required_kwargs = {"model_load_kwargs":
{"model_inst": self.model},
"inst_clean_rout": lambda x: True,
Expand All @@ -37,7 +38,7 @@ def setup(self):
self.out = None
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.input_args, self.required_kwargs, self.inst, self.model
Expand Down
2 changes: 1 addition & 1 deletion pysatModels/utils/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def collect_inst_model_pairs(start, stop, tinc, inst, inst_download_kwargs=None,
if not skip_download and (stop
- start).days != len(inst.files[start:stop]):
missing_times = [tt for tt in pds.date_range(start, stop, freq='1D',
closed='left')
inclusive='left')
if tt not in inst.files[start:stop].index]
for tt in missing_times:
inst.download(start=tt, stop=tt + pds.DateOffset(days=1),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy
packaging
pandas
pandas >= 1.4.0
pyForecastTools
pysat >= 3.0.4
pysatNASA
Expand Down
4 changes: 2 additions & 2 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
coveralls
flake8
flake8-docstrings
hacking>=1.0
hacking>=1.0,<6.0
m2r2
numpydoc
pytest-cov
pytest-ordering
sphinx
sphinx<7.0
sphinx_rtd_theme

0 comments on commit 25f4a36

Please sign in to comment.