From 6b7ca54d77f3b857a0330f9dbe9a07f136d7024a Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:03:01 -0500 Subject: [PATCH 01/18] MAINT: update to use pyproject --- pyproject.toml | 74 +++++++++++++++++++++++++++++++++++++++++ pysatModels/__init__.py | 12 ++++--- pysatModels/version.txt | 1 - setup.cfg | 49 +-------------------------- 4 files changed, 82 insertions(+), 54 deletions(-) create mode 100644 pyproject.toml delete mode 100644 pysatModels/version.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9db6e4a3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,74 @@ +[build-system] +requires = ["setuptools >= 38.6", "pip >= 10"] +build-backend = "setuptools.build_meta" + +[project] +name = "pysatModels" +version = "0.1.0" +description = "Supports model analysis and model-data comparisons" +readme = "README.md" +requires-python = ">=3.6" +license = {file = "LICENSE"} +authors = [ + {name = "Pysat Development Team", email = "pysat.developers@gmail.com"}, +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Topic :: Scientific/Engineering :: Physics", + "Intended Audience :: Science/Research", + "License :: Freely Distributable", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "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" +] +dependencies = [ + "numpy", + "packaging", + "pandas", + "pyForecastTools", + "pysat >= 3.0.4", + "pysatNASA", + "requests", + "scipy", + "xarray" +] + +[project.optional-dependencies] +test = [ + "coveralls < 3.3", + "flake8", + "flake8-docstrings", + "hacking >= 1.0", + "pytest-cov", + "pytest-ordering" +] +doc = [ + "extras_require", + "m2r2", + "numpydoc", + "sphinx", + "sphinx_rtd_theme >= 1.2.2, < 2.0.0" +] + +[project.urls] +Documentation = "https://pysatmodels.readthedocs.io/en/latest/" +Source = "https://github.com/pysat/pysatModels" + +[tool.coverage.report] + +[tool.pytest.ini_options] +addopts = "--cov=pysatModels" +markers = [ + "all_inst", + "download", + "no_download", + "load_options", + "first", + "second" +] diff --git a/pysatModels/__init__.py b/pysatModels/__init__.py index dbef61b1..40cb3ba0 100644 --- a/pysatModels/__init__.py +++ b/pysatModels/__init__.py @@ -11,16 +11,18 @@ """ import logging -import os + +try: + from importlib import metadata +except ImportError: + import importlib_metadata as metadata # Import key modules and skip F401 testing in flake8 from pysatModels import models # noqa: F401 from pysatModels import utils # noqa: F401 # Set the version -local_dir = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(local_dir, 'version.txt')) as version_file: - __version__ = version_file.read().strip() +__version__ = metadata.version('pysatModels') # Define a logger object to allow easier log handling logging.raiseExceptions = False @@ -30,4 +32,4 @@ logger.addHandler(handler) # Clean up variables -del handler, local_dir, version_file +del handler diff --git a/pysatModels/version.txt b/pysatModels/version.txt deleted file mode 100644 index 6e8bf73a..00000000 --- a/pysatModels/version.txt +++ /dev/null @@ -1 +0,0 @@ -0.1.0 diff --git a/setup.cfg b/setup.cfg index 98728f11..a83efd4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,45 +1,6 @@ [metadata] name = pysatModels -version = file: pysatModels/version.txt -url = https://github.com/pysat/pysatModels -author = Pysat Development Team -author_email = pysat.developers@gmail.com -description = 'Supports model analysis and model-data comparisons' -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 3 - Alpha - Topic :: Scientific/Engineering :: Physics - Intended Audience :: Science/Research - License :: Freely Distributable - Natural Language :: English - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Operating System :: MacOS :: MacOS X - Operating System :: POSIX :: Linux - Operating System :: Microsoft :: Windows -license_file = LICENSE - -[options] -python_requires = >= 3.5 -setup_requires = setuptools >= 38.6; pip >= 10 -packages = find: -include_package_data = True -zip_safe = False -install_requires = numpy - packaging - pandas - pyForecastTools - pysat - pysatNASA - scipy - xarray - -[coverage:run] - -[coverage:report] +version = 0.1.0 [flake8] max-line-length = 80 @@ -48,11 +9,3 @@ ignore = D202 H105 W503 - -[tool:pytest] -markers = - all_inst: tests all instruments - download: tests for downloadable instruments - no_download: tests for instruments without download support - first: first tests to run - second: second tests to run From 40bb8c919e9b6903b436c33d70d0846bff389251 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:03:11 -0500 Subject: [PATCH 02/18] MAINT: update workflows --- .github/workflows/docs.yml | 5 ++-- .github/workflows/main.yml | 50 ++++++++++++++++++++++++++-------- .github/workflows/pysat_rc.yml | 23 ++++++++++++---- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ee347903..e22cbb33 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] + python-version: ["3.11"] # Keep this version at the highest supported Python version name: Documentation tests steps: @@ -26,8 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r test_requirements.txt - pip install -r requirements.txt + pip install .[doc] - name: Set up pysat run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07e49a05..e513cb7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,13 +12,19 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10"] - numpy_ver: [latest] + os: ["ubuntu-latest", "macos-latest", "windows-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" + - python-version: "3.9" + numpy_ver: "1.21" + os: ubuntu-latest + test_config: "NEP29" + - 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 }} @@ -29,15 +35,24 @@ 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 --no-cache-dir numpy==${{ matrix.numpy_ver }} + pip install "cdflib<1.0" pip install -r requirements.txt + pip install -r test_requirements.txt + 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 .[test] + + - name: Install standard dependencies + if: ${{ matrix.test_config == 'latest'}} + run: pip install .[test] - name: Set up pysat run: | @@ -51,9 +66,22 @@ jobs: run: flake8 . --count --exit-zero --max-complexity=10 --statistics - name: Run unit and integration tests - run: pytest --cov=pysatModels/ + run: pytest - name: Publish results to coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls --rcfile=setup.cfg --service=github + COVERALLS_PARALLEL: true + run: coveralls --rcfile=pyproject.toml --service=github + + finish: + name: Finish Coverage Analysis + needs: build + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pip install --upgrade coveralls + coveralls --service=github --finish diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index 57113c3d..dd5744da 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.10"] + python-version: ["3.11"] # Keep this version at the highest supported Python version rc-package: ["pysat", "pysatNASA"] name: ${{ matrix.os }} with ${{ matrix.rc-package }} RC @@ -30,9 +30,7 @@ jobs: 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: | - pip install -r test_requirements.txt - pip install -r requirements.txt + run: pip install .[test] - name: Set up pysat run: | @@ -40,9 +38,22 @@ jobs: python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'" - name: Run unit and integration tests - run: pytest --cov=pysatModels/ + run: pytest - name: Publish results to coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls --rcfile=setup.cfg --service=github + COVERALLS_PARALLEL: true + run: coveralls --rcfile=pyproject.toml --service=github + + finish: + name: Finish Coverage Analysis + needs: build + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pip install --upgrade coveralls + coveralls --service=github --finish From ee6f919942d12dd9cf1e6770a8ce8ad652f9ca33 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:04:27 -0500 Subject: [PATCH 03/18] MAINT: update doc conf --- docs/conf.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 4eed61d6..4deb4c35 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,6 +16,7 @@ import datetime as dt import json import os +import pkg_resources import sys sys.path.insert(0, os.path.abspath('..')) @@ -72,9 +73,7 @@ # # The short X.Y version. module_dir = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0] -version_file = os.path.join(module_dir, project, 'version.txt') -with open(version_file, 'r') as fin: - version = fin.read().strip() +version = pkg_resources.get_distribution('pysatModels').version # The full version, including alpha/beta/rc tags. release = '{:s}-alpha'.format(version) @@ -84,7 +83,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From accbd3626133fde33e1fe84ab6444dc66df1b70d Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:04:43 -0500 Subject: [PATCH 04/18] MAINT: turn off tiegcm icon downloads --- pysatModels/models/ucar_tiegcm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pysatModels/models/ucar_tiegcm.py b/pysatModels/models/ucar_tiegcm.py index 7d4f1653..ec53dce0 100644 --- a/pysatModels/models/ucar_tiegcm.py +++ b/pysatModels/models/ucar_tiegcm.py @@ -53,7 +53,8 @@ _test_dates = {'': {'': dt.datetime(2019, 1, 1), 'icon': dt.datetime(2020, 1, 10)}} -_test_download = {'': {'': False, 'icon': True}} +# TODO(#132): Turn on ICON download tests once pysatNASA 0.0.6 is released. +_test_download = {'': {'': False, 'icon': False}} # ---------------------------------------------------------------------------- # Instrument methods @@ -243,7 +244,10 @@ def download(date_array, tag, inst_id, data_path=None, **kwargs): if tag == '': warnings.warn('Not implemented, currently no support for Globus.') + # TODO(#132): Ensure new download routine is used after pysatNASA release. elif tag == 'icon': + warnings.warn('Not implemented, requires pysatNASA 0.0.6.') + elif tag == 'future_icon': # Set up temporary directory for zip files temp_dir = tempfile.TemporaryDirectory() From 4b6706f940dcee984ca0fc1e343fe55134a78da9 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:06:36 -0500 Subject: [PATCH 05/18] MAINT: use new test instruments --- pysatModels/tests/test_utils_convert.py | 4 ++-- pysatModels/tests/test_utils_extract.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pysatModels/tests/test_utils_convert.py b/pysatModels/tests/test_utils_convert.py index ce4ddf3e..142bff4a 100644 --- a/pysatModels/tests/test_utils_convert.py +++ b/pysatModels/tests/test_utils_convert.py @@ -66,10 +66,10 @@ class TestUtilsConvertLoadModelXarray(object): def setup_method(self): """Create a clean testing setup before each method.""" - self.ftime = pysat.instruments.pysat_testing_xarray._test_dates[''][''] + self.ftime = pysat.instruments.pysat_ndtesting._test_dates[''][''] self.filename = "%Y-%m-%d.nofile" self.model_kwargs = {'platform': str('pysat'), - 'name': str('testing_xarray'), + 'name': str('ndtesting'), 'num_samples': 12, 'clean_level': 'clean'} self.model_inst = None diff --git a/pysatModels/tests/test_utils_extract.py b/pysatModels/tests/test_utils_extract.py index 5cf9a9aa..ce81ef80 100644 --- a/pysatModels/tests/test_utils_extract.py +++ b/pysatModels/tests/test_utils_extract.py @@ -341,7 +341,7 @@ class TestUtilsExtractModObsXarray(TestUtilsExtractModObs): def setup_method(self): """Set up the unit test environment for each method.""" - self.inst = pysat.Instrument(platform='pysat', name='testing_xarray') + self.inst = pysat.Instrument(platform='pysat', name='ndtesting') self.model = pysat.Instrument(inst_module=pysat_testmodel, tag='') # Load the data in the instruments @@ -377,7 +377,7 @@ class TestUtilsExtractModObsXarray2D(TestUtilsExtractModObs): def setup_method(self): """Set up the unit test environment for each method.""" - self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray') + self.inst = pysat.Instrument(platform='pysat', name='ndtesting') self.model = pysat.Instrument(inst_module=pysat_testmodel, tag='') # Load the data in the instruments @@ -413,7 +413,7 @@ class TestUtilsExtractInstModViewXarray(TestUtilsExtractInstThroughMod): def setup_method(self): """Run before every method to create a clean testing setup.""" - self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray') + self.inst = pysat.Instrument(platform='pysat', name='ndtesting') self.model = pysat.Instrument(inst_module=pysat_testmodel) # Load the data in the instruments @@ -588,7 +588,7 @@ class TestUtilsAltitudePressureXarray(TestUtilsAltitudePressure): def setup_method(self): """Set up the unit test environment for each method.""" - self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray') + self.inst = pysat.Instrument(platform='pysat', name='ndtesting') self.model = pysat.Instrument(inst_module=pysat_testmodel, tag='pressure_levels') @@ -731,7 +731,7 @@ class TestUtilsExtractInstModIrregViewXarray(TestUtilsExtractInstModIrregView): def setup_method(self): """Run before every method to create a clean testing setup.""" - self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray', + self.inst = pysat.Instrument(platform='pysat', name='ndtesting', num_samples=3, max_latitude=45.) self.model = pysat.Instrument(inst_module=pysat_testmodel, tag='pressure_levels', From 713f68c4c0b234ebe57d0f31ab4e49e4d9bd4e9c Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:10:22 -0500 Subject: [PATCH 06/18] MAINT: remove code for unsupported pysat versions --- pysatModels/tests/test_utils_testing.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pysatModels/tests/test_utils_testing.py b/pysatModels/tests/test_utils_testing.py index 67121924..9dc765e9 100644 --- a/pysatModels/tests/test_utils_testing.py +++ b/pysatModels/tests/test_utils_testing.py @@ -6,7 +6,6 @@ """Unit tests for `pysatModels.utils.testing`.""" import numpy as np -from packaging import version as pack_version import pytest import pysat @@ -25,9 +24,7 @@ def setup_method(self): # Load the data in the instruments load_kwargs = {'date': pysat_testmodel._test_dates['']['']} - if(pack_version.Version(pysat.__version__) - > pack_version.Version('3.0.1')): - load_kwargs['use_header'] = True + load_kwargs['use_header'] = True self.model.load(**load_kwargs) @@ -92,10 +89,6 @@ def test_compare_model_name_coordinates_failure(self, var, coords, msg, return -@pytest.mark.skipif(pack_version.Version(pysat.__version__) - <= pack_version.Version('3.0.1'), - reason=''.join(('Requires test model in pysat ', - ' v3.0.2 or later.'))) class TestUtilsCompareModNamePressure(TestUtilsCompareModName): """Unit tests for `compare_mod_name_coordinates`.""" @@ -107,9 +100,7 @@ def setup_method(self): # Load the data in the instruments load_kwargs = {'date': pysat_testmodel._test_dates['']['']} - if(pack_version.Version(pysat.__version__) - > pack_version.Version('3.0.1')): - load_kwargs['use_header'] = True + load_kwargs['use_header'] = True self.model.load(**load_kwargs) From 8ce23a9aef8133e98c9c4e2dbde997c4530fa5fb Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:10:31 -0500 Subject: [PATCH 07/18] STY: pep8 --- pysatModels/utils/extract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pysatModels/utils/extract.py b/pysatModels/utils/extract.py index f15b7c8c..6d3b037c 100644 --- a/pysatModels/utils/extract.py +++ b/pysatModels/utils/extract.py @@ -859,8 +859,8 @@ def extract_modelled_observations(inst, model, inst_name, mod_name, if mod_ind in mind and pair_method == 'closest': # Test to see if this model observation has multiple pairings old_ind = mind.index(mod_ind) - if(del_sec[inst_ind, mod_ind] - < del_sec[iind[old_ind], mind[old_ind]]): + if (del_sec[inst_ind, mod_ind] < del_sec[iind[old_ind], + mind[old_ind]]): # If this one is closer, keep it iind[old_ind] = inst_ind mind[old_ind] = mod_ind From 391edcaa03a58257b75bdd916d90cb8e53c27a40 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:10:52 -0500 Subject: [PATCH 08/18] MAINT: turn off new tests for now --- pysatModels/models/pydineof_dineof.py | 2 ++ pysatModels/models/sami2py_sami2.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pysatModels/models/pydineof_dineof.py b/pysatModels/models/pydineof_dineof.py index 23abad97..45b21dac 100644 --- a/pysatModels/models/pydineof_dineof.py +++ b/pysatModels/models/pydineof_dineof.py @@ -69,6 +69,8 @@ _test_dates = {'': {tag: dt.datetime(2009, 1, 1) for tag in tags.keys()}} _test_download = {'': {'': False, 'test': True}} +# TODO(#136): Remove when compliant with multi-day load tests +_test_new_tests = {'': {'test': False}} # ---------------------------------------------------------------------------- # Instrument methods diff --git a/pysatModels/models/sami2py_sami2.py b/pysatModels/models/sami2py_sami2.py index 8072dbed..23b08855 100644 --- a/pysatModels/models/sami2py_sami2.py +++ b/pysatModels/models/sami2py_sami2.py @@ -49,6 +49,8 @@ _test_dates = {'': {tag: dt.datetime(2019, 1, 1) for tag in tags.keys()}} _test_download = {'': {'': False, 'test': True}} +# TODO(#136): Remove when compliant with multi-day load tests +_test_new_tests = {'': {'test': False}} # ---------------------------------------------------------------------------- # Instrument methods From 148202a3778805b1a06ae6fd588b68846a0ea63d Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:13:01 -0500 Subject: [PATCH 09/18] MAINT: remove pysatNASA cap --- README.md | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22cc372a..560cfc77 100644 --- a/README.md +++ b/README.md @@ -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 | | diff --git a/requirements.txt b/requirements.txt index 0f66a313..2fc4e0e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ packaging pandas >= 1.4.0 pyForecastTools pysat >= 3.0.4 -pysatNASA <= 0.0.4 +pysatNASA requests scipy xarray From 1dbf850fb0828c6d751672b11a0e95fd98b1823e Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:13:28 -0500 Subject: [PATCH 10/18] DOC: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92683bb5..1f0bceb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,8 @@ 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 * Removed backwards-support for pysat pre-3.0.4 functions + * Updated to use pyproject * Documentation * Added badges and instructions for PyPi and Zenodo From aa3458dd3d3e81ff600adfec30dbc22963a9a468 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 12:15:57 -0500 Subject: [PATCH 11/18] MAINT: update link --- docs/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/overview.rst b/docs/overview.rst index 1bc51ff5..75290286 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -11,7 +11,7 @@ output, and incorporating modelled data sets into general data analysis routines written to use data stored in `pysat.Instrument `_ objects or -`xarray.Datasets `_. +`xarray.Datasets `_. .. image:: images/pysatModels.png :width: 400px From d9070800ad1e9d020c3b0fc301104e41129a749f Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:00:45 -0500 Subject: [PATCH 12/18] BUG: update reqs --- pyproject.toml | 3 +-- requirements.txt | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9db6e4a3..d6e8dceb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,8 +29,7 @@ classifiers = [ ] dependencies = [ "numpy", - "packaging", - "pandas", + "pandas >= 1.4.0", "pyForecastTools", "pysat >= 3.0.4", "pysatNASA", diff --git a/requirements.txt b/requirements.txt index 2fc4e0e1..5a625715 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ numpy -packaging pandas >= 1.4.0 pyForecastTools pysat >= 3.0.4 From 47870a88ef330053e07705a96dc1646dfb598257 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:12:01 -0500 Subject: [PATCH 13/18] BUG: backwards compat for pandas <1.4 --- pyproject.toml | 3 ++- pysatModels/utils/match.py | 7 ++++++- requirements.txt | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d6e8dceb..9db6e4a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,8 @@ classifiers = [ ] dependencies = [ "numpy", - "pandas >= 1.4.0", + "packaging", + "pandas", "pyForecastTools", "pysat >= 3.0.4", "pysatNASA", diff --git a/pysatModels/utils/match.py b/pysatModels/utils/match.py index 2c0534c9..882305af 100644 --- a/pysatModels/utils/match.py +++ b/pysatModels/utils/match.py @@ -7,6 +7,7 @@ import datetime as dt import numpy as np +from packaging import version as pack_ver import pandas as pds import pysat @@ -162,8 +163,12 @@ 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]): + if (pack_ver.Version(pds.__version__) > pack_ver.Version('1.4.0')): + bound_kwargs = {'inclusive': 'left'} + else: + bound_kwargs = {'closed': 'left'} missing_times = [tt for tt in pds.date_range(start, stop, freq='1D', - inclusive='left') + **bound_kwargs) if tt not in inst.files[start:stop].index] for tt in missing_times: inst.download(start=tt, stop=tt + pds.DateOffset(days=1), diff --git a/requirements.txt b/requirements.txt index 5a625715..540b4e62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ numpy -pandas >= 1.4.0 +packaging +pandas pyForecastTools pysat >= 3.0.4 pysatNASA From 2970c4db48cea22bc33571a91ac522e2c1322dea Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:12:28 -0500 Subject: [PATCH 14/18] DOC: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 560cfc77..6f782771 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ the Space Physics community. This module officially supports Python 3.6+. | Common modules | Community modules | | ------------------ | ------------------ | | numpy | pyForecastTools | -| pandas >= 1.4.0 | pysat >= 3.0.4 | +| pandas | pysat >= 3.0.4 | | requests | pysatNASA | | scipy | | | xarray | | From c85f2fb9cb46098e2e22d60e1645fb724b6b9355 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:40:48 -0500 Subject: [PATCH 15/18] MAINT: add readthedocs yaml --- .readthedocs.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..d0bd564d --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,25 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + + +# Optionally declare the Python requirements required to build your docs +python: + install: + - method: pip + path: . + extra_requirements: + - doc From c99f471c6b23b5aabc1d345efaecb20028a80553 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:41:11 -0500 Subject: [PATCH 16/18] DOC: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f0bceb3..30caa8c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Updated tests to new pysat and pytest standards * Removed backwards-support for pysat pre-3.0.4 functions * Updated to use pyproject + * Added yaml for readthedocs * Documentation * Added badges and instructions for PyPi and Zenodo From c1274424827200c4ac3236b02fef617965de8d07 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Wed, 20 Dec 2023 13:45:19 -0500 Subject: [PATCH 17/18] MAINT: apply pysatnasa cap --- CHANGELOG.md | 1 + README.md | 2 +- docs/installation.rst | 10 +++++----- pyproject.toml | 2 +- requirements.txt | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30caa8c3..1d770638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +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 * Removed backwards-support for pysat pre-3.0.4 functions * Updated to use pyproject * Added yaml for readthedocs diff --git a/README.md b/README.md index 6f782771..b221a5e1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ the Space Physics community. This module officially supports Python 3.6+. | ------------------ | ------------------ | | numpy | pyForecastTools | | pandas | pysat >= 3.0.4 | -| requests | pysatNASA | +| requests | pysatNASA <= 0.0.4 | | scipy | | | xarray | | diff --git a/docs/installation.rst b/docs/installation.rst index 35bffcb3..63e30287 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -20,15 +20,15 @@ Prerequisites pysatModels uses common Python modules, as well as modules developed by and for the Space Physics community. This module officially supports Python 3.6+. - ============== ================= + ============== ================== Common modules Community modules - ============== ================= - numpy pysat - pandas pysatNASA + ============== ================== + numpy pysat >= 3.0.4 + pandas pysatNASA <= 0.0.4 requests pyForecastTools scipy xarray - ============== ================= + ============== ================== .. _install-opt: diff --git a/pyproject.toml b/pyproject.toml index 9db6e4a3..25d5976d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "pandas", "pyForecastTools", "pysat >= 3.0.4", - "pysatNASA", + "pysatNASA <= 0.0.4", "requests", "scipy", "xarray" diff --git a/requirements.txt b/requirements.txt index 540b4e62..fefe7b93 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ packaging pandas pyForecastTools pysat >= 3.0.4 -pysatNASA +pysatNASA <= 0.0.4 requests scipy xarray From 4ce2fdae39bc0596476837a4a72596b9eb0304fe Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:00:41 -0500 Subject: [PATCH 18/18] Apply suggestions from code review --- .github/workflows/main.yml | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e513cb7a..000ee8b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: test_config: ["latest"] include: - python-version: "3.9" - numpy_ver: "1.21" + numpy_ver: "1.22" os: ubuntu-latest test_config: "NEP29" - python-version: "3.6.8" diff --git a/pyproject.toml b/pyproject.toml index 25d5976d..e760d663 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,7 @@ markers = [ "download", "no_download", "load_options", + "new_tests", "first", "second" ]