Skip to content

Commit

Permalink
CDF Data Interoperability (HERMES-SOC#56)
Browse files Browse the repository at this point in the history
This change adds modules and classes to enable the reading, writing, manipulation, visualization, and validation of HERMES CDF data.

The hermes_core.timedata.TimeData class provides a convenient and efficient way to work with HERMES science CDF data files. The point of this class is to simplify data management, enhances data discovery, and facilitates adherence to CDF standards.

closes:
HERMES-SOC#20 , HERMES-SOC#34 , HERMES-SOC#42 , HERMES-SOC#55

---------

Co-authored-by: Damian Barrous Dume <[email protected]>
Co-authored-by: Steven Christe <[email protected]>
Co-authored-by: Steven Christe <[email protected]>
Co-authored-by: Damian Barrous-Dume <[email protected]>
  • Loading branch information
5 people authored Jul 7, 2023
1 parent 42d379d commit 57981ea
Show file tree
Hide file tree
Showing 36 changed files with 3,445 additions and 156 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies, run tests, run linting, and test building docs
# This workflow will install Python dependencies, run tests, run linting, and build docs
name: Building Docs

on:
Expand All @@ -8,25 +8,19 @@ on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
container:
image: public.ecr.aws/w5r9l1c8/swsoc-docker-lambda-base:latest

runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[docs]'
- name: Build docs
run: sphinx-build docs docs/_build/html -W -b html
run: sphinx-build docs docs/_build/html -W -b html
20 changes: 5 additions & 15 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,18 @@ on:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: public.ecr.aws/w5r9l1c8/swsoc-docker-lambda-base:latest

runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[test]'
- name: Run tests
run: pytest --pyargs hermes_core --cov hermes_core
env:
PLATFORM: ${{ matrix.platform }}
PLATFORM: 'docker'
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3

uses: codecov/codecov-action@v3
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ target/

# Jupyter Notebook
.ipynb_checkpoints
*.ipynb

# IPython
profile_default/
Expand All @@ -84,6 +85,10 @@ ipython_config.py
# pyenv
.python-version

# pylint / pyreverse
*.dot
*.png

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand All @@ -109,6 +114,7 @@ venv/
ENV/
env.bak/
venv.bak/
.vscode/launch.json

# Spyder project settings
.spyderproject
Expand Down
22 changes: 19 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@ This project uses `semantic versioning <https://semver.org>`_.

Latest
======
* Fixed automatic version numbering using `setuptools-scm <https://pypi.org/project/setuptools-scm/>`_.
* Removed use of towncrier for CHANGELOG generation
* Moved to using pyproject.toml file
* Added data class to hold measurements and to save to CDF files

0.2.0 (2023-03-22)
==================
This release includes improvements tested in the second dataflow test. Since the last release, the improvements are as follows:

- Uses fstrings instead of the format syntax
- Adds a log message on import to show the version number of the package
- Documentation content and styling improvements
- Switches from using `setup.py` to `pyproject.toml` for package
- Bug fixes for supporting `pathlib`'s Path objects, and a permissions bug to the devcontainer

* Using f-strings and log on import by @ehsteve in https://github.com/HERMES-SOC/hermes_core/pull/28
* Added latest versions of python to testing by @ehsteve in https://github.com/HERMES-SOC/hermes_core/pull/29
* Add to the Documentation the location for where config files should be store (dynamically) by @dbarrous in https://github.com/HERMES-SOC/hermes_core/pull/35
* Fix devcontainer config to use new vscode user by @dbarrous in https://github.com/HERMES-SOC/hermes_core/pull/32
* Update to docs, added logo, updated theme colors and favicon by @ehsteve in https://github.com/HERMES-SOC/hermes_core/pull/37
* Fix to version number and move to pyproject.toml usage by @ehsteve in https://github.com/HERMES-SOC/hermes_core/pull/40
* Bug fix by @ehsteve in https://github.com/HERMES-SOC/hermes_core/pull/41


0.1.0 (2022-10-05)
Expand Down
10 changes: 10 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,15 @@ API Reference

.. automodapi:: hermes_core
:no-inheritance-diagram:
.. automodapi:: hermes_core.timedata
:no-inheritance-diagram:
.. automodapi:: hermes_core.util
:no-inheritance-diagram:
.. automodapi:: hermes_core.util.io
:no-inheritance-diagram:
.. automodapi:: hermes_core.util.schema
:no-inheritance-diagram:
.. automodapi:: hermes_core.util.util
:no-inheritance-diagram:
.. automodapi:: hermes_core.util.validation
:no-inheritance-diagram:
6 changes: 0 additions & 6 deletions docs/api/hermes_core.print_config.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.HERMESDeprecationWarning.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.HERMESPendingDeprecationWarning.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.HERMESUserWarning.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.HERMESWarning.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.warn_deprecated.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/hermes_core.util.warn_user.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.mathjax",
"matplotlib.sphinxext.plot_directive",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
]
Expand Down
12 changes: 6 additions & 6 deletions docs/dev-guide/code_standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Coding Style/Conventions
Private code
============

It is often useful to designate code as private, which means it is not part of the user facing API, only used internally by sunpy, and can be modified without a deprecation period.
It is often useful to designate code as private, which means it is not part of the user facing API, only used internally by HERMES, and can be modified without a deprecation period.
Any classes, functions, or variables that are private should either:

- Have an underscore as the first character of their name, e.g., ``_my_private_function``.
Expand All @@ -71,13 +71,13 @@ Formatting
We enforce a minimum level of code style with our continuous intergration.
This runs a tool called `pre-commit <https://pre-commit.com/>`__.

