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

Clean warning update #129

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 38 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10"]
numpy_ver: [latest]
python-version: ["3.10", "3.11"]
numpy_ver: ["latest"]
test_config: ["latest"]
include:
- python-version: "3.8"
numpy_ver: "1.20.3"
os: "ubuntu-latest"
# NEP29 compliance settings
- python-version: "3.9"
numpy_ver: "1.21"
os: ubuntu-latest
test_config: "NEP29"
# Operational compliance settings
- python-version: "3.6.8"
numpy_ver: "1.19.5"
os: "ubuntu-20.04"
test_config: "Ops"

name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
runs-on: ${{ matrix.os }}
Expand All @@ -29,15 +37,29 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install standard dependencies
- name: Install Operational dependencies
if: ${{ matrix.test_config == 'Ops'}}
run: |
pip install -r test_requirements.txt
pip install numpy==${{ matrix.numpy_ver }}
pip install "cdflib<1.0"
pip install -r requirements.txt
pip install -r test_requirements.txt
aburrell marked this conversation as resolved.
Show resolved Hide resolved
pip install .

- name: Install NEP29 dependencies
if: ${{ matrix.numpy_ver != 'latest'}}
if: ${{ matrix.test_config == 'NEP29'}}
run: |
pip install numpy==${{ matrix.numpy_ver }}
pip install --upgrade-strategy only-if-needed -r requirements.txt
pip install --upgrade-strategy only-if-needed -r test_requirements.txt
pip install .

- name: Install standard dependencies
if: ${{ matrix.test_config == 'latest'}}
run: |
pip install -r test_requirements.txt
pip install -r requirements.txt
pip install .

- name: Set up pysat
run: |
Expand All @@ -50,6 +72,14 @@ jobs:
- name: Evaluate complexity
run: flake8 . --count --exit-zero --max-complexity=10 --statistics

- name: Install Operational dependencies success
if: ${{ matrix.test_config == 'Ops'}}
run: |
pip install pysatNASA==0.0.5
which python
python --version
python -c "import pysatNASA; print(pysatNASA.__version__)"

- name: Run unit and integration tests
run: pytest --cov=pysatModels/

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* 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
* Added a cap for pysatNASA
* Updated model Instruments to include the new `_clean_warn` attribute
* Removed backwards-support for pysat pre-3.0.4 functions
* 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 @@ -31,7 +31,7 @@ the Space Physics community. This module officially supports Python 3.6+.
| ------------------ | ------------------ |
| numpy | pyForecastTools |
| pandas >= 1.4.0 | pysat >= 3.0.4 |
| requests | pysatNASA <= 0.0.4 |
| requests | pysatNASA |
| scipy | |
| xarray | |

Expand Down
4 changes: 4 additions & 0 deletions pysatModels/models/methods/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import pysatModels

clean_warn = {clean_level: [('logger', 'INFO', 'Cleaning not supported',
clean_level)]
for clean_level in ['clean', 'dusty', 'dirty']}


def clean(inst):
"""Raise a low-level log message about lack of cleaning."""
Expand Down
1 change: 1 addition & 0 deletions pysatModels/models/pydineof_dineof.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

_test_dates = {'': {tag: dt.datetime(2009, 1, 1) for tag in tags.keys()}}
_test_download = {'': {'': False, 'test': True}}
_clean_warn = {'': {tag: general.clean_warn for tag in tags.keys()}}

# ----------------------------------------------------------------------------
# Instrument methods
Expand Down
1 change: 1 addition & 0 deletions pysatModels/models/sami2py_sami2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

_test_dates = {'': {tag: dt.datetime(2019, 1, 1) for tag in tags.keys()}}
_test_download = {'': {'': False, 'test': True}}
_clean_warn = {'': {tag: general.clean_warn for tag in tags.keys()}}

# ----------------------------------------------------------------------------
# Instrument methods
Expand Down
3 changes: 2 additions & 1 deletion pysatModels/models/ucar_tiegcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
_test_dates = {'': {'': dt.datetime(2019, 1, 1),
'icon': dt.datetime(2020, 1, 10)}}
_test_download = {'': {'': False, 'icon': True}}
_clean_warn = {'': {tag: general.clean_warn for tag in tags.keys()}}

# ----------------------------------------------------------------------------
# Instrument methods
Expand Down Expand Up @@ -248,7 +249,7 @@ def download(date_array, tag, inst_id, data_path=None, **kwargs):
temp_dir = tempfile.TemporaryDirectory()

# Download using NASA CDAWeb methods in pysatNASA
cdw.download(date_array, tag, inst_id, data_path=temp_dir.name,
cdw.download(date_array, temp_dir.name, tag=tag, inst_id=inst_id,
supported_tags=download_tags)

# Get a list of files in `temp_dir`
Expand Down
9 changes: 7 additions & 2 deletions pysatModels/utils/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,13 @@ def collect_inst_model_pairs(start, stop, tinc, inst, inst_download_kwargs=None,
# Download the instrument data, if needed and wanted
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',
inclusive='left')
try:
missing_date_range = pds.date_range(start, stop, freq='1D',
inclusive='left')
except TypeError:
missing_date_range = pds.date_range(start, stop, freq='1D')

missing_times = [tt for tt in missing_date_range
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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
numpy
packaging
pandas >= 1.4.0
pandas
pyForecastTools
pysat >= 3.0.4
pysatNASA <= 0.0.4
pysatNASA
requests
scipy
xarray
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ classifiers =
License :: Freely Distributable
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Operating System :: MacOS :: MacOS X
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows
license_file = LICENSE

[options]
python_requires = >= 3.5
python_requires = >= 3.6
setup_requires = setuptools >= 38.6; pip >= 10
packages = find:
include_package_data = True
Expand Down
Loading