Skip to content

Commit

Permalink
Add reference to Zinke DNB method
Browse files Browse the repository at this point in the history
Adds DOI role for sphinx documentation (copied from scipy)
  • Loading branch information
djhoese committed Nov 12, 2018
1 parent ab4d7d5 commit 1f7d9bf
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# 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.
sys.path.append(os.path.abspath('../../'))
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from satpy import __version__ # noqa


Expand Down Expand Up @@ -58,7 +59,7 @@ def __getattr__(cls, name):
# 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.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage',
'sphinx.ext.doctest', 'sphinx.ext.napoleon']
'sphinx.ext.doctest', 'sphinx.ext.napoleon', 'doi_role']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
52 changes: 52 additions & 0 deletions doc/source/doi_role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
"""
doilinks
~~~~~~~~~~~~~~~~~~~
Extension to add links to DOIs. With this extension you can use e.g.
:doi:`10.1016/S0022-2836(05)80360-2` in your documents. This will
create a link to a DOI resolver
(``https://doi.org/10.1016/S0022-2836(05)80360-2``).
The link caption will be the raw DOI.
You can also give an explicit caption, e.g.
:doi:`Basic local alignment search tool <10.1016/S0022-2836(05)80360-2>`.
:copyright: Copyright 2015 Jon Lund Steffensen. Based on extlinks by
the Sphinx team.
:license: BSD.
"""

from docutils import nodes, utils

from sphinx.util.nodes import split_explicit_title


def doi_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
has_explicit_title, title, part = split_explicit_title(text)
full_url = 'https://doi.org/' + part
if not has_explicit_title:
title = 'DOI:' + part
pnode = nodes.reference(title, title, internal=False, refuri=full_url)
return [pnode], []


def arxiv_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
has_explicit_title, title, part = split_explicit_title(text)
full_url = 'https://arxiv.org/abs/' + part
if not has_explicit_title:
title = 'arXiv:' + part
pnode = nodes.reference(title, title, internal=False, refuri=full_url)
return [pnode], []


def setup_link_role(app):
app.add_role('doi', doi_role)
app.add_role('DOI', doi_role)
app.add_role('arXiv', arxiv_role)
app.add_role('arxiv', arxiv_role)


def setup(app):
app.connect('builder-inited', setup_link_role)
return {'version': '0.1', 'parallel_read_safe': True}
9 changes: 6 additions & 3 deletions satpy/composites/viirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,13 @@ def _linear_normalization_from_0to1(


class NCCZinke(CompositeBase):
"""Equalized DNB composite using the Zinke algorithm.
"""Equalized DNB composite using the Zinke algorithm [#ncc1]_.
http://www.tandfonline.com/doi/full/10.1080/01431161.2017.1338838
DOI: 10.1080/01431161.2017.1338838
References:
.. [#ncc1] Stephan Zinke (2017),
A simplified high and near-constant contrast approach for the display of VIIRS day/night band imagery
:doi:`10.1080/01431161.2017.1338838`
"""

Expand Down

0 comments on commit 1f7d9bf

Please sign in to comment.