The settings and tools we use for the pre-commit can be found in the file :file:`.pre-commit-config.yaml` at the root of the sunpy git repository.
The settings and tools we use for the pre-commit can be found in the file :file:`.pre-commit-config.yaml` at the root of the HERMES git repository.
Some of the checks are:
* Checks (but doesn't fix) various PEP8 issues with flake8.
* Sort all imports in any Python files with isort.
* Remove any unused variables or imports with autoflake.

We suggest you use "tox" (which is used to run the sunpy test suite) to run these tools without having to setup anything within your own Python virtual environment::
We suggest you use "tox" (which is used to run the HERMES test suite) to run these tools without having to setup anything within your own Python virtual environment::

$ tox -e codestyle

Expand All @@ -91,7 +91,7 @@ Now you can do::

$ pre-commit run --all-files

which will run the tools on all files in the sunpy git repository.
which will run the tools on all files in the HERMES git repository.
The pre-commit tools can change some of the files, but in other cases it will report problems that require manual correction.
If the pre-commit tool changes any files, they will show up as new changes that will need to be committed.

Expand Down Expand Up @@ -165,8 +165,8 @@ Including C Code

* The use of `Cython`_ is strongly recommended for C extensions.

* If a C extension has a dependency on an external C library, the source code for the library should be bundled with sunpy, provided the license for the C library is compatible with the sunpy license.
Additionally, the package must be compatible with using a system-installed library in place of the library included in sunpy.
* If a C extension has a dependency on an external C library, the source code for the library should be bundled with the HERMES repository, provided the license for the C library is compatible with the HERMES license.
Additionally, the package must be compatible with using a system-installed library in place of the library included in HERMES.

* In cases where C extensions are needed but `Cython`_ cannot be used, the `PEP 7 Style Guide for C Code <https://www.python.org/dev/peps/pep-0007/>`_ is recommended.

Expand Down
4 changes: 2 additions & 2 deletions docs/dev-guide/maintainer_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Push to open pull request

Now you need to push the changes you have made to the code to the open pull request::

$ git push [email protected]:<username>/sunpy.git HEAD:<name of branch>
$ git push [email protected]:<username>/hermes_core.git HEAD:<name of branch>

You might have to add ``--force`` if you rebased instead of adding new commits.

Expand All @@ -122,7 +122,7 @@ Current labelling guidelines:
Updating and Maintaining the Changelog
======================================

The changelog will be read by users, so this description should be aimed at sunpy users instead of describing internal changes which are only relevant to the developers.
The changelog will be read by users, so this description should be aimed at HERMES users instead of describing internal changes which are only relevant to the developers.

The current changelog is kept in the file "CHANGELOG.rst" at the root of the repository.

Expand Down
4 changes: 2 additions & 2 deletions docs/dev-guide/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Testing Guidelines
This section describes the testing framework and format standards for tests.
Here we have heavily adapted the `Astropy version <https://docs.astropy.org/en/latest/development/testguide.html>`_, and **it is worth reading that link.**

The testing framework used by sunpy is the `pytest`_ framework, accessed through the ``pytest`` command.
The testing framework used by HERMES is the `pytest`_ framework, accessed through the ``pytest`` command.

.. _pytest: https://pytest.org/en/latest/

Expand Down Expand Up @@ -35,7 +35,7 @@ Where to put tests
Each package should include a suite of unit tests, covering as many of the public methods/functions as possible.
These tests should be included inside each package, e.g::

sunpy/map/tests/
hermes_core/util/tests/

"tests" directories should contain an ``__init__.py`` file so that the tests can be imported.

Expand Down
Binary file modified docs/logo/hermes_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/user-guide/customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The :file:`configrc` file

This package uses a :file:`configrc` configuration file to customize
certain properties. You can control a number of key features of such as
where your data will download to. sunpy looks for this configuration file
where your data will download to. HERMES packages look for this configuration file
in a platform specific directory, which you can see the path for by running::

>>> import hermes_core
Expand Down
3 changes: 2 additions & 1 deletion docs/user-guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ For more details checkout the :ref:`reference`.
:maxdepth: 2

Brief Tour <tour>
reading_writing_data
customization
logger
logger
6 changes: 3 additions & 3 deletions docs/user-guide/logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The logging system is an adapted version of `~astropy.logger.AstropyLogger`.
Its purpose is to provide users the ability to decide which log and warning messages to show,
to capture them, and to send them to a file.

All messages provided by sunpy use this logging facility which is based
All messages provided by HERMES use this logging facility which is based
on the Python `logging` module rather than print statements.

Messages can have one of several levels, in increasing order of importance:
Expand Down Expand Up @@ -54,7 +54,7 @@ This will display DEBUG and all messages with that level and above. If you'd lik
relevant messages you'd set the logging level to WARNING or above.

For other options such as whether to log to a file or what level of messages the log file should
contain, see the the Sunpy configuration file (:doc:`config </user-guide/customization>`).
contain, see the the HERMES configuration file (:doc:`config </user-guide/customization>`).

Context managers
================
Expand All @@ -69,7 +69,7 @@ Once your code is executed, ``log_list`` will be a Python list containing all of
This does not divert the messages from going to a file or to the screen.
It is also possible to send the messages to a custom file with::

>>> from sunpy import log
>>> from hermes_core import log
>>> with log.log_to_file('myfile.log'): #doctest: +SKIP
... # your code here #doctest: +SKIP

Expand Down
Loading

0 comments on commit 57981ea

Please sign in to comment.