diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c395c432..e1c56b2e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,32 +1,29 @@ --- name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' +about: Create a report to report a problem that needs to be fixed +labels: bug +title: "BUG: " --- -**Describe the bug** -A clear and concise description of what the bug is. +# Description +A clear and concise description of what the bug is, including a description +of what you expected the outcome to be. -**To Reproduce** +# To Reproduce this bug: Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error -**Expected behavior** -A clear and concise description of what you expected to happen. +Consider including images or test files to help others reproduce the bug and +solve the problem. -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Version [e.g. 22] +## Test configuration + - OS: [e.g., Hal] + - Version: [e.g., Python 3.47] - Other details about your setup that could be relevant -**Additional context** -Add any other context about the problem here. +# Additional context +Add any other context about the problem here, including expected behaviour. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d..d02da2ef 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,20 +1,27 @@ --- name: Feature request about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' +title: "ENH: " +labels: enhancement --- -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +# Description +A clear and concise description of the new feature or behaviour you would like. -**Describe the solution you'd like** +## Potential impact + +- Is the feature related to an existing problem? +- How critical is this feature to your workflow? +- How wide of an impact to you anticipate this enhancement having? +- Would this break any existing functionality? + +## Potential solution(s) A clear and concise description of what you want to happen. -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +# Alternatives +A clear description of any alternative solutions or features you've considered. -**Additional context** -Add any other context or screenshots about the feature request here. +# Additional context +Add any other context or screenshots about the feature request here, potentially +including your operational configuration. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 00000000..463725ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,19 @@ +--- +name: Question +about: A question about this project +title: "QUEST: " +labels: question + +--- + +# Description +A clear and concise summary of your query + +## Example code (optional) +If relevant, include sample code, images, or files so that others can understand +the full context of your question. + +## Configuration + - OS: [e.g., Hal] + - Version: [e.g., Python 3.47] + - Other details about your setup that could be relevant diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5f45efae..73f3656d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,6 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +# This workflow will install Python dependencies, run tests and lint +# with a variety of Python versions. For more information see: +# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Documentation Check @@ -8,30 +9,35 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest + runs-on: ["ubuntu-latest"] strategy: fail-fast: false matrix: - python-version: [3.7] + python-version: ["3.11"] name: Documentation tests steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - 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: | mkdir pysatData python -c "import pysat; pysat.params['data_dirs'] = './pysatData'" + - name: Check documentation build + run: sphinx-build -E -b html docs dist/docs + + - name: Check documentation links + run: sphinx-build -b linkcheck docs dist/docs + - name: Load .zenodo.json to check for errors run: python -c "import json; json.loads(open('.zenodo.json').read())" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3b6eee0..c9c583cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,35 +10,35 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10"] - os: [ubuntu-latest, macos-latest, windows-latest] - numpy_ver: [latest] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.11", "3.12"] + numpy_ver: ["latest"] + test_config: ["latest"] include: - - python-version: "3.8" - numpy_ver: "1.21" + # NEP29 compliance settings + - python-version: "3.10" + numpy_ver: "1.24" os: "ubuntu-latest" + test_config: "NEP29" name: Python ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install requirements for testing setup - run: | - pip install -r test_requirements.txt - - - name: Install dependencies - run: | - pip install -r requirements.txt - - name: Install NEP29 dependencies - if: ${{ matrix.numpy_ver != 'latest'}} + if: ${{ matrix.test_config == 'NEP29'}} run: | - pip install --no-binary :numpy: numpy==${{ matrix.numpy_ver }} + 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: | @@ -52,9 +52,22 @@ jobs: run: flake8 . --count --exit-zero --max-complexity=10 --statistics - name: Test with pytest - run: pytest --cov=pysatSeasons/ + run: pytest + + - name: Coveralls Parallel + uses: coverallsapp/github-action@v2 + with: + flag-name: run-${{ join(matrix.*, '-') }} + parallel: true + + finish: + name: Finish Coverage Analysis + needs: build + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true - - name: Publish results to coveralls - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls --rcfile=setup.cfg --service=github diff --git a/.github/workflows/pip_rc_install.yml b/.github/workflows/pip_rc_install.yml new file mode 100644 index 00000000..34fe53bd --- /dev/null +++ b/.github/workflows/pip_rc_install.yml @@ -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 pysatSeasons 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.12"] # 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@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install standard dependencies + run: pip install -r requirements.txt + + - name: Install pysatSeasons RC + run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysatSeasons + + - 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 pysatSeasons; print(pysatSeasons.__version__)" diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml new file mode 100644 index 00000000..98036b3e --- /dev/null +++ b/.github/workflows/pysat_rc.yml @@ -0,0 +1,55 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Test with latest pysat RC + +on: [workflow_dispatch] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.12"] + + name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pysat RC + run: pip install --no-deps --pre -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pysat + + - name: Install with standard dependencies + run: pip install .[test] + + - name: Set up pysat + run: | + mkdir pysatData + python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'" + + - name: Test with pytest + run: pytest + + - name: Coveralls Parallel + uses: coverallsapp/github-action@v2 + with: + flag-name: run-${{ join(matrix.*, '-') }} + parallel: true + + finish: + name: Finish Coverage Analysis + needs: build + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + diff --git a/.gitignore b/.gitignore index 6db464db..c14a25ed 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ # Distribution / packaging .Python +.python-version env/ build/ develop-eggs/ diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..9c3316d6 --- /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.11" + +# 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 diff --git a/ACKNOWLEDGEMENTS.md b/ACKNOWLEDGEMENTS.md new file mode 100644 index 00000000..bc29cec6 --- /dev/null +++ b/ACKNOWLEDGEMENTS.md @@ -0,0 +1,38 @@ +Funding +======= +The following institutions, missions, and programs have provided funding +for pysat development. + +Institutions +------------ + - The Catholic University of America (CUA) + - Cosmic Studio + - Defense Advanced Research Projects Agency (DARPA) Defense Sciences Office + - National Aeronautics and Space Administration (NASA) + - National Oceanic and Atmospheric Administration (NOAA) + - National Science Foundation (NSF) + - Office of Naval Research (ONR) + +Missions +-------- + - NOAA Constellation Observing System for Meteorology Ionosphere and Climate + (COSMIC-2) + - NASA Ionospheric Connections Explorer (ICON) + - NASA Scintillation Observations and Response of the Ionosphere to + Electrodynamics (SORTIE) + - NASA Scintillation Prediction Observations Research Task (SPORT) + +Programs +-------- + - NSF 125908, AGS-1651393 + - NASA NNX10AT02G, NNH20ZDA001N-LWS, 80NSSC18K120, and 80NSSC21M0180 + - NASA Space Precipitation Impacts (SPI) project at Goddard Space Flight + Center through the Heliophysics Internal Science Funding Model. + +Disclaimers +=========== +Any opinions or actions taken by the listed funding institutions are those of +the institutions and do not necessarily reflect the views of the pysat +development team or individual authors. Any opinions, findings, and conclusions +or recommendations expressed in this material are those of the author(s) and do +not necessarily reflect the views of the funding agencies. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5907070e..7d91bd5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.2.1] - 2024-11-08 +- Maintenance + - Update pytest syntax + - Update Github Actions workflows + - Add workflow for testing with pysat RC + - Add workflow for testing the install of pysatSeasons RC from pip + - Dropped tests for deprecated pysat instruments + - Implement pyproject.toml + - Implement coveralls app for GitHub Actions + - Update contributing document and issue templates + - Add Acknowledgements doc + - Set minimum pysat to 3.2.0 + ## [0.2.0] - 2022-08-12 - New Features - Added support for xarray data in the seasonal averaging functions in `pysatSeasons.avg` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6066cd73..da17f66c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,73 +2,136 @@ Contributing ============ Bug reports, feature suggestions and other contributions are greatly -appreciated! PysatSeasons is a community-driven project and welcomes both feedback and contributions. +appreciated! pysat and pysatSeasons are a community-driven projects that +welcome both feedback and contributions. + +Come join us on Slack! An invitation to the pysat workspace is available +in the 'About' section of the +[pysat GitHub Repository.](https://github.com/pysat/pysat) Development meetings +are generally held fortnightly. Short version -============= +------------- * Submit bug reports and feature requests at `GitHub `_ + * Make pull requests to the ``develop`` branch +Issues +------ + +Bug reports, questions, and feature requests should all be made as GitHub +Issues. Templates are provided for each type of issue, to help you include +all the necessary information. + +Questions +^^^^^^^^^ + +Not sure how something works? Ask away! The more information you provide, the +easier the question will be to answer. You can also interact with the pysat +developers on our [slack channel](https://pysat.slack.com). + Bug reports -=========== +^^^^^^^^^^^ -When `reporting a bug `_ please +When [reporting a bug](https://github.com/pysat/pysatSeasons/issues) please include: * Your operating system name and version + * Any details about your local setup that might be helpful in troubleshooting + * Detailed steps to reproduce the bug Feature requests and feedback -============================= +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The best way to send feedback is to file an issue at -`GitHub `_. +The best way to send feedback is to file an +[issue](https://github.com/pysat/pysatSeasons/issues). -If you are proposing a feature: +If you are proposing a new feature or a change in something that already exists: * Explain in detail how it would work. + * Keep the scope as narrow as possible, to make it easier to implement. + * Remember that this is a volunteer-driven project, and that code contributions are welcome :) Development -=========== +----------- To set up `pysatSeasons` for local development: -1. `Fork pysat on GitHub `_. -2. Clone your fork locally:: +1. [Fork pysatSeasons on GitHub](https://github.com/pysat/pysatSeasons/fork). + +2. Clone your fork locally: + ``` git clone git@github.com:your_name_here/pysatSeasons.git + ``` -3. Create a branch for local development:: +3. Create a branch for local development: + ``` git checkout -b name-of-your-bugfix-or-feature + ``` + + Now you can make your changes locally. - Now you can make your changes locally. Tests for new instruments are - performed automatically. Tests for custom functions should be added to the - appropriately named file in ``pysatSeasons/tests``. For example, the averaging routines in avg.py are tested in ``pysatSeasons/tests/test_avg.py``. If no - test file exists, then you should create one. This testing uses pytest, which - will run tests on any python file in the test directory that starts with - ``test_``. + Tests for new instruments are performed automatically. See discussion + [here](https://pysat.readthedocs.io/en/main/new_instrument.html#testing-support) + for more information on triggering these standard tests. + + Tests for custom functions should be added to the appropriately named file + in ``pysatSeasons/tests``. For example, custom functions for the time + utilities are tested in ``pysat/tests/test_utils_time.py``. If no test file + exists, then you should create one. This testing uses pytest, which will run + tests on any Python file in the test directory that starts with ``test``. + Classes must begin with ``Test``, and methods must begin with ``test`` as + well. 4. When you're done making changes, run all the checks to ensure that nothing - is broken on your local system:: + is broken on your local system: + + ``` + pytest + ``` + +5. You should also check for flake8 style compliance: + + ``` + flake8 . --count --select=D,E,F,H,W --show-source --statistics + ``` + + Note that pysat uses the `flake-docstrings` and `hacking` packages to ensure + standards in docstring formatting. + +6. Update/add documentation (in ``docs``). Even if you don't think it's + relevant, check to see if any existing examples have changed. - pytest -vs +7. Add your name to the .zenodo.json file as an author -5. Update/add documentation (in ``docs``), if relevant +8. Commit your changes: + ``` + git add . + git commit -m "AAA: Brief description of your changes" + ``` + Where AAA is a standard shorthand for the type of change (e.g., BUG or DOC). + `pysat` follows the [numpy development workflow](https://numpy.org/doc/stable/dev/development_workflow.html), + see the discussion there for a full list of this shorthand notation. -5. Commit your changes and push your branch to GitHub:: +9. Once you are happy with the local changes, push to GitHub: + ``` + git push origin name-of-your-bugfix-or-feature + ``` + Note that each push will trigger the Continuous Integration workflow. - git add . - git commit -m "Brief description of your changes" - git push origin name-of-your-bugfix-or-feature +10. Submit a pull request through the GitHub website. Pull requests should be + made to the ``develop`` branch. Note that automated tests will be run on + GitHub Actions, but these must be initialized by a member of the pysat team + for first time contributors. -6. Submit a pull request through the GitHub website. Pull requests should be - made to the ``develop`` branch. Pull Request Guidelines ----------------------- @@ -80,11 +143,52 @@ For merging, you should: 1. Include an example for use 2. Add a note to ``CHANGELOG.md`` about the changes -3. Ensure that all checks passed (current checks include Scrutinizer, Travis-CI, - and Coveralls) [1]_ - -.. [1] If you don't have all the necessary Python versions available locally or - have trouble building all the testing environments, you can rely on - Travis to run the tests for each change you add in the pull request. - Because testing here will delay tests by other developers, please ensure - that the code passes all tests on your local system first. +3. Update the author list in ``zenodo.json``, if applicable +4. Ensure that all checks passed (current checks include GitHub Actions, + Coveralls, and ReadTheDocs) + +If you don't have all the necessary Python versions available locally or have +trouble building all the testing environments, you can rely on GitHub Actions to +run the tests for each change you add in the pull request. Because testing here +will delay tests by other developers, please ensure that the code passes all +tests on your local system first. + + +Project Style Guidelines +------------------------ + +In general, pysat follows PEP8 and numpydoc guidelines. Pytest runs the unit +and integration tests, flake8 checks for style, and sphinx-build performs +documentation tests. However, there are certain additional style elements that +have been adopted to ensure the project maintains a consistent coding style. +These include: + +* Line breaks should occur before a binary operator (ignoring flake8 W503) +* Combine long strings using `join` +* Preferably break long lines on open parentheses rather than using `\` +* Use no more than 80 characters per line +* Avoid using Instrument class key attribute names as unrelated variable names: + `platform`, `name`, `tag`, and `inst_id` +* The pysat logger is imported into each sub-module and provides status updates + at the info and warning levels (as appropriate) +* Several dependent packages have common nicknames, including: + * `import datetime as dt` + * `import numpy as np` + * `import pandas as pds` + * `import xarray as xr` +* When incrementing a timestamp, use `dt.timedelta` instead of `pds.DateOffset` + when possible to reduce program runtime +* All classes should have `__repr__` and `__str__` functions +* Docstrings use `Note` instead of `Notes` +* Try to avoid creating a try/except statement where except passes +* Use setup_method (or setup_class) and teardown_method (or teardown_class) in + test classes +* Use pytest parametrize in test classes when appropriate +* Use pysat testing utilities when appropriate +* Provide testing class methods with informative failure statements and + descriptive, one-line docstrings +* Block and inline comments should use proper English grammar and punctuation + with the exception of single sentences in a block, which may then omit the + final period +* When casting is necessary, use `np.int64` and `np.float64` to ensure operating + system agnosticism diff --git a/LICENSE b/LICENSE index 34c14de5..a7ca5b67 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2019, pysat +Copyright (c) 2024, pysat All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 6f6b24f7..e261290c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ -pysatSeasons allows users to run seasonal data analyses over N-dimensional +pysatSeasons allows users to run seasonal data analyses over N-dimensional data sets managed through the pysat module. Main Features @@ -27,11 +27,11 @@ Main Features ### Prerequisites pysatSeasons uses common Python modules, as well as modules developed by -and for the Space Physics community. +and for the Space Physics community. | Common modules | Community modules | | -------------- | ----------------- | -| matplotlib | pysat >= 3.0.4 | +| matplotlib | pysat >= 3.2.0 | | numpy | | | pandas | | | xarray | | diff --git a/demo/cosmic_and_ivm_demo.py b/demo/cosmic_and_ivm_demo.py index 1a7d4219..c1adcffc 100644 --- a/demo/cosmic_and_ivm_demo.py +++ b/demo/cosmic_and_ivm_demo.py @@ -24,7 +24,7 @@ 'the currently installed version. Please see the demo ', 'code in pysatSeasons v0.1.3 for COSMIC support when in ', 'pandas data format.']) - raise(ValueError, estr) + raise (ValueError, estr) def add_magnetic_coordinates(inst): diff --git a/docs/acknowledgements.rst b/docs/acknowledgements.rst new file mode 100644 index 00000000..dd1f917a --- /dev/null +++ b/docs/acknowledgements.rst @@ -0,0 +1 @@ +.. mdinclude:: ../ACKNOWLEDGEMENTS.md diff --git a/docs/conf.py b/docs/conf.py index 1702530f..113ea861 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,11 @@ # -*- coding: utf-8 -*- - +# Copyright (C) 2022, pysat development team +# Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. +# ----------------------------------------------------------------------------- """Configuration file for the Sphinx documentation builder. Note diff --git a/docs/index.rst b/docs/index.rst index 26cb121f..0578f4ca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -.. pysatModels documentation main file. Remember that it should at least +.. pysatSeasons documentation main file. Remember that it should at least contain the root `toctree` directive. Welcome to the pysatSeasons documentation @@ -18,6 +18,11 @@ such as bin averaging, occurrence probabilities, and scatter plots. examples.rst develop_guide.rst history.rst + acknowledgements.rst + + +.. admonition:: DISTRIBUTION STATEMENT A: Approved for public release. + Distribution is unlimited. Indices and tables diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..3fdbafc4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,88 @@ +[build-system] +requires = ["setuptools >= 38.6", "pip >= 10"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["pysatSeasons"] + +[project] +name = "pysatSeasons" +version = "0.2.1" +description = "Seasonal analysis routines for pysat" +readme = "README.md" +requires-python = ">=3.10" +license = {file = "LICENSE"} +authors = [ + {name = "Russell Stoneback, et al.", email = "pysat.developers@gmail.com"}, +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows" +] +keywords = [ + "pysat", + "ionosphere", + "magnetosphere", + "solar wind", + "thermosphere", + "average", + "analysis", + "season", + "climatology" +] +dependencies = [ + "matplotlib", + "numpy", + "pandas", + "pysat >= 3.2.0", + "xarray" +] + +[project.optional-dependencies] +test = [ + "flake8", + "flake8-docstrings", + "hacking >= 1.0", + "pytest", + "pytest-cov", + "pytest-ordering" +] +doc = [ + "extras_require", + "ipython", + "m2r2", + "numpydoc", + "sphinx", + "sphinx_rtd_theme >= 1.2.2, < 2.0.0" +] + +[project.urls] +Documentation = "https://pysatseasons.readthedocs.io/en/latest/" +Source = "https://github.com/pysat/pysatSeasons" + +[tool.coverage.report] +omit = ["*/instruments/templates/"] + +[tool.pytest.ini_options] +addopts = "--cov=pysatSeasons --cov-report xml" +markers = [ + "all_inst", + "download", + "no_download", + "load_options", + "new_tests", + "first", + "second" +] diff --git a/pysatSeasons/__init__.py b/pysatSeasons/__init__.py index d6a4f652..ea7bf028 100644 --- a/pysatSeasons/__init__.py +++ b/pysatSeasons/__init__.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """pysatSeasons. @@ -18,7 +22,10 @@ """ -import os +try: + from importlib import metadata +except ImportError: + import importlib_metadata as metadata # Import key modules and skip F401 testing in flake8 from pysatSeasons._core import to_xarray_dataset # noqa: F401 @@ -27,6 +34,4 @@ from pysatSeasons import plot # noqa: F401 # set version -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'version.txt')) as version_file: - __version__ = version_file.read().strip() +__version__ = metadata.version('pysatSeasons') diff --git a/pysatSeasons/_core.py b/pysatSeasons/_core.py index 6f35b10b..cfac0787 100644 --- a/pysatSeasons/_core.py +++ b/pysatSeasons/_core.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- import pandas as pds import xarray as xr @@ -22,8 +26,8 @@ def to_xarray_dataset(data): Parameters ---------- data : list-like - List-like (including ndarray, Series, DataFrames, Datasets or list-like of these object) to be converted - or combined into a single Dataset. + List-like (including ndarray, Series, DataFrames, Datasets or list-like + of these object) to be converted or combined into a single Dataset. Returns ------- diff --git a/pysatSeasons/avg.py b/pysatSeasons/avg.py index 434132a9..09dee91e 100644 --- a/pysatSeasons/avg.py +++ b/pysatSeasons/avg.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Instrument independent seasonal averaging routine. diff --git a/pysatSeasons/occur_prob.py b/pysatSeasons/occur_prob.py index 0f88b6d4..19ea6197 100644 --- a/pysatSeasons/occur_prob.py +++ b/pysatSeasons/occur_prob.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Occurrence probability routines, daily or by orbit. diff --git a/pysatSeasons/plot.py b/pysatSeasons/plot.py index b634923f..790bb335 100644 --- a/pysatSeasons/plot.py +++ b/pysatSeasons/plot.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Support scatterplot production over seasons of interest.""" diff --git a/pysatSeasons/tests/__init__.py b/pysatSeasons/tests/__init__.py index a3e75cad..13750bd1 100644 --- a/pysatSeasons/tests/__init__.py +++ b/pysatSeasons/tests/__init__.py @@ -1,3 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022, pysat development team +# Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. +# ----------------------------------------------------------------------------- """Unit and Integration Tests for pysatSeasons. Note diff --git a/pysatSeasons/tests/test_avg.py b/pysatSeasons/tests/test_avg.py index ab41949f..0dc40ff0 100644 --- a/pysatSeasons/tests/test_avg.py +++ b/pysatSeasons/tests/test_avg.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Test the pysat averaging code.""" @@ -20,7 +24,7 @@ class TestBasics(object): """Test basic functions using pandas 1D data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument('pysat', 'testing', clean_level='clean') @@ -33,7 +37,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.bounds1, self.bounds2, self.long_bins del self.mlt_bins @@ -118,9 +122,9 @@ def test_basic_seasonal_median1D(self): class TestXarrayBasics(TestBasics): """Reapply basic tests to 1D xarray data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3)) self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2)) @@ -135,7 +139,7 @@ def setup(self): class TestBasicsMeanBy(object): """Test basic functions using pandas 1D data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument('pysat', 'testing', clean_level='clean') @@ -144,7 +148,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.bounds1, self.bounds2 @@ -189,148 +193,34 @@ def test_basic_file_mean(self): class TestXarrayBasicsMeanBy(TestBasicsMeanBy): """Reapply basic tests to 1D xarray data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing_xarray', - clean_level='clean') + self.testInst = pysat.Instrument('pysat', 'ndtesting', sample_rate='1S', + num_samples=86400, clean_level='clean') self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3)) self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2)) return -class TestFrameProfileAverages(object): - """Test bin averaging dataframes from pandas data sources.""" - - def setup(self): - """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing2D', - clean_level='clean') - self.testInst.bounds = (dt.datetime(2008, 1, 1), - dt.datetime(2008, 1, 3)) - self.dname = 'alt_profiles' - self.test_vals = np.arange(50) * 1.2 - self.test_fracs = np.arange(50) / 50.0 - - return - - def teardown(self): - """Run after every method to clean up previous testing.""" - del self.testInst, self.dname, self.test_vals, self.test_fracs - - return - - def test_basic_seasonal_2Dmedian(self): - """Test the basic seasonal 2D median.""" - - results = avg.median2D(self.testInst, [0., 360., 24], 'longitude', - [0., 24., 24], 'mlt', [self.dname]) - - # Test medians. - for i, row in enumerate(results[self.dname]['median']): - for j, item in enumerate(row): - assert np.all(item['density'] == self.test_vals) - assert np.all(item['fraction'] == self.test_fracs) - - # No variation in the median, all values should be the same - for i, row in enumerate(results[self.dname]['avg_abs_dev']): - for j, item in enumerate(row): - assert np.all(item['density'] == 0) - assert np.all(item['fraction'] == 0) - - return - - def test_basic_seasonal_1Dmedian(self): - """Test the basic seasonal 1D median.""" - - results = avg.median1D(self.testInst, [0., 24, 24], 'mlt', - [self.dname]) - - # Test medians. - for i, row in enumerate(results[self.dname]['median']): - assert np.all(row['density'] == self.test_vals) - assert np.all(row['fraction'] == self.test_fracs) - - # No variation in the median, all values should be the same. - for i, row in enumerate(results[self.dname]['avg_abs_dev']): - assert np.all(row['density'] == 0) - assert np.all(row['fraction'] == 0) - - return - - -class TestSeriesProfileAverages(object): - """Test bin averaging series profile data from pandas data sources.""" - - def setup(self): - """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing2D', - clean_level='clean') - self.testInst.bounds = (dt.datetime(2008, 1, 1), - dt.datetime(2008, 2, 1)) - self.dname = 'series_profiles' - self.test_vals = np.arange(50) * 1.2 - - return - - def teardown(self): - """Run after every method to clean up previous testing.""" - del self.testInst, self.dname - - return - - def test_basic_seasonal_median2D(self): - """Test basic seasonal 2D median.""" - results = avg.median2D(self.testInst, [0., 360., 24], 'longitude', - [0., 24., 24], 'mlt', [self.dname]) - - # Test medians. - for i, row in enumerate(results[self.dname]['median']): - for j, item in enumerate(row): - assert np.all(item[self.dname] == self.test_vals) - - # No variation in the median, all values should be the same. - for i, row in enumerate(results[self.dname]['avg_abs_dev']): - for j, item in enumerate(row): - assert np.all(item[self.dname] == 0) - - return - - def test_basic_seasonal_median1D(self): - """Test basic seasonal 1D median.""" - - results = avg.median1D(self.testInst, [0., 24., 24], 'mlt', - [self.dname]) - - # Test medians. - for i, row in enumerate(results[self.dname]['median']): - assert np.all(row[self.dname] == self.test_vals) - - # No variation in the median, all values should be the same. - for i, row in enumerate(results[self.dname]['avg_abs_dev']): - assert np.all(row[self.dname] == 0) - - return - - class TestXarrayProfileAverages(object): """Test bin averaging profile data from xarray data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing2D_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.testInst.bounds = (dt.datetime(2008, 1, 1), dt.datetime(2008, 2, 1)) self.dname = 'profiles' - self.test_val_length = 15 + self.test_name = 'z' return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" - del self.testInst, self.dname, self.test_val_length + del self.testInst, self.dname, self.test_name return @@ -359,10 +249,11 @@ def test_basic_seasonal_median1D(self): results = avg.median1D(self.testInst, [0., 24., 24], 'mlt', [self.dname]) + test_val_length = self.testInst.data.coords[self.test_name].shape[0] for i, row in enumerate(results[self.dname]['median']): # Define truth values. There is a variation in value based on # longitude, at thousands level. MLT only shows at ones/tens level. - test_vals = [i] * self.test_val_length + test_vals = [i] * test_val_length vals = [] for val in row[self.dname].values: if not isinstance(val, np.float64): @@ -381,14 +272,14 @@ def test_basic_seasonal_median1D(self): class TestXarrayVariableProfileAverages(TestXarrayProfileAverages): """Test bin averaging variable profile data from xarray data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing2D_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.testInst.bounds = (dt.datetime(2008, 1, 1), dt.datetime(2008, 2, 1)) self.dname = 'variable_profiles' - self.test_val_length = 15 + self.test_name = 'z' return @@ -396,20 +287,20 @@ def setup(self): class TestXarrayImageAverages(TestXarrayProfileAverages): """Test bin averaging image data from xarray data sources.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing2D_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.testInst.bounds = (dt.datetime(2008, 1, 1), dt.datetime(2008, 2, 1)) self.dname = 'images' - self.test_val_length = 17 + self.test_name = 'x' return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" - del self.testInst, self.dname, self.test_val_length + del self.testInst, self.dname, self.test_name return @@ -417,7 +308,7 @@ def teardown(self): class TestConstellation(object): """Test seasonal analysis for constellations.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" insts = [] for i in range(5): @@ -437,7 +328,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testC, self.testI, self.bounds @@ -492,7 +383,7 @@ def test_constellation_median1D(self): class TestHeterogenousConstellation(TestConstellation): """Test with a Constellation of Instruments with different parameters.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" insts = [] for i in range(2): @@ -516,7 +407,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testC, self.bounds, self.one_d_vars, self.unequal_one_d_vars del self.testI @@ -524,39 +415,10 @@ def teardown(self): return -class Test2DConstellation(TestSeriesProfileAverages): - """Test seasonal analysis for 2D pandas constellations.""" - - def setup(self): - """Run before every method to create a clean testing setup.""" - - self.insts = [] - self.testInst = pysat.Instrument('pysat', 'testing2D', - clean_level='clean') - self.testInst.bounds = (dt.datetime(2008, 1, 1), - dt.datetime(2008, 1, 3)) - self.insts.append(self.testInst) - self.insts.append(self.testInst) - - self.dname = 'series_profiles' - self.test_vals = np.arange(50) * 1.2 - - self.testC = pysat.Constellation(instruments=self.insts) - - return - - def teardown(self): - """Run after every method to clean up previous testing.""" - - del self.testC, self.insts, self.testInst, self.dname, self.test_vals - - return - - class TestSeasonalAverageUnevenBins(TestBasics): """Test seasonal analysis for uneven bins.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument('pysat', 'testing', @@ -574,7 +436,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.bounds1, self.bounds2, self.long_bins @@ -635,7 +497,7 @@ def test_median2D_bad_input(self): class TestInstMed1D(object): """Test one-dimensional medians.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument('pysat', 'testing', @@ -669,7 +531,7 @@ def setup(self): 12., 11., 12., 11., 11., 11., 11., 12.]}} return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.test_bins, self.test_label, self.test_data @@ -787,7 +649,7 @@ def test_bin_data_type(self): class TestDeprecation(object): """Unit test for deprecation warnings.""" - def setup(self): + def setup_method(self): """Set up the unit test environment for each method.""" warnings.simplefilter("always", DeprecationWarning) @@ -800,7 +662,7 @@ def setup(self): self.war = "" return - def teardown(self): + def teardown_method(self): """Clean up the unit test environment after each method.""" # self.in_kwargs, self.ref_time, del self.warn_msgs, self.war diff --git a/pysatSeasons/tests/test_core.py b/pysatSeasons/tests/test_core.py index 2c839c9f..c0e94f0d 100644 --- a/pysatSeasons/tests/test_core.py +++ b/pysatSeasons/tests/test_core.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Test the pysat _core code.""" @@ -16,7 +20,7 @@ class TestCore(object): """Test the core code for prepping seasonal analysis.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument(inst_module=pinsts.pysat_testing, @@ -24,7 +28,7 @@ def setup(self): self.bounds1 = self.testInst.inst_module._test_dates[''][''] return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.bounds1 @@ -85,14 +89,14 @@ def test_comp_form_list_data(self): class TestCoreXarray(TestCore): """Test the core code for prepping seasonal analysis for xarray.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument(inst_module=pinsts.pysat_testing_xarray, + self.testInst = pysat.Instrument(inst_module=pinsts.pysat_ndtesting, clean_level='clean', use_header=True) self.bounds1 = self.testInst.inst_module._test_dates[''][''] return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.bounds1 return diff --git a/pysatSeasons/tests/test_occur_prob.py b/pysatSeasons/tests/test_occur_prob.py index 2f31490c..d7bccd37 100644 --- a/pysatSeasons/tests/test_occur_prob.py +++ b/pysatSeasons/tests/test_occur_prob.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Test pysatSeasons occur_prob object and code.""" @@ -19,7 +23,7 @@ class TestBasics(object): """Basic tests using pandas data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" orbit_info = {'index': 'longitude', 'kind': 'longitude'} self.testInst = pysat.Instrument('pysat', 'testing', @@ -32,7 +36,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst @@ -174,15 +178,15 @@ def test_occur_prob_by_orbit_3D_w_bins(self): class TestXarrayBasics(TestBasics): """Reapply basic tests with xarray data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" orbit_info = {'index': 'longitude', 'kind': 'longitude'} - self.testInst = pysat.Instrument('pysat', 'testing_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean', orbit_info=orbit_info) # Assign short bounds. - test_date = pysat.instruments.pysat_testing_xarray._test_dates[''][''] + test_date = pysat.instruments.pysat_ndtesting._test_dates[''][''] self.testInst.bounds = (test_date, test_date + dt.timedelta(days=1)) return @@ -191,7 +195,7 @@ def setup(self): class TestConstellationBasics(TestBasics): """Basic tests using Constellations and pandas data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" orbit_info = {'index': 'longitude', 'kind': 'longitude'} self.rawInst = pysat.Instrument('pysat', 'testing', @@ -207,7 +211,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.rawInst @@ -217,15 +221,15 @@ def teardown(self): class TestXarrayConstellationBasics(TestBasics): """Basic tests using Constellations and xarray data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" orbit_info = {'index': 'longitude', 'kind': 'longitude'} - self.rawInst = pysat.Instrument('pysat', 'testing_xarray', + self.rawInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean', orbit_info=orbit_info) # Assign short bounds. - test_date = pysat.instruments.pysat_testing_xarray._test_dates[''][''] + test_date = pysat.instruments.pysat_ndtesting._test_dates[''][''] self.rawInst.bounds = (test_date, test_date + dt.timedelta(days=1)) self.testInst = pysat.Constellation(instruments=[self.rawInst, @@ -233,7 +237,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.rawInst @@ -247,7 +251,7 @@ def teardown(self): class TestDeprecation(object): """Unit test for deprecation warnings.""" - def setup(self): + def setup_method(self): """Set up the unit test environment for each method.""" warnings.simplefilter("always", DeprecationWarning) @@ -260,7 +264,7 @@ def setup(self): self.war = "" return - def teardown(self): + def teardown_method(self): """Clean up the unit test environment after each method.""" # self.in_kwargs, self.ref_time, del self.warn_msgs, self.war diff --git a/pysatSeasons/tests/test_plot.py b/pysatSeasons/tests/test_plot.py index 3b072a4a..5aa745ce 100644 --- a/pysatSeasons/tests/test_plot.py +++ b/pysatSeasons/tests/test_plot.py @@ -2,6 +2,10 @@ # -*- coding: utf-8 -*- # Copyright (C) 2022, pysat development team # Full license can be found in License.md +# DOI:10.5281/zenodo.3475493 +# +# DISTRIBUTION STATEMENT A: Approved for public release. Distribution is +# unlimited. # ----------------------------------------------------------------------------- """Test pysatSeasons plotting code.""" @@ -16,7 +20,7 @@ class TestBasics(object): """Tests to ensure the plot objects work as expected.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.testInst = pysat.Instrument('pysat', 'testing', clean_level='clean') @@ -25,7 +29,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst plt.close() @@ -94,9 +98,9 @@ def test_multiple_scatterplots(self): class TestXarrayBasics(TestBasics): """Reapply basic tests with xarray data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.testInst = pysat.Instrument('pysat', 'testing_xarray', + self.testInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.testInst.bounds = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 1)) @@ -107,7 +111,7 @@ def setup(self): class TestConstellationBasics(TestBasics): """Reapply basic tests with Constellation data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" self.rawInst = pysat.Instrument('pysat', 'testing', clean_level='clean') @@ -119,7 +123,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.rawInst plt.close() @@ -130,9 +134,9 @@ def teardown(self): class TestXarrayConstellationBasics(TestXarrayBasics): """Reapply basic tests with Constellation xarray data source.""" - def setup(self): + def setup_method(self): """Run before every method to create a clean testing setup.""" - self.rawInst = pysat.Instrument('pysat', 'testing_xarray', + self.rawInst = pysat.Instrument('pysat', 'ndtesting', clean_level='clean') self.rawInst.bounds = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 31)) @@ -142,7 +146,7 @@ def setup(self): return - def teardown(self): + def teardown_method(self): """Run after every method to clean up previous testing.""" del self.testInst, self.rawInst plt.close() diff --git a/requirements.txt b/requirements.txt index 6d818c0a..06f70e80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ matplotlib numpy pandas -pysat>=3.0.4 +pysat>=3.2.0 xarray diff --git a/setup.cfg b/setup.cfg index 6e0172f8..ccced987 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,71 +1,6 @@ -[metadata] -name = pysatSeasons -version = file: pysatSeasons/version.txt -url = https://github.com/pysat/pysatSeasons -author = Russell A. Stoneback, et al. -author_email = pysat.developers@gmail.com -description = 'Seasonal analysis routines for pysat' -keywords = - pysat - ionosphere - thermosphere - magnetosphere - average - analysis - season - climatology -classifiers = - Development Status :: 3 - Alpha - Topic :: Scientific/Engineering :: Astronomy - Topic :: Scientific/Engineering :: Physics - Topic :: Scientific/Engineering :: Atmospheric Science - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Natural Language :: English - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Operating System :: POSIX :: Linux - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft :: Windows - -license_file = LICENSE -long_description = file: README.md -long_description_content_type = text/markdown - -[options] -python_requires = >= 3.5 -setup_requires = - setuptools >= 38.6 - pip >= 10 -include_package_data = True -zip_safe = False -packages = find: -install_requires = - matplotlib - numpy - pandas - pysat - xarray - - -[coverage:report] - [flake8] max-line-length = 80 ignore = D200 D202 W503 - pysatSeasons/avg.py E501 - pysatSeasons/occur_prob.py E501 - pysatSeasons/plot.py E722 - -[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 diff --git a/setup.py b/setup.py deleted file mode 100644 index f54642fe..00000000 --- a/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2019, RS -# Full license can be found in License.md -# ----------------------------------------------------------------------------- - -"""Setup routine for pysatSeasons. - -Note ----- -package metadata stored in setup.cfg - -""" - -from setuptools import setup - - -setup() diff --git a/test_requirements.txt b/test_requirements.txt index 3e0b3a7b..64af4cd0 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -9,4 +9,4 @@ pytest-cov pytest-flake8 pytest-ordering sphinx -sphinx_rtd_theme +sphinx_rtd_theme>=1.2.2,<2.0.0