Commit 1758a897 authored by Ole Streicher's avatar Ole Streicher

New upstream version 0.9.6

parent 84dabe5f
Sunpy 0.9.6 (2019-01-28)
========================
Features
--------
- `sunpy.map.Map` can now save out rice compressed FITS files. (`#2826 <https://github.com/sunpy/sunpy/pull/2826>`__)
Bug Fixes
---------
- Fixed `sunpy.io.fits.write` to handle the keyword ``COMMENT`` correctly. (`#2880 <https://github.com/sunpy/sunpy/pull/2880>`__)
Sunpy 0.9.5 (2018-11-27)
========================
......
Metadata-Version: 2.1
Name: sunpy
Version: 0.9.5
Version: 0.9.6
Summary: SunPy: Python for Solar Physics
Home-page: http://sunpy.org/
Home-page: https://sunpy.org
Author: The SunPy Community
Author-email: sunpy@googlegroups.com
License: BSD
Description: SunPy is a Python library for solar physics data analysis.
License: BSD 2-Clause
Project-URL: Funding, https://www.flipcause.com/widget/widget_home/MTgxMTU=
Project-URL: Source, https://github.com/sunpy/sunpy/
Project-URL: Tracker, https://github.com/sunpy/sunpy/issues
Description: UNKNOWN
Platform: UNKNOWN
Provides: sunpy
Provides-Extra: net
Provides-Extra: all
Provides-Extra: image
Requires-Python: >=2.7
Provides-Extra: database
Provides-Extra: net
Provides-Extra: tests
Provides-Extra: all
Provides-Extra: jpeg2000
Provides-Extra: docs
Provides-Extra: image
......@@ -38,7 +38,6 @@ latest version of this module.
import contextlib
import errno
import imp
import io
import locale
import os
......@@ -46,6 +45,13 @@ import re
import subprocess as sp
import sys
__minimum_python_version__ = (2, 7)
if sys.version_info < __minimum_python_version__:
print("ERROR: Python {} or later is required by astropy-helpers".format(
__minimum_python_version__))
sys.exit(1)
try:
from ConfigParser import ConfigParser, RawConfigParser
except ImportError:
......@@ -66,35 +72,15 @@ else:
# issues with either missing or misbehaving pacakges (including making sure
# setuptools itself is installed):
# Check that setuptools 1.0 or later is present
from distutils.version import LooseVersion
# Some pre-setuptools checks to ensure that either distribute or setuptools >=
# 0.7 is used (over pre-distribute setuptools) if it is available on the path;
# otherwise the latest setuptools will be downloaded and bootstrapped with
# ``ez_setup.py``. This used to be included in a separate file called
# setuptools_bootstrap.py; but it was combined into ah_bootstrap.py
try:
import pkg_resources
_setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7')
# This may raise a DistributionNotFound in which case no version of
# setuptools or distribute is properly installed
_setuptools = pkg_resources.get_distribution('setuptools')
if _setuptools not in _setuptools_req:
# Older version of setuptools; check if we have distribute; again if
# this results in DistributionNotFound we want to give up
_distribute = pkg_resources.get_distribution('distribute')
if _setuptools != _distribute:
# It's possible on some pathological systems to have an old version
# of setuptools and distribute on sys.path simultaneously; make
# sure distribute is the one that's used
sys.path.insert(1, _distribute.location)
_distribute.activate()
imp.reload(pkg_resources)
except:
# There are several types of exceptions that can occur here; if all else
# fails bootstrap and use the bootstrapped version
from ez_setup import use_setuptools
use_setuptools()
import setuptools
assert LooseVersion(setuptools.__version__) >= LooseVersion('1.0')
except (ImportError, AssertionError):
print("ERROR: setuptools 1.0 or later is required by astropy-helpers")
sys.exit(1)
# typing as a dependency for 1.6.1+ Sphinx causes issues when imported after
# initializing submodule with ah_boostrap.py
......
astropy-helpers Changelog
*************************
2.0.8 (unreleased)
2.0.8 (2018-12-04)
------------------
- Fixed compatibility with Sphinx 1.8+. [#428]
......
......@@ -77,6 +77,8 @@ class AstropyBuildDocs(SphinxBuildDoc):
# docs/docs/_build.
if self.build_dir is None:
self.build_dir = os.path.abspath('docs/_build')
else:
self.build_dir = os.path.abspath(self.build_dir)
SphinxBuildDoc.finalize_options(self)
......
......@@ -9,7 +9,7 @@ from astropy_helpers.setup_helpers import (register_commands, get_package_info,
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_helpers'
VERSION = '2.0.8.dev'
VERSION = '2.0.8'
RELEASE = 'dev' not in VERSION
generate_version_py(NAME, VERSION, RELEASE, False, uses_git=not RELEASE)
......
This diff is collapsed.
[build_sphinx]
source-dir = docs
build-dir = docs/_build
all_files = 1
[metadata]
package_name = sunpy
description = SunPy: Python for Solar Physics
long_descripton = An open-source Python library for Solar Physics data analysis and visualization.
author = The SunPy Community
author_email = sunpy@googlegroups.com
license = BSD 2-Clause
url = https://sunpy.org
edit_on_github = True
github_project = sunpy/sunpy
install_requires = numpy>=1.11, astropy>=2.0.3>=3.0.2, scipy, pandas>=0.12.0, matplotlib>=1.3
# Extra Requirements
extra_requires = database, image, jpeg2000, net, tests, docs
database_requires = sqlalchemy
image_requires = scikit-image
jpeg2000_requires = glymur
net_requires = drms, suds-jurko, beautifulsoup4, python-dateutil
tests_requires = pytest, pytest-cov, pytest-mock, pytest-xdist, mock, hypothesis, pytest-astropy, pytest-rerunfailures
docs_requires = ruamel.yaml, sphinx, sunpy-sphinx-theme, sphinx-gallery, sphinx-astropy, towncrier
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 0.9.6
# Note: you will also need to change this in your package's __init__.py
minimum_python_version = 2.7
[ah_bootstrap]
auto_use = True
[build_docs]
source-dir = docs
build-dir = docs/_build
all_files = 1
[upload_docs]
upload-dir = docs/_build/html
show-response = 1
[tool:pytest]
minversion = 3.0
testpaths = "sunpy" "docs"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "astropy_helpers" "examples"
# Skip sunpy/data to prevent importing the sample data (there are no tests in that dir anyway)
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "astropy_helpers" "examples" "sunpy[\/]data"
doctest_plus = enabled
doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS
addopts = -p no:warnings --doctest-rst
......@@ -25,24 +44,48 @@ markers =
# Disable internet access for tests not marked remote_data
remote_data_strict = True
[ah_bootstrap]
auto_use = True
[metadata]
package_name = sunpy
description = SunPy: Python for Solar Physics
author = The SunPy Community
author_email = sunpy@googlegroups.com
license = BSD
url = http://sunpy.org/
edit_on_github = True
github_project = sunpy/sunpy
[pycodestyle]
max_line_length = 100
[flake8]
max-line-length = 100
[pycodestyle]
max_line_length = 100
[isort]
line_length = 100
not_skip = __init__.py
sections = FUTURE, STDLIB, THIRDPARTY, ASTROPY, FIRSTPARTY, LOCALFOLDER
default_section = THIRDPARTY
known_first_party = sunpy
known_astropy = astropy, asdf
multi_line_output = 0
balanced_wrapping = True
include_trailing_comma = false
length_sort = True
[coverage:run]
source = sunpy
omit =
sunpy/conftest.py
sunpy/cython_version*
sunpy/*setup*
sunpy/extern/*
sunpy/*/tests/*
sunpy/version*
sunpy/__init__*
sunpy/data/sample.py
sunpy/data/_sample.py
[yapf]
column_limit = 100
[coverage:report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about packages we have installed
except ImportError
# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError
# Don't complain about script hooks
def main\(.*\):
# Ignore branches that don't pertain to this version of Python
pragma: py{ignore_python_version}
six.PY{ignore_python_version}
#!/usr/bin/env python
# This file is based havily on the astropy version here:
# https://github.com/astropy/package-template/blob/master/setup.py
# Which is licensed under the astropy license.
# Which is licensed under the astropy license, see licenses/ASTROPY.rst.
################################################################################
###### YOU SHOULD NOT HAVE TO EDIT THIS FILE, YOU SHOULD EDIT setup.cfg. #######
################################################################################
# Note: This file needs to be Python 2 / <3.6 compatible, so that the nice
# "SunPy only supports Python 3.6+" error prints without syntax errors etc.
import glob
import os
import sys
import ah_bootstrap
from setuptools import setup
# A dirty hack to get around some early import/configurations ambiguities
if sys.version_info[0] >= 3:
import glob
try:
import builtins
else:
except ImportError:
import __builtin__ as builtins
builtins._ASTROPY_SETUP_ = True
# -- Read the Docs Setup -----------------------------------------------------
import itertools
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
os.environ['HOME'] = '/home/docs/'
os.environ['SUNPY_CONFIGDIR'] = '/home/docs/'
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
from astropy_helpers.setup_helpers import (
register_commands, get_debug_option, get_package_info)
from astropy_helpers.git_helpers import get_git_devstr
from astropy_helpers.version_helpers import generate_version_py
# Fix for https://github.com/pypa/pip/issues/6163
sys.path.insert(0, os.path.dirname(__file__))
# Get some values from the setup.cfg
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
conf = ConfigParser()
conf.read(['setup.cfg'])
metadata = dict(conf.items('metadata'))
PACKAGENAME = metadata.get('package_name', 'packagename')
PACKAGENAME = metadata.get('package_name', 'sunpy')
DESCRIPTION = metadata.get('description', 'SunPy: Python for Solar Physics')
AUTHOR = metadata.get('author', 'The SunPy Community')
AUTHOR_EMAIL = metadata.get('author_email', 'sunpy@googlegroups.com')
LICENSE = metadata.get('license', 'BSD 2-Clause')
URL = metadata.get('url', 'http://sunpy.org')
AUTHOR_EMAIL = metadata.get('author_email', '')
LICENSE = metadata.get('license', 'unknown')
URL = metadata.get('url', 'https://sunpy.org')
__minimum_python_version__ = metadata.get("minimum_python_version", "2.7")
# Enforce Python version check - this is the same check as in __init__.py but
# this one has to happen before importing ah_bootstrap.
if sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):
sys.stderr.write("ERROR: SunPy requires Python {} or later\n".format(__minimum_python_version__))
sys.exit(1)
LONG_DESCRIPTION = "SunPy is a Python library for solar physics data analysis."
# Import ah_bootstrap after the python version validation
import ah_bootstrap # noqa
from setuptools import setup # noqa
from astropy_helpers.git_helpers import get_git_devstr # noqa
from astropy_helpers.setup_helpers import get_package_info # noqa
from astropy_helpers.setup_helpers import get_debug_option, register_commands
from astropy_helpers.version_helpers import generate_version_py # noqa
builtins._SUNPY_SETUP_ = True
# -- Read the Docs Setup -----------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
os.environ['HOME'] = '/home/docs/'
os.environ['SUNPY_CONFIGDIR'] = '/home/docs/'
# Store the package name in a built-in variable so it's easy
# to get from other parts of the setup infrastructure
# This is used by get_pkg_data in astropy amongst other things
builtins._ASTROPY_PACKAGE_NAME_ = PACKAGENAME
# VERSION should be PEP386 compatible (https://www.python.org/dev/peps/pep-0386)
VERSION = '0.9.5'
# VERSION should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
VERSION = metadata.get('version', '0.0.dev0')
# Indicates if this version is a release version
RELEASE = 'dev' not in VERSION
......@@ -63,14 +81,14 @@ if not RELEASE:
# Populate the dict of setup command overrides; this should be done before
# invoking any other functionality from distutils since it can potentially
# modify distutils' behavior.
# modify distutils' behaviour.
cmdclassd = register_commands(PACKAGENAME, VERSION, RELEASE)
try:
from sunpy.tests.setup_command import SunPyTest
# Overwrite the Astropy Testing framework
cmdclassd['test'] = type('SunPyTest', (SunPyTest,),
{'package_name': 'sunpy'})
{'package_name': 'sunpy'})
except Exception:
# Catch everything, if it doesn't work, we still want SunPy to install.
......@@ -80,9 +98,9 @@ except Exception:
generate_version_py(PACKAGENAME, VERSION, RELEASE,
get_debug_option(PACKAGENAME))
# Treat everything in scripts except README.rst as a script to be installed
# Treat everything in scripts except README* as a script to be installed
scripts = [fname for fname in glob.glob(os.path.join('scripts', '*'))
if os.path.basename(fname) != 'README.rst']
if not os.path.basename(fname).startswith('README')]
# Get configuration information from all of the various subpackages.
......@@ -92,6 +110,16 @@ package_info = get_package_info()
# Add the project-global data
package_info['package_data'].setdefault(PACKAGENAME, [])
package_info['package_data'][PACKAGENAME].append('data/*')
# Define entry points for command-line scripts
entry_points = {'console_scripts': []}
if conf.has_section('entry_points'):
entry_point_list = conf.items('entry_points')
for entry_point in entry_point_list:
entry_points['console_scripts'].append('{0} = {1}'.format(
entry_point[0], entry_point[1]))
# Include all .c files, recursively, including those generated by
# Cython, since we can not do this in MANIFEST.in with a "dynamic"
......@@ -105,33 +133,34 @@ for root, dirs, files in os.walk(PACKAGENAME):
os.path.relpath(root, PACKAGENAME), filename))
package_info['package_data'][PACKAGENAME].extend(c_files)
extras_require = {'database': ["sqlalchemy"],
'image': ["scikit-image"],
'jpeg2000': ["glymur"],
'net': ["drms", "suds-jurko", "beautifulsoup4", "requests", "python-dateutil"],
'tests': ["pytest", "pytest-cov", "pytest-mock", "pytest-rerunfailures", "mock", "hypothesis"]}
extras_require['all'] = extras_require['database'] + extras_require['image'] + \
extras_require['net'] + extras_require['tests']
extra_tags = [m.strip() for m in metadata.get("extra_requires", "").split(',')]
if extra_tags:
extras_require = {tag: [m.strip() for m in metadata["{tag}_requires".format(tag=tag)].split(',')]
for tag in extra_tags}
extras_require['all'] = list(itertools.chain.from_iterable(extras_require.values()))
else:
extras_require = None
setup(name=PACKAGENAME,
version=VERSION,
description=DESCRIPTION,
scripts=scripts,
install_requires=['numpy>=1.11,!=1.15.3',
'astropy>=2.0.3>=3.0.2', # astropy/astropy#7252
'scipy',
'pandas>=0.12.0',
'matplotlib>=1.3'],
install_requires=[s.strip() for s in metadata['install_requires'].split(',')],
extras_require=extras_require,
provides=[PACKAGENAME],
tests_require=extras_require.get("all", ""),
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
url=URL,
long_description=LONG_DESCRIPTION,
project_urls={'Funding': 'https://www.flipcause.com/widget/widget_home/MTgxMTU=',
'Source': 'https://github.com/sunpy/sunpy/',
'Tracker': 'https://github.com/sunpy/sunpy/issues'
},
cmdclass=cmdclassd,
zip_safe=False,
use_2to3=False,
entry_points=entry_points,
python_requires='>={}'.format(__minimum_python_version__),
include_package_data=True,
**package_info
)
"""
SunPy
=====
An open-source Python library for Solar Physics data analysis.
Web Links
---------
Homepage: http://sunpy.org
Documentation: http://docs.sunpy.org/en/stable/
"""
from __future__ import absolute_import
# Enforce Python version check during package import.
# This is the same check as the one at the top of setup.py
import os
import sys
__minimum_python_version__ = "2.7"
class UnsupportedPythonError(Exception):
pass
if sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):
raise UnsupportedPythonError("sunpy does not support Python < {}".format(__minimum_python_version__))
# this indicates whether or not we are in the package's setup.py
try:
_SUNPY_SETUP_
except NameError:
try:
import builtins
except ImportError:
import __builtin__ as builtins
builtins._SUNPY_SETUP_ = False
try:
from .version import version as __version__
except ImportError:
__version__ = ''
try:
from .version import githash as __githash__
except ImportError:
__githash__ = ''
try:
_ASTROPY_SETUP_
except NameError:
_ASTROPY_SETUP_ = False
if not _ASTROPY_SETUP_:
if not _SUNPY_SETUP_:
from sunpy.util.config import load_config, print_config
from sunpy.util import system_info
from sunpy.tests import main as self_test
from sunpy.tests.runner import SunPyTestRunner
self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
# Load user configuration
config = load_config()
......
......@@ -16,6 +16,7 @@ rootdir = os.path.join(os.path.dirname(sunpy.__file__), "data", "test")
file_list = glob.glob(os.path.join(rootdir, '*.[!p]*'))
def get_test_filepath(filename, **kwargs):
"""
Return the full path to a test file in the ``data/test`` directory.
......
"""
Note: This test lives here because we have to exclude sunpy/data from pytest.
"""
import os
import pytest
import sunpy.data.test
@pytest.fixture
def mockreturn(path):
paths = [
(os.path.join('test', 'data', ''), (), ('code.py', 'test_file', 'code.pyc', '__init__.py'))
......
......@@ -21,6 +21,7 @@ from sunpy.time import parse_time, TimeRange
from sunpy.io import fits, file_tools as sunpy_filetools
from sunpy.util import print_table
from sunpy.extern.six.moves import map
from sunpy.io.header import FileHeader
from sunpy.extern import six
import sunpy.net
......@@ -29,6 +30,19 @@ from sunpy import config
TIME_FORMAT = config.get("general", "time_format")
DEFAULT_HEADER = FileHeader([('SIMPLE', True),
('BITPIX', 8),
('NAXIS', 0),
('EXTEND', True),
('COMMENT', ''),
('HISTORY', ''),
('KEYCOMMENTS',
{'SIMPLE': 'conforms to FITS standard',
'BITPIX': 'array data type',
'NAXIS': 'number of array dimensions'}),
('WAVEUNIT', None)])
__all__ = [
'WaveunitNotFoundError', 'WaveunitNotConvertibleError', 'JSONDump',
'FitsHeaderEntry', 'FitsKeyComment', 'Tag', 'DatabaseEntry',
......@@ -654,6 +668,12 @@ def entries_from_file(file, default_waveunit=None,
"""
headers = fits.get_header(file)
# This just checks for blank default headers
# due to compression.
for header in headers:
if header == DEFAULT_HEADER:
headers.remove(header)
if isinstance(file, (str, six.text_type)):
filename = file
else:
......
......@@ -18,31 +18,31 @@ def aia171_test_map():
def shape(aia171_test_map):
return np.array(aia171_test_map.data.shape)
def resample_meta(dimensions, method, center, minusone):
map_resampled = aia171_test_map().resample(dimensions)
def resample_meta(aia171_test_map, dimensions, method, center, minusone):
map_resampled = aia171_test_map.resample(dimensions)
return tuple(map_resampled.data.shape)
def resample_method(method):
assert resample_meta((512, 512) * u.pix, method, False, False) == (512, 512)
assert resample_meta((2056, 2056) * u.pix, method, False, False) == (2056, 2056)
assert resample_meta((512, 512) * u.pix, method, False, True) == (512, 512)
assert resample_meta((2056, 2056) * u.pix, method, False, True) == (2056, 2056)
assert resample_meta((512, 512) * u.pix, method, True, False) == (512, 512)
assert resample_meta((2056, 2056) * u.pix, method, True, False) == (2056, 2056)
assert resample_meta((512, 512) * u.pix, method, True, True) == (512, 512)
assert resample_meta((2056, 2056) * u.pix, method, True, True) == (2056, 2056)
def resample_method(aia171_test_map, method):
assert resample_meta(aia171_test_map, (512, 512) * u.pix, method, False, False) == (512, 512)
assert resample_meta(aia171_test_map, (2056, 2056) * u.pix, method, False, False) == (2056, 2056)
assert resample_meta(aia171_test_map, (512, 512) * u.pix, method, False, True) == (512, 512)
assert resample_meta(aia171_test_map, (2056, 2056) * u.pix, method, False, True) == (2056, 2056)
assert resample_meta(aia171_test_map, (512, 512) * u.pix, method, True, False) == (512, 512)
assert resample_meta(aia171_test_map, (2056, 2056) * u.pix, method, True, False) == (2056, 2056)
assert resample_meta(aia171_test_map, (512, 512) * u.pix, method, True, True) == (512, 512)
assert resample_meta(aia171_test_map, (2056, 2056) * u.pix, method, True, True) == (2056, 2056)
def test_resample_neighbor():
resample_method('neighbor')
def test_resample_neighbor(aia171_test_map):
resample_method(aia171_test_map, 'neighbor')
def test_resample_nearest():
resample_method('nearest')
def test_resample_nearest(aia171_test_map):
resample_method(aia171_test_map, 'nearest')
def test_resample_linear():
resample_method('linear')
def test_resample_linear(aia171_test_map):
resample_method(aia171_test_map, 'linear')
def test_resample_spline():
resample_method('spline')
def test_resample_spline(aia171_test_map):
resample_method(aia171_test_map, 'spline')
def test_reshape(aia171_test_map, shape):
......
......@@ -43,7 +43,7 @@ def aiaprep(aiamap):
"""
if not isinstance(aiamap, (AIAMap, HMIMap)):
raise ValueError("Input must be an AIAMap")
raise ValueError("Input must be an AIAMap or HMIMap.")
# Target scale is 0.6 arcsec/pixel, but this needs to be adjusted if the map
# has already been rescaled.
......
......@@ -451,6 +451,11 @@ def met_to_utc(timeinsec):
"""
Converts Fermi Mission Elapsed Time (MET) in seconds to a datetime object.
.. warning::
This function does not account for leap seconds and can not be fixed in
SunPy's 0.9.x series of releases.
However, it is fixed in the next major version, 1.0.
Parameters