Commit 70668bd7 authored by Ole Streicher's avatar Ole Streicher

New upstream version 1.3.0

parent a3e66c5e
1.3.0 (2017-10-24)
------------------
- Fixed a bug in reading data from an "http:" url. [#231]
- Implements v 1.1.0 of the asdf schemas. [#233]
- Added a function ``is_asdf_file`` which inspects the input and
returns ``True`` or ``False``. [#239]
- The ``open`` method of ``AsdfInFits`` now accepts URIs and open file handles
in addition to HDULists. The ``open`` method of ``AsdfFile`` will now try to
parse the given URI or file handle as ``AsdfInFits`` if it is not obviously a
regular ASDF file. [#241]
- Updated WCS frame fields ``obsgeoloc`` and ``obsgeovel`` to reflect recent
updates in ``astropy`` that changed representation from ``Quantity`` to
``CartesianRepresentation``. Updated to reflect ``astropy`` change that
combines ``galcen_ra`` and ``galcen_dec`` into ``galcen_coord``. Added
support for new field ``galcen_v_sun``. Added support for required module
versions for tag classes. [#244]
- Added support for ``lz4`` compression algorithm [#258]. Also added support
for using a different compression algorithm for writing out a file than the
one that was used for reading the file (e.g. to convert blocks to use a
different compression algorithm) [#257]
- Tag classes may now use an optional ``supported_versions`` attribute to
declare exclusive support for particular versions of the corresponding
schema. If this attribute is omitted (as it is for most existing tag
classes), the tag is assumed to be compatible with all versions of the
corresponding schema. If ``supported_versions`` is provided, the tag class
implementation can include code that is conditioned on the schema version. If
an incompatible schema is encountered, or if deserialization of the tagged
object fails with an exception, a raw Python data structure will be returned.
[#272]
- Added option to ``AsdfFile.open`` to allow suppression of warning messages
when mismatched schema versions are encountered. [#294]
- Added a diff tool to ``asdftool`` to allow for visual comparison of pairs of
ASDF files. [#286]
- Added command to ``asdftool`` to display available tags. [#303]
- When possible, display name of ASDF file that caused version mismatch
warning. [#306]
- Issue a warning when an unrecognized tag is encountered. [#295] This warning
is silenced by default, but can be enabled with a parameter to the
``AsdfFile`` constructor, or to ``AsdfFile.open``. Also added an option for
ignoring warnings from unrecognized schema tags. [#319]
- Fix bug with loading JSON schemas in Python 3.5. [#317]
- Remove all remnants of support for Python 2.6. [#333]
- Fix issues with the type index used for writing out ASDF files. This ensures
that items in the type index are not inadvertently overwritten by later
versions of the same type. It also makes sure that schema example tests run
against the correct version of the ASDF standard. [#350]
- Update time schema to reflect changes in astropy. This fixes an outstanding
bug. [#343]
- Add ``copy_arrays`` option to ``asdf.open`` to control whether or not
underlying array data should be memory mapped, if possible. [#355]
- Allow the tree to be accessed using top-level ``__getitem__`` and
``__setitem__``. [#352]
1.2.1(2016-11-07)
-----------------
......
Metadata-Version: 1.0
Name: asdf
Version: 1.2.1
Version: 1.3.0
Summary: Python tools to handle ASDF files
Home-page: http://github.com/spacetelescope/asdf
Author: Erik Bray, Michael Droettboom
......
asdf
====
.. image:: https://readthedocs.org/projects/pyasdf/badge/?version=latest
:target: http://pyasdf.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://coveralls.io/repos/spacetelescope/asdf/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/spacetelescope/asdf?branch=master
.. image:: https://travis-ci.org/spacetelescope/asdf.svg?branch=master
:target: https://travis-ci.org/spacetelescope/asdf
.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
:target: http://www.astropy.org
:alt: Powered by Astropy Badge
Python library for reading and writing ASDF files.
Advanced Scientific Data Format (ASDF) is a next generation
interchange format for scientific data.
Installation
------------
To clone the project from github and initialize the asdf-standard submodule::
git clone https://github.com/spacetelescope/asdf.git
cd asdf/asdf_standard
git submodule init
git submodule update
To install::
python setup.py install
Testing
-------
To run the unit tests::
python setup.py test
......@@ -91,13 +91,24 @@ except:
use_setuptools()
# typing as a dependency for 1.6.1+ Sphinx causes issues when imported after
# initializing submodule with ah_boostrap.py
# See discussion and references in
# https://github.com/astropy/astropy-helpers/issues/302
try:
import typing # noqa
except ImportError:
pass
# Note: The following import is required as a workaround to
# https://github.com/astropy/astropy-helpers/issues/89; if we don't import this
# module now, it will get cleaned up after `run_setup` is called, but that will
# later cause the TemporaryDirectory class defined in it to stop working when
# used later on by setuptools
try:
import setuptools.py31compat
import setuptools.py31compat # noqa
except ImportError:
pass
......@@ -702,7 +713,7 @@ class _Bootstrapper(object):
if self.offline:
cmd.append('--no-fetch')
elif status == 'U':
raise _AHBoostrapSystemExit(
raise _AHBootstrapSystemExit(
'Error: Submodule {0} contains unresolved merge conflicts. '
'Please complete or abandon any changes in the submodule so that '
'it is in a usable state, then try again.'.format(submodule))
......@@ -763,7 +774,7 @@ def run_cmd(cmd):
msg = 'Command not found: `{0}`'.format(' '.join(cmd))
raise _CommandNotFound(msg, cmd)
else:
raise _AHBoostrapSystemExit(
raise _AHBootstrapSystemExit(
'An unexpected error occurred when running the '
'`{0}` command:\n{1}'.format(' '.join(cmd), str(e)))
......@@ -878,46 +889,6 @@ class _AHBootstrapSystemExit(SystemExit):
super(_AHBootstrapSystemExit, self).__init__(msg, *args[1:])
if sys.version_info[:2] < (2, 7):
# In Python 2.6 the distutils log does not log warnings, errors, etc. to
# stderr so we have to wrap it to ensure consistency at least in this
# module
import distutils
class log(object):
def __getattr__(self, attr):
return getattr(distutils.log, attr)
def warn(self, msg, *args):
self._log_to_stderr(distutils.log.WARN, msg, *args)
def error(self, msg):
self._log_to_stderr(distutils.log.ERROR, msg, *args)
def fatal(self, msg):
self._log_to_stderr(distutils.log.FATAL, msg, *args)
def log(self, level, msg, *args):
if level in (distutils.log.WARN, distutils.log.ERROR,
distutils.log.FATAL):
self._log_to_stderr(level, msg, *args)
else:
distutils.log.log(level, msg, *args)
def _log_to_stderr(self, level, msg, *args):
# This is the only truly 'public' way to get the current threshold
# of the log
current_threshold = distutils.log.set_threshold(distutils.log.WARN)
distutils.log.set_threshold(current_threshold)
if level >= current_threshold:
if args:
msg = msg % args
sys.stderr.write('%s\n' % msg)
sys.stderr.flush()
log = log()
BOOTSTRAPPER = _Bootstrapper.main()
......
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0"
id: "http://stsci.edu/schemas/asdf/time/time-1.1.0"
title: Represents an instance in time.
description: |
A "time" is a single instant in time. It may explicitly specify the
way time is represented (the "format") and the "scale" which
specifies the offset and scaling relation of the unit of time.
Specific emphasis is placed on supporting time scales (e.g. UTC,
TAI, UT1, TDB) and time representations (e.g. JD, MJD, ISO 8601)
that are used in astronomy and required to calculate, e.g., sidereal
times and barycentric corrections.
Times may be represented as one of the following:
- an object, with explicit `value`, and optional `format`, `scale`
and `location`.
- a string, in which case the format is guessed from across
the unambiguous options (`iso`, `byear`, `jyear`, `yday`), and the
scale is hardcoded to `UTC`.
In either case, a single time tag may be used to represent an
n-dimensional array of times, using either an `ndarray` tag or
inline as (possibly nested) YAML lists. If YAML lists, the same
format must be used for all time values.
The precision of the numeric formats should only be assumed to be as
good as an IEEE-754 double precision (float64) value. If
higher-precision is required, the `iso` or `yday` format should be
used.
examples:
-
- Example ISO time
- |
!time/time-1.1.0 "2000-12-31T13:05:27.737"
-
- Example year, day-of-year and time format time
- |
!time/time-1.1.0 "2001:003:04:05:06.789"
-
- Example Besselian Epoch time
- |
!time/time-1.1.0 B2000.0
-
- Example Besselian Epoch time, equivalent to above
- |
!time/time-1.1.0
value: 2000.0
format: byear
-
- Example list of times
- |
!time/time-1.1.0
["2000-12-31T13:05:27.737", "2000-12-31T13:06:38.444"]
-
- Example of an array of times
- |
!time/time-1.1.0
value: !core/ndarray-1.0.0
data: [2000, 2001]
datatype: float64
format: jyear
-
- Example with a location
- |
!time/time-1.1.0
value: 2000.0
format: jyear
scale: tdb
location:
x: 6378100
y: 0
z: 0
definitions:
iso_time:
type: string
pattern: "[0-9]{4}-(0[1-9])|(1[0-2])-(0[1-9])|([1-2][0-9])|(3[0-1])[T ]([0-1][0-9])|(2[0-4]):[0-5][0-9]:[0-5][0-9](.[0-9]+)?"
byear:
type: string
pattern: "B[0-9]+(.[0-9]+)?"
jyear:
type: string
pattern: "J[0-9]+(.[0-9]+)?"
yday:
type: string
pattern: "[0-9]{4}:(00[1-9])|(0[1-9][0-9])|([1-2][0-9][0-9])|(3[0-5][0-9])|(36[0-5]):([0-1][0-9])|([0-1][0-9])|(2[0-4]):[0-5][0-9]:[0-5][0-9](.[0-9]+)?"
string_formats:
anyOf:
- $ref: "#/definitions/iso_time"
- $ref: "#/definitions/byear"
- $ref: "#/definitions/jyear"
- $ref: "#/definitions/yday"
array_of_strings:
type: array
items:
anyOf:
- $ref: "#/definitions/array_of_strings"
- $ref: "#/definitions/string_formats"
allOf:
- tag: "tag:stsci.edu:asdf/time/time-1.1.0"
- anyOf:
- $ref: "#/definitions/string_formats"
- $ref: "#/definitions/array_of_strings"
- type: object
properties:
$ref: "../core/ndarray-1.0.0#anyOf/1/properties"
- type: object
properties:
value:
description: |
The value(s) of the time.
anyOf:
- $ref: "#/definitions/string_formats"
- $ref: "#/definitions/array_of_strings"
- $ref: "../core/ndarray-1.0.0"
- type: number
format:
description: |
The format of the time.
If not provided, the the format should be guessed from the
string from among the following unambiguous options:
`iso`, `byear`, `jyear` and `yday`.
The supported formats are:
- `iso`: ISO 8601 compliant date-time format
`YYYY-MM-DDTHH:MM:SS.sss...`. For example,
`2000-01-01 00:00:00.000` is midnight on January 1,
2000. The `T` separating the date from the time
section is optional.
- `yday`: Year, day-of-year and time as
`YYYY:DOY:HH:MM:SS.sss...`. The day-of-year (DOY) goes
from 001 to 365 (366 in leap years). For example,
`2000:001:00:00:00.000` is midnight on January 1,
2000.
- `byear`: Besselian Epoch year, eg. `B1950.0`. The `B`
is optional if the `byear` format is explicitly
specified.
- `jyear`: Julian Epoch year, eg. `J2000.0`. The `J` is
optional if the `jyear` format is explicitly
specified.
- `decimalyear`: Time as a decimal year, with integer
values corresponding to midnight of the first day of
each year. For example 2000.5 corresponds to the ISO
time `2000-07-02 00:00:00`.
- `jd`: Julian Date time format. This represents the
number of days since the beginning of the Julian
Period. For example, 2451544.5 in `jd` is midnight on
January 1, 2000.
- `mjd`: Modified Julian Date time format. This
represents the number of days since midnight on
November 17, 1858. For example, 51544.0 in MJD is
midnight on January 1, 2000.
- `gps`: GPS time: seconds from 1980-01-06 00:00:00 UTC
For example, 630720013.0 is midnight on January 1,
2000.
- `unix`: Unix time: seconds from 1970-01-01 00:00:00
UTC. For example, 946684800.0 in Unix time is midnight
on January 1, 2000. [TODO: Astropy's definition of
UNIX time doesn't match POSIX's here. What should we
do for the purposes of ASDF?]
enum:
- iso
- yday
- byear
- jyear
- decimalyear
- jd
- mjd
- gps
- unix
- cxcsec
scale:
description: |
The time scale (or time standard) is a specification for
measuring time: either the rate at which time passes; or
points in time; or both. See also [3] and [4].
These scales are defined in detail in [SOFA Time Scale and
Calendar Tools](http://www.iausofa.org/sofa_ts_c.pdf).
The supported time scales are:
- `utc`: Coordinated Universal Time (UTC). This is the
default time scale, except for `gps`, `unix`.
- `tai`: International Atomic Time (TAI).
- `tcb`: Barycentric Coordinate Time (TCB).
- `tcg`: Geocentric Coordinate Time (TCG).
- `tdb`: Barycentric Dynamical Time (TDB).
- `tt`: Terrestrial Time (TT).
- `ut1`: Universal Time (UT1).
enum:
- utc
- tai
- tcb
- tcg
- tdb
- tt
- ut1
location:
description: |
Specifies the observer location for scales that are
sensitive to observer location, currently only `tdb`. May
be specified either with geocentric coordinates (X, Y, Z)
with an optional unit or geodetic coordinates:
- `long`: longitude in degrees
- `lat`: in degrees
- `h`: optional height
type: object
properties:
x:
$ref: "../unit/quantity-1.1.0"
y:
$ref: "../unit/quantity-1.1.0"
z:
$ref: "../unit/quantity-1.1.0"
required: [x, y, z]
required: [value]
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/add-1.1.0"
tag: "tag:stsci.edu:asdf/transform/add-1.1.0"
title: >
Perform a list of subtransforms in parallel and then
add their results together.
description: |
Each of the subtransforms must have the same number of inputs and
outputs.
examples:
-
- A list of transforms, performed in parallel and added together
- |
!transform/add-1.1.0
forward:
- !transform/generic-1.1.0
n_inputs: 1
n_outputs: 2
- !transform/generic-1.1.0
n_inputs: 1
n_outputs: 2
allOf:
- $ref: "transform-1.1.0"
- properties:
forward:
type: array
items:
$ref: "transform-1.1.0"
required: [forward]
\ No newline at end of file
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/affine-1.1.0"
tag: "tag:stsci.edu:asdf/transform/affine-1.1.0"
title: >
An affine transform.
description: |
Invertibility: All ASDF tools are required to be able to compute the
analytic inverse of this transform.
allOf:
- $ref: "transform-1.1.0"
- type: object
properties:
matrix:
description: |
An array of size (*n* x *n*), where *n* is the number of axes,
representing the linear transformation in an affine transform.
anyOf:
- $ref: "../core/ndarray-1.0.0"
- type: array
items:
type: array
items:
type: number
minItems: 2
maxItems: 2
minItems: 2
maxItems: 2
translation:
description: |
An array of size (*n*,), where *n* is the number of axes,
representing the translation in an affine transform.
anyOf:
- $ref: "../core/ndarray-1.0.0"
- type: array
items:
type: number
minItems: 2
maxItems: 2
required: [matrix]
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/airy-1.1.0"
tag: "tag:stsci.edu:asdf/transform/airy-1.1.0"
title: |
The Airy projection.
description: |
Corresponds to the `AIR` projection in the FITS WCS standard.
See
[zenithal](ref:http://stsci.edu/schemas/asdf/transform/zenithal-1.1.0)
for the definition of the full transformation.
allOf:
- $ref: "zenithal-1.1.0"
- type: object
properties:
theta_b:
type: number
description: |
The latitude $\theta_b$ at which to minimize the error, in
degrees.
default: 90
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/bonne_equal_area-1.1.0"
tag: "tag:stsci.edu:asdf/transform/bonne_equal_area-1.1.0"
title: |
Bonne's equal area pseudoconic projection.
description: |
Corresponds to the `BON` projection in the FITS WCS standard.
The pixel-to-sky transformation is defined as:
$$\phi &= \frac{\pi}{180^\circ} A_\phi R_\theta / \cos \theta \\
\theta &= Y_0 - R_\theta$$
where:
$$R_\theta &= \mathrm{sign} \theta_1 \sqrt{x^2 + (Y_0 - y)^2} \\
A_\phi &= \arg\left(\frac{Y_0 - y}{R_\theta}, \frac{x}{R_\theta}\right)$$
And the sky-to-pixel transformation is defined as:
$$x &= R_\theta \sin A_\phi \\
y &= -R_\theta \cos A_\phi + Y_0$$
where:
$$A_\phi &= \frac{180^\circ}{\pi R_\theta} \phi \cos \theta \\
R_\theta &= Y_0 - \theta \\
Y_0 &= \frac{180^\circ}{\pi} \cot \theta_1 + \theta_1$$
Invertibility: All ASDF tools are required to provide the inverse of
this transform.
allOf:
- $ref: "pseudoconic-1.1.0"
- type: object
properties:
theta1:
type: number
description: |
Bonne conformal latitude, in degrees.
default: 0
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/transform/cobe_quad_spherical_cube-1.1.0"
tag: "tag:stsci.edu:asdf/transform/cobe_quad_spherical_cube-1.1.0"
title: |
COBE quadrilateralized spherical cube projection.