Internal API Documentation#
This page contains the documentation for the internal API of sunpy
.
This is not intended for general use and is subject to change without notice.
sunpy.io._file_tools Module#
This module provides a generic file reader for internal use.
Functions#
|
Automatically determine the filetype and read the file. |
|
Reads the header from a given file. |
|
Write a file from a data & header pair using one of the defined file types. |
|
Attempts to determine the type of file a given filepath is. |
sunpy.io._header Module#
This module provides a generic FileHeader object for the readers.
Classes#
|
FileHeader is designed to provide a consistent interface to all other sunpy classes that expect a generic file. |
Class Inheritance Diagram#
sunpy.io._fits Module#
This module provides a FITS file reader for internal use.
Notes
FITS files allow comments to be attached to every value in the header. This is implemented in this module as a KEYCOMMENTS dictionary in the sunpy header. To add a comment to the file on write, add a comment to this dictionary with the same name as a key in the header (upcased).
Due to the way
fits
works with images, the header dictionary may differ depending on whether is accessed before or after the fits[0].data is requested. If the header is read before the data then the original header will be returned. If the header is read after the data has been accessed then the data will have been scaled and a modified header reflecting these changes will be returned: BITPIX may differ and BSCALE and B_ZERO may be dropped in the modified version.The verify(‘silentfix+warn’) call attempts to handle violations of the FITS standard. For example,
nan
values will be converted to “nan” strings. Attempting to cast aastropy.io.fits.Header
to a dictionary while it contains invalid header tags will result in an error so verifying it early on makes the header easier to work with later.
Functions#
|
Convert a header dict to a |
|
Read a fits file. |
|
Read a fits file and return just the headers for all HDU's. |
|
Take a data header pair and write a FITS file. |
|
Attempt to read the wavelength unit from a given FITS header. |
|
Combine |
sunpy.io._jp2 Module#
This module provides a JPEG 2000 file reader for internal use.
Functions#
|
Reads a JPEG2000 file. |
|
Reads the header from the file. |
|
Take a data header pair and write a JPEG2000 file. |