diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..f711af7 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,18 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + apt_packages: + - graphviz + +sphinx: + configuration: docs/conf.py + +python: + install: + - method: pip + path: . + extra_requirements: + - doc diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..105f812 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +_autosummary/ +_build/ diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_static/.gitkeep b/docs/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/_templates/class_custom.rst b/docs/_templates/class_custom.rst new file mode 100644 index 0000000..ce53930 --- /dev/null +++ b/docs/_templates/class_custom.rst @@ -0,0 +1,40 @@ +{{ name | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ fullname }} + :members: + :show-inheritance: + :inherited-members: + :undoc-members: + :member-order: groupwise + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block methods %} + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block dia %} + .. rubric:: {{ _('Inheritance Diagram') }} + + .. inheritance-diagram:: {{ fullname }} + :parts: 1 + {% endblock %} + diff --git a/docs/_templates/function_custom.rst b/docs/_templates/function_custom.rst new file mode 100644 index 0000000..d9010b9 --- /dev/null +++ b/docs/_templates/function_custom.rst @@ -0,0 +1,5 @@ +{{ name | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autofunction:: {{ fullname }} \ No newline at end of file diff --git a/docs/_templates/module_custom.rst b/docs/_templates/module_custom.rst new file mode 100644 index 0000000..04b99cf --- /dev/null +++ b/docs/_templates/module_custom.rst @@ -0,0 +1,69 @@ +{{ name | escape | underline}} + +.. automodule:: {{ fullname }} + + {% block attributes %} + {% if attributes %} + .. rubric:: Module Attributes + + .. autosummary:: + :toctree: + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + + .. autosummary:: + :toctree: + :template: function_custom.rst + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + + .. autosummary:: + :toctree: + :template: class_custom.rst + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + + .. autosummary:: + :toctree: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block modules %} + {% if modules %} + .. rubric:: Modules + + .. autosummary:: + :toctree: + :template: module_custom.rst + :recursive: + {% for item in modules %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..a0338f1 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,98 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys + +package_path = os.path.abspath('../') +sys.path.insert(0, package_path) +os.environ['PYTHONPATH'] = ';'.join((package_path, os.environ.get('PYTHONPATH', ''))) + +# -- Project information ----------------------------------------------------- + +project = 'SDO' +copyright = '2024, Roy T. Smart' +author = 'Roy T. Smart' + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.napoleon', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.intersphinx', + 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.viewcode', + 'sphinxcontrib.bibtex', + 'jupyter_sphinx', +] +autosummary_generate = True # Turn on sphinx.ext.autosummary +autosummary_imported_members = True +autosummary_ignore_module_all = False +autodoc_typehints = "description" + +graphviz_output_format = 'png' +inheritance_graph_attrs = dict(rankdir='TB') + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# This pattern also affects html_static_path and html_extra_path. +# directories to ignore when looking for source files. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. + +html_theme = 'pydata_sphinx_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_theme_options = { + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/sun-data/solar-dynamics-observatory", + "icon": "fa-brands fa-github", + "type": "fontawesome", + }, + { + "name": "PyPI", + "url": "https://pypi.org/project/solar-dynamics-observatory", + "icon": "fa-brands fa-python", + }, + ], +} + +# https://github.com/readthedocs/readthedocs.org/issues/2569 +master_doc = 'index' + +bibtex_bibfiles = ['refs.bib'] +bibtex_default_style = 'plain' +bibtex_reference_style = 'author_year' + +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), + 'numpy': ('https://numpy.org/doc/stable/', None), + 'matplotlib': ('https://matplotlib.org/stable', None), + 'astropy': ('https://docs.astropy.org/en/stable/', None), + 'named_arrays': ('https://named-arrays.readthedocs.io/en/stable/', None) +} diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..ee8e3fc --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,44 @@ +Introduction +============ + +The `Solar Dynamics Observatory `_ (SDO) +:cite:p:`Pesnell2012` is a NASA satellite which has been continuously +observing the Sun since 2010. + +This Python package aims to represent SDO imagery using :mod:`named_arrays`, +a named tensor implementation with :class:`astropy.units.Quantity` support. + +Installation +============ + +This package is published to PyPI and can be installed using pip. + +.. code-block:: + + pip install solar-dynamics-observatory + +API Reference +============= + +.. autosummary:: + :toctree: _autosummary + :template: module_custom.rst + :recursive: + + sdo + + +Bibliography +============ + +.. bibliography:: + +| + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..922152e --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/refs.bib b/docs/refs.bib new file mode 100644 index 0000000..cde8560 --- /dev/null +++ b/docs/refs.bib @@ -0,0 +1,14 @@ +@ARTICLE{Pesnell2012, + author = {{Pesnell}, W. Dean and {Thompson}, B.~J. and {Chamberlin}, P.~C.}, + title = "{The Solar Dynamics Observatory (SDO)}", + journal = {\solphys}, + keywords = {SDO, Solar cycle, Helioseismology, Coronal, Space weather}, + year = 2012, + month = jan, + volume = {275}, + number = {1-2}, + pages = {3-15}, + doi = {10.1007/s11207-011-9841-3}, + adsurl = {https://ui.adsabs.harvard.edu/abs/2012SoPh..275....3P}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} diff --git a/sdo/__init__.py b/sdo/__init__.py index e69de29..cd618a2 100644 --- a/sdo/__init__.py +++ b/sdo/__init__.py @@ -0,0 +1,3 @@ +""" +Download and analyze SDO observations. +"""