Skip to content

Commit

Permalink
Merge pull request #4943 from dstansby/more-nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jan 31, 2021
2 parents df3a0c7 + 8c48e00 commit d2da151
Show file tree
Hide file tree
Showing 27 changed files with 57 additions and 58 deletions.
6 changes: 3 additions & 3 deletions docs/dev_guide/contents/code_standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Formatting
We enforce a minimum level of code style with our continuous intergration (the name is ``sunpy.sunpy (python_codestyle [linux]``).
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 `.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 sunpy 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.
Expand Down Expand Up @@ -146,7 +146,7 @@ Instead of running the pre-commit command each time you can install the git hook
$ pre-commit install
which installs a command to `.git/hooks/pre-commit` which will run these tools at the time you do ``git commit`` and means you don't have to run the first command each time.
which installs a command to :file:`.git/hooks/pre-commit` which will run these tools at the time you do ``git commit`` and means you don't have to run the first command each time.
We only suggest doing the install step if you are comfortable with git and the pre-commit tool.
Documentation and Testing
Expand Down Expand Up @@ -188,7 +188,7 @@ Any other standard output, warnings, and errors should follow these rules:
* For warnings, one should always use ``warnings.warn(message, warning_class)``.
These get redirected to ``log.warning()`` by default, but one can still use the standard warning-catching mechanism and custom warning classes.
The warning class should be either class:`~sunpy.utils.exceptions.SunPyUserWarning` or inherit from it.
The warning class should be either class:`~sunpy.util.SunpyUserWarning` or inherit from it.
Including C Code
================
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/contents/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ This is particularly useful if you need to cover multiple namespaces in which an

In rare circumstances, one may want to insert "raw" HTML directly into the pages written by Sphinx.
For HTML that is statically available (i.e., already written in some form), one can use the `"raw" directive <https://docutils.sourceforge.io/docs/ref/rst/directives.html#raw-data-pass-through>`__.
For HTML that is generated by Python code, SunPy provides the custom directive `generate`.
For HTML that is generated by Python code, SunPy provides the custom directive ``generate``.
Here's an example RST block::

.. generate:: html
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/contents/logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ A warning can be issued in the following way::
>>> from sunpy.util import SunpyUserWarning
>>> warnings.warn("You have been warned about something you did not do correctly.", SunpyUserWarning) # doctest: +IGNORE_WARNINGS

See the section above for a discussion about the distinction between `log.warn()` and `warnings.warn()`.
See the section above for a discussion about the distinction between ``log.warn()`` and :meth:`warnings.warn`.

Raising Exceptions
==================
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/contents/maintainer_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ You do not need to update this file as we use `towncrier`_ to update our changel
This is built and embedded into our documentation.

Towncrier will automatically reflow your text, so it will work best if you stick to a single paragraph, but multiple sentences and links are OK and encouraged.
You can install towncrier and then run `towncrier --draft` if you want to get a preview of how your change will look in the final release notes.
You can install towncrier and then run ``towncrier --draft`` if you want to get a preview of how your change will look in the final release notes.

`Instructions on how to write a changelog. <https://github.com/sunpy/sunpy/blob/master/changelog/README.rst>`__.

Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/contents/new_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The instrument subclass implements the instrument-specific code to parse the met

In practice, the instrument subclass is not directly accessed by users.
The `~sunpy.map.Map` factory is the primary interface for creating Map objects.
Any subclass of `~sunpy.map.GenericMap` which defines a method named `~sunpy.map.GenericMap.is_datasource_for` will automatically be registered with the `~sunpy.map.Map` factory.
Any subclass of `~sunpy.map.GenericMap` which defines a method named ``is_datasource_for()`` will automatically be registered with the `~sunpy.map.Map` factory.
The ``is_datasource_for`` method is used by the `~sunpy.map.Map` factory to check if a file should use a particular instrument Map class.
This function can run any test it needs to determine this.
For example, it might check the value of the ``INSTRUMENT`` key in the metadata dictionary.
Expand Down
4 changes: 2 additions & 2 deletions docs/dev_guide/contents/newcomers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ In order to start coding you will need a local Python environment and we would r
This method will bypass your operating system Python packages and makes the entire process easier.

The first step is to install the version of conda that corresponds to your operating system and `instructions are here`_.
Next we will want to setup the conda environment and we will need to add the `conda-forge_` channel as a prerequisite:
Next we will want to setup the conda environment and we will need to add the `conda-forge`_ channel as a prerequisite:

.. code:: bash
Expand Down Expand Up @@ -215,7 +215,7 @@ Once you have some changes you would like to submit, you will need to commit the
This is a three stage process:

1. Use ``git status`` to see that the only changes locally are the right ones.
2. Use ``git add <path to file>`` to add the changes to `git`.
2. Use ``git add <path to file>`` to add the changes to ``git``.
3. Use ``git commit -m <message>`` to label those changes.
4. Use ``git push`` to update your fork (copy) of sunpy on GitHub.

Expand Down
2 changes: 1 addition & 1 deletion docs/dev_guide/contents/remote_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The following example demonstates the usage of the fixture.::
sunpy_cache.add('http://example.com/test_file',
'test_data_path')

The above snippet creates a pytest fixture called `local_cache`. This fixture can be used in wherever the files have to be mocked.
The above snippet creates a pytest fixture called ``local_cache``. This fixture can be used in wherever the files have to be mocked.
An example is given below.::

def test_test_function(local_cache):
Expand Down
3 changes: 2 additions & 1 deletion docs/whatsnew/0.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ SunPy 0.9 brings improved support for downloading data from the JSOC and bugfixe
The 0.9.x series will be the last series of SunPy releases to support Python 2.
This is because Python 2 `will not be maintained after 2019 <https://python3statement.org/>`_.
The 0.9.x series will receive bugfixs only up until the and of life of Python 2 (around 18 months).
No new functionality will be added to the 0.9.x series, which will also be the last version to include `sunpy.spectra`, `sunpy.lightcurve` and `sunpy.wcs`, all of which were deprecated in 0.8.
No new functionality will be added to the 0.9.x series, which will also be the last version to include
``sunpy.spectra``, ``sunpy.lightcurve`` and ``sunpy.wcs``, all of which were deprecated in 0.8.

SunPy 1.0 and higher will support Python 3 only.
All new functionality will be available only in SunPy 1.0 and higher.
Expand Down
16 changes: 8 additions & 8 deletions docs/whatsnew/1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ SunPy 1.1 provides a data manager for versioning and caching remote files.
The objective of this is to provide a way for data required for functions, such as instrument correction routines, to depend on non-local data in a reliable way.
The data manager also guarantees that a specific version of the code uses a specific data file, with the ability for users to specify updated files.

This works by providing the URL of a remote file and a SHA256 hash to the `sunpy.data.manager.require <sunpy.data.data_manager.Manager.require>` decorator which can be added to functions that require these specific data files from remote sources.
This works by providing the URL of a remote file and a SHA256 hash to the `sunpy.data.manager.require <sunpy.data.data_manager.DataManager.require>` decorator which can be added to functions that require these specific data files from remote sources.
If the specified hash does not match that of the remote version, an exception is raised to make the user aware of any changes on the remote server or corruption of local files.
Additionally, `sunpy.data.cache <sunpy.data.data_manager.Cache>` can be used to avoid re-downloading files that already exist on a user's local machine, thus saving disk space and internet bandwidth.

Expand All @@ -153,7 +153,7 @@ Support for SUVI Data
=====================

The Solar Ultraviolet Imager (SUVI) is a EUV instrument imaging the full disk of the Sun in six passbands, and is onboard the latest of the Geostationary Operational Environmental Satellite (GOES) missions.
`~sunpy.map.SUVIMap` provides SunPy map support for loading SUVI FITS image data, and the `~sunpy.net.sources.goes.SUVIClient` adds support to search for SUVI data hosted by NOAA via `Fido <sunpy.net.fido_factory.UnifiedDownloader>`. It supports searching for wavelength, level of data (level 2 data which consists of stacked level 1b images and original level 1b files), as well as GOES satellite number (>= GOES 16).
`~sunpy.map.sources.SUVIMap` provides SunPy map support for loading SUVI FITS image data, and the `~sunpy.net.dataretriever.SUVIClient` adds support to search for SUVI data hosted by NOAA via `Fido <sunpy.net.fido_factory.UnifiedDownloaderFactory>`. It supports searching for wavelength, level of data (level 2 data which consists of stacked level 1b images and original level 1b files), as well as GOES satellite number (>= GOES 16).

.. _whatsnew-1.1-WISPR:

Expand Down Expand Up @@ -183,22 +183,22 @@ We will continue to look for ways to improve import times.
Notable Breaking Changes or Removed functionality
=================================================

- Importing `sunpy.timeseries.timeseriesbase` no longer automatically imports
- Importing `sunpy.timeseries` no longer automatically imports
Matplotlib. (`#3376 <https://github.com/sunpy/sunpy/pull/3376>`__)
- `NOAAIndicesTimeSeries.peek` now checks that the `type` argument is a
- `sunpy.timeseries.sources.NOAAIndicesTimeSeries.peek` now checks that the `type` argument is a
valid string, and raises a `ValueError` if it isn't. (`#3378 <https://github.com/sunpy/sunpy/pull/3378>`__)
- Observer-based coordinate frames (`~sunpy.coordinates.frames.Heliocentric` and `~sunpy.coordinates.frames.Helioprojective`) no longer assume a default observer (Earth) if no observer is specified. These frames can now be used with no observer specified, but most transformations cannot be performed for such frames. This removal of a default observer only affects `sunpy.coordinates`, and has no impact on the default observer in `sunpy.map`. (`#3388 <https://github.com/sunpy/sunpy/pull/3388>`__)
- The colormap stored in SunPy's Map subclasses (ie. ``map.plot_settings['cmap']``)
can now be colormap string instead of the full `matplotlib.colormap.Colormap`
object. To get the full `Colormap` object use the new attribute
can now be colormap string instead of the full `matplotlib.colors.Colormap`
object. To get the full `~matplotlib.colors.Colormap` object use the new attribute
``map.cmap``. (`#3412 <https://github.com/sunpy/sunpy/pull/3412>`__)
- Fix a warning in `sunpy.map.GenericMap.rotate` where the truth value of an array
was being calculated. This changes the behavior of
`~sunpy.map.GenericMap.rotate` when the ``angle=`` parameter is not an
`~astropy.units.Quantity` object to raise `TypeError` rather than `ValueError`. (`#3456 <https://github.com/sunpy/sunpy/pull/3456>`__)
- Removed the step of repairing images (replacing non-finite entries with local mean) before coaligning them. The user is expected to do this themselves before coaligning images. If NaNs/non-finite entries are present, a warning is thrown.
The function `sunpy.image.coalignment.repair_image_nonfinite` is deprecated. (`#3287 <https://github.com/sunpy/sunpy/pull/3287>`__)
- The method to convert a `~sunpy.coordinates.frames.Helioprojective` frame from 2D to 3D has been renamed from `~sunpy.coordinates.frames.Helioprojective.calculate_distance` to `~sunpy.coordinates.frames.Helioprojective.make_3d`. This method is not typically directly called by users. (`#3389 <https://github.com/sunpy/sunpy/pull/3389>`__)
The function ``sunpy.image.coalignment.repair_image_nonfinite`` is deprecated. (`#3287 <https://github.com/sunpy/sunpy/pull/3287>`__)
- The method to convert a `~sunpy.coordinates.frames.Helioprojective` frame from 2D to 3D has been renamed from ``sunpy.coordinates.frames.Helioprojective.calculate_distance`` to `~sunpy.coordinates.frames.Helioprojective.make_3d`. This method is not typically directly called by users. (`#3389 <https://github.com/sunpy/sunpy/pull/3389>`__)
- `sunpy.visualization.animator.ImageAnimatorWCS` is now deprecated in favour of
`~sunpy.visualization.animator.ArrayAnimatorWCS`. (`#3407 <https://github.com/sunpy/sunpy/pull/3407>`__)
- ``sunpy.cm`` has been moved to `sunpy.visualization.colormaps` and will be
Expand Down
12 changes: 6 additions & 6 deletions docs/whatsnew/2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ So now you can do the following instead::
aiaprep is now deprecated
=========================

With the release of the new `aiapy <https://aiapy.readthedocs.io>`__ package, `sunpy.instr.aia.aiaprep` will be removed in version 2.1.
Equivalent functionality is provided by the `register` function in aiapy. For more
With the release of the new `aiapy <https://aiapy.readthedocs.io>`__ package, ``sunpy.instr.aia.aiaprep`` will be removed in version 2.1.
Equivalent functionality is provided by the ``register()`` function in aiapy. For more
details, see the `example on registering and aligning level 1 AIA images <https://aiapy.readthedocs.io/en/latest/generated/gallery/prepping_level_1_data.html>`_
in the aiapy documentation.

Expand All @@ -81,7 +81,7 @@ In particular:
- `sunpy.map.GenericMap.reference_pixel` now returns a zero-based reference pixel.
This is one pixel less than the previously returned value.
Note that this means the ``reference_pixel`` now does **not** have the same value as the FITS ``CRPIX`` values, which are one-based indices.
- `sunpy.map.make_fitswcs_header` now correctly interprets the `reference_pixel` argument as being zero-based, in previous releases it incorrectly interpreted the `reference_pixel` as one-based
- `sunpy.map.make_fitswcs_header` now correctly interprets the ``reference_pixel`` argument as being zero-based, in previous releases it incorrectly interpreted the ``reference_pixel`` as one-based.

Standardization of `~sunpy.map.GenericMap.submap` and `~sunpy.map.GenericMap.draw_rectangle`
============================================================================================
Expand Down Expand Up @@ -171,9 +171,9 @@ Download behind proxies

With the release of parfive 1.1, sunpy has been patched to be able to utilize proxy servers when downloading files.

* Proxy URL is read from the environment variables `HTTP_PROXY` or `HTTPS_PROXY`.
* Proxy Authentication `proxy_auth` should be passed as a `aiohttp.BasicAuth` object, explicitly by the user.
* Proxy Headers `proxy_headers` should be passed as `dict` object, explicitly by the user.
* Proxy URL is read from the environment variables ``HTTP_PROXY`` or ``HTTPS_PROXY``.
* Proxy Authentication ``proxy_auth`` should be passed as a `aiohttp.BasicAuth` object, explicitly by the user.
* Proxy Headers ``proxy_headers`` should be passed as `dict` object, explicitly by the user.

For example if you use a bash terminal:

Expand Down
8 changes: 3 additions & 5 deletions sunpy/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,17 +845,15 @@ def download_from_hek_query_result(self, query_result, client=None, path=None, p
def download_from_vso_query_result(self, query_result, client=None,
path=None, progress=False,
ignore_already_added=False, overwrite=False):
"""download(query_result, client=sunpy.net.vso.VSOClient(),
path=None, progress=False, ignore_already_added=False)
"""
Add new database entries from a VSO query result and download the
corresponding data files. See :meth:`sunpy.database.Database.download`
for information about the caching mechanism used and about the
parameters ``client``, ``path``, ``progress``.
Parameters
----------
query_result : sunpy.net.vso.QueryResponse
query_result : sunpy.net.vso.VSOQueryResponseTable
A VSO query response that was returned by the ``query`` method of a
:class:`sunpy.net.vso.VSOClient` object.
Expand All @@ -875,7 +873,7 @@ def add_from_vso_query_result(self, query_result,
Parameters
----------
query_result : sunpy.net.vso.QueryResponse
query_result : sunpy.net.vso.VSOQueryResponseTable
A VSO query response that was returned by the ``query`` method of a
:class:`sunpy.net.vso.VSOClient` object.
Expand Down
2 changes: 1 addition & 1 deletion sunpy/map/header_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def make_fitswcs_header(data, coordinate,
data : `~numpy.ndarray` or `tuple`
Array data of Map for which a header is required, or the shape of the
data array (in numpy order, i.e. ``(y_size, x_size)``).
coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseFrame`
coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`
The coordinate of the reference pixel.
reference_pixel :`~astropy.units.Quantity` of size 2, optional
Reference pixel along each axis. These are expected to be Cartestian ordered, i.e
Expand Down
12 changes: 6 additions & 6 deletions sunpy/map/mapbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def wcs(self):
@property
def coordinate_frame(self):
"""
An `astropy.coordinates.BaseFrame` instance created from the coordinate
An `astropy.coordinates.BaseCoordinateFrame` instance created from the coordinate
information for this Map, or None if the frame cannot be determined.
"""
try:
Expand Down Expand Up @@ -1148,7 +1148,7 @@ def world_to_pixel(self, coordinate, origin=None):
Parameters
----------
coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseFrame`
coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseCoordinateFrame`
The coordinate object to convert to pixel coordinates.
origin : int
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def rotate(self, angle: u.deg = None, rmatrix=None, order=4, scale=1.0,
----------
angle : `~astropy.units.Quantity`
The angle (degrees) to rotate counterclockwise.
rmatrix : ndarray
rmatrix : array-like
2x2 linear transformation rotation matrix.
order : int
Interpolation order to be used. Must be in the range 0-5.
Expand Down Expand Up @@ -1356,8 +1356,8 @@ def rotate(self, angle: u.deg = None, rmatrix=None, order=4, scale=1.0,
See Also
--------
sunpy.image.transform.affine_transform : The routine this method calls
for the rotation.
sunpy.image.transform.affine_transform :
The routine this method calls for the rotation.
Notes
-----
Expand Down Expand Up @@ -1503,7 +1503,7 @@ def submap(self, bottom_left, *, top_right=None, width: (u.deg, u.pix) = None, h
The bottom-left coordinate of the rectangle. If a `~astropy.coordinates.SkyCoord` it can
have shape ``(2,)`` and simultaneously define ``top_right``. If specifying
pixel coordinates it must be given as an `~astropy.units.Quantity`
object with units of `~astropy.units.pix`.
object with units of `~astropy.units.si.pix`.
top_right : `astropy.units.Quantity` or `~astropy.coordinates.SkyCoord`, optional
The top-right coordinate of the rectangle. If ``top_right`` is
specified ``width`` and ``height`` must be omitted.
Expand Down
2 changes: 1 addition & 1 deletion sunpy/map/mapsequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def peek(self, resample=None, **kwargs):
Parameters
----------
fig: matplotlib.Figure
fig: matplotlib.figure.Figure
Figure to use to create the explorer
resample: list
Expand Down

0 comments on commit d2da151

Please sign in to comment.