Commit ace58201 authored by Ole Streicher's avatar Ole Streicher

New upstream version 0.8.5

parent 80603889
0.8.4 (Unreleased)
==================
0.8.5
=====
Bug Fixes
---------
- Removed AstropyDeprecationWarning from sunpy.coordinates.representation [#2476]
- Fix for NorthOffsetFrame under Astropy 3.0 [#2486]
- Fix lightcurve tests under numpy dev [#2505]
- Updated depecration link of radiospectra [#2481]
- Fixed Padding values in some of the documentation pages [#2497]
- Move documentation build to circleci [#2509]
- Fix Issue #2470 hgs_to_hcc(heliogcoord, heliocframe) [#2502]
- Fixing CompositeMap object so that it respects masked maps [#2492]
0.8.4
=====
Bug Fixes
---------
......
Metadata-Version: 1.1
Name: sunpy
Version: 0.8.4
Version: 0.8.5
Summary: SunPy: Python for Solar Physics
Home-page: http://sunpy.org/
Author: The SunPy Community
......
......@@ -137,7 +137,6 @@ import pkg_resources
from setuptools import Distribution
from setuptools.package_index import PackageIndex
from setuptools.sandbox import run_setup
from distutils import log
from distutils.debug import DEBUG
......@@ -464,9 +463,10 @@ class _Bootstrapper(object):
# setup.py exists we can generate it
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
with _silence():
run_setup(os.path.join(path, 'setup.py'),
['egg_info'])
# We use subprocess instead of run_setup from setuptools to
# avoid segmentation faults - see the following for more details:
# https://github.com/cython/cython/issues/2104
sp.check_output([sys.executable, 'setup.py', 'egg_info'], cwd=path)
for dist in pkg_resources.find_distributions(path, True):
# There should be only one...
......
astropy-helpers Changelog
*************************
2.0.6 (2018-02-24)
------------------
- Avoid deprecation warning due to ``exclude=`` keyword in ``setup.py``. [#379]
2.0.5 (2018-02-22)
------------------
- Fix segmentation faults that occurred when the astropy-helpers submodule
was first initialized in packages that also contained Cython code. [#375]
2.0.4 (2018-02-09)
------------------
......
......@@ -142,7 +142,6 @@ import pkg_resources
from setuptools import Distribution
from setuptools.package_index import PackageIndex
from setuptools.sandbox import run_setup
from distutils import log
from distutils.debug import DEBUG
......@@ -486,9 +485,10 @@ class _Bootstrapper(object):
# setup.py exists we can generate it
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
with _silence():
run_setup(os.path.join(path, 'setup.py'),
['egg_info'])
# We use subprocess instead of run_setup from setuptools to
# avoid segmentation faults - see the following for more details:
# https://github.com/cython/cython/issues/2104
sp.check_output([sys.executable, 'setup.py', 'egg_info'], cwd=path)
for dist in pkg_resources.find_distributions(path, True):
# There should be only one...
......
......@@ -127,7 +127,10 @@ class AstropyBuildDocs(SphinxBuildDoc):
build_cmd_path = os.path.abspath(build_cmd.build_lib)
ah_importer = pkgutil.get_importer('astropy_helpers')
ah_path = os.path.abspath(ah_importer.path)
if ah_importer is None:
ah_path = '.'
else:
ah_path = os.path.abspath(ah_importer.path)
# Now generate the source for and spawn a new process that runs the
# command. This is needed to get the correct imports for the built
......
# This file contains settings for pytest that are specific to astropy-helpers.
# Since we run many of the tests in sub-processes, we need to collect coverage
# data inside each subprocess and then combine it into a single .coverage file.
# To do this we set up a list which run_setup appends coverage objects to.
# This is not intended to be used by packages other than astropy-helpers.
import os
from collections import defaultdict
try:
from coverage import CoverageData
except ImportError:
HAS_COVERAGE = False
else:
HAS_COVERAGE = True
if HAS_COVERAGE:
SUBPROCESS_COVERAGE = []
def pytest_configure(config):
if HAS_COVERAGE:
SUBPROCESS_COVERAGE[:] = []
def pytest_unconfigure(config):
if HAS_COVERAGE:
# We create an empty coverage data object
combined_cdata = CoverageData()
lines = defaultdict(list)
for cdata in SUBPROCESS_COVERAGE:
# For each CoverageData object, we go through all the files and
# change the filename from one which might be a temporary path
# to the local filename. We then only keep files that actually
# exist.
for filename in cdata.measured_files():
try:
pos = filename.rindex('astropy_helpers')
except ValueError:
continue
short_filename = filename[pos:]
if os.path.exists(short_filename):
lines[os.path.abspath(short_filename)].extend(cdata.lines(filename))
combined_cdata.add_lines(lines)
combined_cdata.write_file('.coverage.subprocess')
......@@ -141,7 +141,7 @@ def add_exclude_packages(excludes):
"add_package_excludes must be called before all other setup helper "
"functions in order to properly handle excluded packages")
_module_state['exclude_packages'].add(set(excludes))
_module_state['exclude_packages'].update(set(excludes))
def register_commands(package, version, release, srcdir='.'):
......
......@@ -2,11 +2,15 @@ import os
import subprocess as sp
import sys
from setuptools import sandbox
import pytest
from ..utils import extends_doc
try:
from coverage import CoverageData
except ImportError:
HAS_COVERAGE = False
else:
HAS_COVERAGE = True
from ..conftest import SUBPROCESS_COVERAGE
PACKAGE_DIR = os.path.dirname(__file__)
......@@ -39,19 +43,41 @@ def run_cmd(cmd, args, path=None, raise_error=True):
return streams + (return_code,)
@extends_doc(sandbox.run_setup)
def run_setup(*args, **kwargs):
"""
In Python 3, on MacOS X, the import cache has to be invalidated otherwise
new extensions built with ``run_setup`` do not always get picked up.
"""
def run_setup(setup_script, args):
# This used to call setuptools.sandbox's run_setup, but due to issues with
# this and Cython (which caused segmentation faults), we now use subprocess.
setup_script = os.path.abspath(setup_script)
path = os.path.dirname(setup_script)
setup_script = os.path.basename(setup_script)
if HAS_COVERAGE:
# In this case, we run the command using the coverage command and we
# then collect the coverage data into a SUBPROCESS_COVERAGE list which
# is set up at the start of the testing process and is then combined
# into a single .coverage file at the end of the testing process.
p = sp.Popen(['coverage', 'run', setup_script] + list(args), cwd=path,
stdout=sp.PIPE, stderr=sp.PIPE)
stdout, stderr = p.communicate()
try:
return sandbox.run_setup(*args, **kwargs)
finally:
if sys.version_info[:2] >= (3, 3):
import importlib
importlib.invalidate_caches()
cdata = CoverageData()
cdata.read_file(os.path.join(path, '.coverage'))
SUBPROCESS_COVERAGE.append(cdata)
else:
# Otherwise we just run the tests with Python
p = sp.Popen([sys.executable, setup_script] + list(args), cwd=path,
stdout=sp.PIPE, stderr=sp.PIPE)
stdout, stderr = p.communicate()
sys.stdout.write(stdout.decode('utf-8'))
sys.stderr.write(stderr.decode('utf-8'))
@pytest.fixture(scope='function', autouse=True)
......@@ -85,23 +111,6 @@ def reset_distutils_log():
log.set_threshold(log.WARN)
@pytest.fixture(scope='module', autouse=True)
def fix_hide_setuptools():
"""
Workaround for https://github.com/astropy/astropy-helpers/issues/124
In setuptools 10.0 run_setup was changed in such a way that it sweeps
away the existing setuptools import before running the setup script. In
principle this is nice, but in the practice of testing astropy_helpers
this is problematic since we're trying to test code that has already been
imported during the testing process, and which relies on the setuptools
module that was already in use.
"""
if hasattr(sandbox, 'hide_setuptools'):
sandbox.hide_setuptools = lambda: None
TEST_PACKAGE_SETUP_PY = """\
#!/usr/bin/env python
......
......@@ -7,6 +7,7 @@ omit =
astropy_helpers/extern/*
astropy_helpers/extern/*/*
astropy_helpers/tests/*
astropy_helpers/conftest.py
*/test_pkg/*
[report]
......
......@@ -9,7 +9,7 @@ import tarfile
import pytest
from warnings import catch_warnings
from . import reset_setup_helpers, reset_distutils_log, fix_hide_setuptools # noqa
from . import reset_setup_helpers, reset_distutils_log # noqa
from . import run_cmd, run_setup, cleanup_import
from astropy_helpers.git_helpers import get_git_devstr
......@@ -24,16 +24,20 @@ else:
_DEV_VERSION_RE = re.compile(r'\d+\.\d+(?:\.\d+)?\.dev(\d+)')
ASTROPY_HELPERS_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
TEST_VERSION_SETUP_PY = """\
#!/usr/bin/env python
import sys
from setuptools import setup
NAME = 'apyhtest_eva'
VERSION = {version!r}
RELEASE = 'dev' not in VERSION
sys.path.insert(0, r'{astropy_helpers_path}')
from astropy_helpers.git_helpers import get_git_devstr
from astropy_helpers.version_helpers import generate_version_py
......@@ -60,7 +64,8 @@ def version_test_package(tmpdir, request):
def make_test_package(version='42.42.dev'):
test_package = tmpdir.mkdir('test_package')
test_package.join('setup.py').write(
TEST_VERSION_SETUP_PY.format(version=version))
TEST_VERSION_SETUP_PY.format(version=version,
astropy_helpers_path=ASTROPY_HELPERS_PATH))
test_package.mkdir('apyhtest_eva').join('__init__.py').write(TEST_VERSION_INIT)
with test_package.as_cwd():
run_cmd('git', ['init'])
......
......@@ -4,11 +4,12 @@
import ah_bootstrap
import pkg_resources
from setuptools import setup
from astropy_helpers.setup_helpers import register_commands, get_package_info
from astropy_helpers.setup_helpers import (register_commands, get_package_info,
add_exclude_packages)
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_helpers'
VERSION = '2.0.4'
VERSION = '2.0.6'
RELEASE = 'dev' not in VERSION
generate_version_py(NAME, VERSION, RELEASE, False, uses_git=not RELEASE)
......@@ -16,6 +17,7 @@ generate_version_py(NAME, VERSION, RELEASE, False, uses_git=not RELEASE)
# Use the updated version including the git rev count
from astropy_helpers.version import version as VERSION
add_exclude_packages(['astropy_helpers.tests'])
cmdclass = register_commands(NAME, VERSION, RELEASE)
# This package actually doesn't use the Astropy test command
del cmdclass['test']
......@@ -46,5 +48,5 @@ setup(
],
cmdclass=cmdclass,
zip_safe=False,
**get_package_info(exclude=['astropy_helpers.tests'])
**get_package_info()
)
......@@ -15,7 +15,7 @@ show-response = 1
[tool:pytest]
minversion = 3.0
testpaths = "sunpy" "docs"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "astropy_helpers"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "astropy_helpers" "examples"
doctest_plus = enabled
addopts = -p no:warnings --doctest-rst
markers =
......
......@@ -53,7 +53,7 @@ LONG_DESCRIPTION = "SunPy is a Python library for solar physics data analysis."
builtins._ASTROPY_PACKAGE_NAME_ = PACKAGENAME
# VERSION should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
VERSION = '0.8.4'
VERSION = '0.8.5'
# Indicates if this version is a release version
RELEASE = 'dev' not in VERSION
......
......@@ -6,18 +6,25 @@ representation classes, primarily for use with the Helioprojective coordinate
system, due to the convention of Longitude going from -180 to 180 degrees.
"""
from __future__ import absolute_import, division
from collections import OrderedDict
import warnings
from astropy.utils.exceptions import AstropyDeprecationWarning
from astropy import units as u
from astropy.coordinates.representation import (SphericalRepresentation,
UnitSphericalRepresentation,
CartesianRepresentation)
UnitSphericalRepresentation,
CartesianRepresentation)
from astropy.coordinates import Longitude, Latitude
__all__ = ['Longitude180', 'SphericalWrap180Representation',
'UnitSphericalWrap180Representation']
'UnitSphericalWrap180Representation']
class Longitude180(Longitude):
......@@ -59,61 +66,67 @@ class Longitude180(Longitude):
return self
class UnitSphericalWrap180Representation(UnitSphericalRepresentation):
"""
Representation of points in 3D Spherical coordinates.
This representation allows for a negative Longitude.
It does so by setting wrap_angle=180 degrees.
with warnings.catch_warnings():
warnings.simplefilter('ignore', AstropyDeprecationWarning)
Parameters
----------
lon, lat: `~astropy.units.Quantity`
The longitude and latitude of the point(s) in angular units. The
latitude should be between -90 and +90 degrees, and the longitude
is allowed to have any value between -180 to 180 degrees. These
can also be instances of `~astropy.units.Angle`,
`~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.
distance: `~astropy.units.Quantity`
The distance to the point(s). If the distance is a length, it is
passed to the :class:`~astropy.coordinates.Distance` class, else
it is passed to the :class:`~astropy.units.Quantity` class.
copy: bool, optional
If True, arrays will be copied rather than referenced.
"""
attr_classes = OrderedDict([('lon', Longitude180), ('lat', Latitude)])
recommended_units = {'lon': u.deg, 'lat': u.deg}
class UnitSphericalWrap180Representation(UnitSphericalRepresentation):
"""
Representation of points in 3D Spherical coordinates.
This representation allows for a negative Longitude.
It does so by setting wrap_angle=180 degrees.
Parameters
----------
lon, lat: `~astropy.units.Quantity`
The longitude and latitude of the point(s) in angular units. The
latitude should be between -90 and +90 degrees, and the longitude
is allowed to have any value between -180 to 180 degrees. These
can also be instances of `~astropy.units.Angle`,
`~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.
class SphericalWrap180Representation(SphericalRepresentation):
"""
Representation of points in 3D Spherical coordinates.
This representation allows for a negative Longitude.
It does so by setting wrap_angle=180 degrees.
distance: `~astropy.units.Quantity`
The distance to the point(s). If the distance is a length, it is
passed to the :class:`~astropy.coordinates.Distance` class, else
it is passed to the :class:`~astropy.units.Quantity` class.
Parameters
----------
lon, lat: `~astropy.units.Quantity`
The longitude and latitude of the point(s) in angular units. The
latitude should be between -90 and +90 degrees, and the longitude
is allowed to have any value between -180 to 180 degrees. These
can also be instances of `~astropy.units.Angle`,
`~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.
distance: `~astropy.units.Quantity`
The distance to the point(s). If the distance is a length, it is
passed to the :class:`~astropy.coordinates.Distance` class, else
it is passed to the :class:`~astropy.units.Quantity` class.
copy: bool, optional
If True, arrays will be copied rather than referenced.
"""
copy: bool, optional
If True, arrays will be copied rather than referenced.
"""
attr_classes = OrderedDict([('lon', Longitude180), ('lat', Latitude)])
recommended_units = {'lon': u.deg, 'lat': u.deg}
class SphericalWrap180Representation(SphericalRepresentation):
"""
Representation of points in 3D Spherical coordinates.
This representation allows for a negative Longitude.
It does so by setting wrap_angle=180 degrees.
Parameters
----------
lon, lat: `~astropy.units.Quantity`
The longitude and latitude of the point(s) in angular units. The
latitude should be between -90 and +90 degrees, and the longitude
is allowed to have any value between -180 to 180 degrees. These
can also be instances of `~astropy.units.Angle`,
`~astropy.coordinates.Longitude`, or `~astropy.coordinates.Latitude`.
distance: `~astropy.units.Quantity`
The distance to the point(s). If the distance is a length, it is
passed to the :class:`~astropy.coordinates.Distance` class, else
it is passed to the :class:`~astropy.units.Quantity` class.
copy: bool, optional
If True, arrays will be copied rather than referenced.
"""
attr_classes = OrderedDict([('lon', Longitude180), ('lat', Latitude),
('distance', u.Quantity)])
recommended_units = {'lon': u.deg, 'lat': u.deg}
_unitrep = UnitSphericalWrap180Representation
attr_classes = OrderedDict([('lon', Longitude180), ('lat', Latitude),
('distance', u.Quantity)])
recommended_units = {'lon': u.deg, 'lat': u.deg}
_unitrep = UnitSphericalWrap180Representation
......@@ -32,6 +32,9 @@ from .representation import SphericalWrap180Representation
from .frames import (HeliographicStonyhurst, HeliographicCarrington,
Heliocentric, Helioprojective)
from sunpy.sun import sun
RSUN_METERS = sun.constants.get('radius').si.to(u.m)
__all__ = ['hgs_to_hgc', 'hgc_to_hgs', 'hcc_to_hpc',
'hpc_to_hcc', 'hcc_to_hgs', 'hgs_to_hcc',
'hpc_to_hpc',
......@@ -176,11 +179,14 @@ def hcc_to_hgs(helioccoord, heliogframe):
Heliocentric)
def hgs_to_hcc(heliogcoord, heliocframe):
"""
Convert from Heliographic Stonyhurst to Heliograpic Carrington.
Convert from Heliographic Stonyhurst to Heliocentric Cartesian.
"""
hglon = heliogcoord.lon
hglat = heliogcoord.lat
r = heliogcoord.radius.to(u.m)
r = heliogcoord.radius
if r.unit is u.one and quantity_allclose(r, 1*u.one):
r = np.ones_like(r)
r *= RSUN_METERS
if heliocframe.obstime is None:
heliocframe._obstime = heliogcoord.obstime
......
......@@ -97,7 +97,7 @@ class CompositeOperation(DatabaseOperation):
for operation in self._operations:
# FIXME: What follows is the worst hack of my life. Enjoy.
# Without it, the test test_clear_database would fail.
f = open(os.devnull, 'w'); f.write(repr(operation)); f.flush()
f = open(os.devnull, 'w'); f.write(repr(operation)); f.flush(); f.close()
operation()
def undo(self):
......
......@@ -368,9 +368,9 @@ def _goes_chianti_tem(longflux, shortflux, satellite=8,
... date='2014-04-16',
... abundances="coronal") # doctest: +REMOTE_DATA
>>> temp # doctest: +REMOTE_DATA
<Quantity [ 11.28295376, 11.28295376] MK>
<Quantity [11.28295376, 11.28295376] MK>
>>> em # doctest: +REMOTE_DATA
<Quantity [ 4.78577516e+48, 4.78577516e+48] 1 / cm3>
<Quantity [4.78577516e+48, 4.78577516e+48] 1 / cm3>
"""
if not download_dir:
......@@ -506,7 +506,7 @@ def _goes_get_chianti_temp(fluxratio, satellite=8, abundances="coronal",
>>> temp = _goes_get_chianti_temp(fluxratio, satellite=15,
... abundances="coronal") # doctest: +REMOTE_DATA
>>> temp # doctest: +REMOTE_DATA
<Quantity [ 12.27557778, 12.27557778] MK>
<Quantity [12.27557778, 12.27557778] MK>
"""
if not download_dir:
......@@ -662,7 +662,7 @@ def _goes_get_chianti_em(longflux, temp, satellite=8, abundances="coronal",
>>> em = _goes_get_chianti_em(longflux, temp, satellite=15,
... abundances="coronal") # doctest: +REMOTE_DATA
>>> em # doctest: +REMOTE_DATA
<Quantity [ 3.45200672e+48, 3.45200672e+48] 1 / cm3>
<Quantity [3.45200672e+48, 3.45200672e+48] 1 / cm3>
"""
if not download_dir:
......@@ -942,7 +942,7 @@ def _calc_rad_loss(temp, em, obstime=None, force_download=False,
>>> em = Quantity([4.0e+48, 4.0e+48], unit="cm**(-3)")
>>> rad_loss = _calc_rad_loss(temp, em) # doctest: +REMOTE_DATA
>>> rad_loss["rad_loss_rate"] # doctest: +REMOTE_DATA
<Quantity [ 3.01851392e+19, 3.01851392e+19] J / s>
<Quantity [3.01851392e+19, 3.01851392e+19] J / s>
"""
if not download_dir:
download_dir = get_and_create_download_dir()
......@@ -1171,15 +1171,15 @@ def _goes_lx(longflux, shortflux, obstime=None, date=None):
... datetime(2014,1,1,0,0,10),], dtype=object)
>>> lx_out = _goes_lx(longflux, shortflux, obstime) # doctest: +REMOTE_DATA
>>> lx_out["longlum"] # doctest: +REMOTE_DATA
<Quantity [ 1.96860565e+18, 1.96860565e+18, 1.96860565e+18,
1.96860565e+18, 1.96860565e+18, 1.96860565e+18] W>
<Quantity [1.96860565e+18, 1.96860565e+18, 1.96860565e+18, 1.96860565e+18,
1.96860565e+18, 1.96860565e+18] W>
>>> lx_out["shortlum"] # doctest: +REMOTE_DATA
<Quantity [ 1.96860565e+17, 1.96860565e+17, 1.96860565e+17,
1.96860565e+17, 1.96860565e+17, 1.96860565e+17] W>
<Quantity [1.96860565e+17, 1.96860565e+17, 1.96860565e+17, 1.96860565e+17,
1.96860565e+17, 1.96860565e+17] W>
>>> lx_out["longlum_int"] # doctest: +REMOTE_DATA
<Quantity 1.968605654118636e+19 s W>
<Quantity 1.96860565e+19 s W>
>>> lx_out["shortlum_int"] # doctest: +REMOTE_DATA
<Quantity 1.9686056541186358e+18 s W>
<Quantity 1.96860565e+18 s W>
"""
# Calculate X-ray luminosities
......@@ -1266,7 +1266,7 @@ def _calc_xraylum(flux, date=None):
>>> flux = Quantity([7e-6,7e-6], unit="W/m**2")
>>> xraylum = _calc_xraylum(flux, date="2014-04-21") # doctest: +REMOTE_DATA
>>> xraylum # doctest: +REMOTE_DATA
<Quantity [ 1.98751663e+18, 1.98751663e+18] W>
<Quantity [1.98751663e+18, 1.98751663e+18] W>
"""
if date is not None:
......
......@@ -65,11 +65,11 @@ def test_concatenate_with_overlap(overlap_factor):
concat_lc = lc1.concatenate(lc2)
assert len(concat_lc.data) == (len(lc1.data) + len(lc2.data) - overlap_factor)
# check that the times are correct
assert np.all(concat_lc.data.index[0:len(dates)] == lc1.data.index)
assert (concat_lc.data.index[0:len(dates)] == lc1.data.index).all()
# check that the original data is still there
assert np.all(concat_lc.data.index[-len(lc2.data)+overlap_factor:] == lc2.data.index[overlap_factor:])
assert (concat_lc.data.index[-len(lc2.data)+overlap_factor:] == lc2.data.index[overlap_factor:]).all()
# check that the new data is there
assert np.all(concat_lc.data[-len(lc2.data)+overlap_factor:] == lc2.data[overlap_factor:])
np.testing.assert_allclose(concat_lc.data[-len(lc2.data)+overlap_factor:], lc2.data[overlap_factor:])
def test_concatenate_meta():
......@@ -93,5 +93,3 @@ def test_concatenate_fail():
eve = sunpy.lightcurve.EVELightCurve.create(EVE_AVERAGES_CSV)
with pytest.raises(TypeError):
lc1.concatenate(eve)
......@@ -4,6 +4,8 @@ Author: `Keith Hughitt <keith.hughitt@nasa.gov>`
"""
from __future__ import absolute_import, print_function, division
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
......@@ -405,7 +407,6 @@ class CompositeMap(object):
self._maps[0].spatial_units[0]))
axes.set_ylabel(axis_labels_from_ctype(self._maps[0].coordinate_system[1],
self._maps[0].spatial_units[1]))
axes.set_title(title)
# Define a list of plotted objects
......@@ -423,14 +424,22 @@ class CompositeMap(object):
}
params.update(matplot_args)
# The request to show a map layer rendered as a contour is indicated by a
# non False levels property. If levels is False, then the layer is
# rendered using imshow.
if m.levels is False:
ret.append(axes.imshow(m.data, **params))
# Check for the presence of masked map data
if m.mask is None:
ret.append(axes.imshow(m.data, **params))
else:
ret.append(axes.imshow(np.ma.array(np.asarray(m.data), mask=m.mask), **params))
else:
# Check for the presence of masked map data
if m.mask is None:
ret.append(axes.contour(m.data, m.levels, **params))
else:
ret.append(axes.contour(np.ma.array(np.asarray(m.data), mask=m.mask), m.levels, **params))
# Use contour for contour data, and imshow otherwise
if m.levels is not False:
# Set data with values <= 0 to transparent
# contour_data = np.ma.masked_array(m, mask=(m <= 0))
ret.append(axes.contour(m.data, m.levels, **params))
# Set the label of the first line so a legend can be created
ret[-1].collections[0].set_label(m.name)
......
......@@ -1643,7 +1643,11 @@ Reference Coord:\t {refcoord}
im = self.plot(axes=axes, **matplot_args)
if colorbar and not basic_plot:
figure.colorbar(im)
if draw_grid:
pad = 0.12 # Pad to compensate for ticks and axes labels
else:
pad = 0.05 # Default value for vertical colorbar
figure.colorbar(im, pad=pad)
if draw_limb:
self.draw_limb(axes=axes)
......
import pytest
import datetime
from sunpy.time.timerange import TimeRange, parse_time
impor