kconnour / pyRT_DISORT

A Python package for helping to compute input arrays to DISORT.
https://kconnour.github.io/pyRT_DISORT/
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

Add Github code to source #4

Closed kconnour closed 2 years ago

kconnour commented 2 years ago

Feature request: the "source" button at the function / class signature links to a rtd themed version of the code. It'd be great to link to the actual code on Github instead.

I tried to implement this but failed. However it appears that numpy was able to do this in their current version (v 1.21) of their docs.

kconnour commented 2 years ago

I'd also like to include pyplots. numpy and scipy seem to have figured out that one too but I haven't yet.

kconnour commented 2 years ago

I have a solution for the pyplots (this is mostly a note to myself). conf.py must include import matplotlib

and extensions must include to plot directive like so:

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'matplotlib.sphinxext.mathmpl',
    'matplotlib.sphinxext.plot_directive'
]

Then I can include plot directives anywhere with:

.. plot::

   import matplotlib.pyplot as plt
   import numpy as np
   x = np.linspace(0, 2*np.pi)
   plt.plot(x, np.sin(x))
   plt.show()

See this link for more info: https://matplotlib.org/sampledoc/extensions.html

kconnour commented 2 years ago

This will be addressed in the next update