Maps (


One of core classes in sunpy is a Map. A sunpy Map object is simply a spatially-aware data array, often an image. In order to make it easy to work with image data in sunpy, the Map object provides a number of methods for commonly performed operations.

2D map objects are subclasses of GenericMap and these objects are created using the Map factory Map.

A number of instrument are supported by subclassing this base object. See Instrument Map Classes to see a list of all of them. More complex subclasses are also available. See Package.

Creating Map Objects#

sunpy Map objects are constructed using the special factory class Map:

>>> x ='file.fits')  

The result of a call to Map will be either a GenericMap object, or a subclass of GenericMap which either deals with a specific type of data, e.g. AIAMap or LASCOMap (see Package to see a list of all of them), or if no instrument matches, a 2D map GenericMap.

Fixing map metadata#

If you need to fix the metadata of a fits file before it is handed to Map, this can be done as follows:

>>> data, header =[0] 
>>> header['cunit1'] = 'arcsec' 
>>> header['cunit2'] = 'arcsec' 
>>> map =, header) 
class, additional_validation_functions=[], registry=None)[source]#

A factory for generating coordinate aware 2D images.

This factory takes a variety of inputs, such as file paths, wildcard patterns or (data, header) pairs.

Depending on the input different return types are possible.

  • *inputs – Inputs to parse for map objects. See the examples section for a detailed list of accepted inputs.

  • sequence (bool, optional) – Return a object comprised of all the parsed maps.

  • composite (bool, optional) – Return a object comprised of all the parsed maps.



>>> import
>>> from import fits
>>> import  
>>> mymap = Package#

All sunpy Maps are derived from, all the methods and attributes are documented in that class. Package#



Returns the coordinates of the center of every pixel in a map.


Returns the coordinates of the pixel corners in a map.


Returns pixel pair indices of every pixel in a map.

contains_coordinate(smap, coordinates)

Checks whether a coordinate falls within the bounds of a map.


Checks if a map contains the full disk of the Sun.


Checks if a map contains any part of the solar limb or equivalently whether the map contains both on-disk and off-disk pixels.


Returns True if smap contains the solar center.


Checks if the helioprojective Cartesian coordinates are on the solar disk.


Checks if none of the coordinates in the GenericMap are on the solar disk.


Checks if all of the coordinates in the GenericMap are on the solar disk.


Returns the pixel locations of the edges of an input map.


Returns the the bottom left and top right coordinates of the smallest rectangular region that contains all the on disk coordinates of the input map.

pixelate_coord_path(smap, coord_path, *[, ...])

Return the pixel coordinates for every pixel that intersects with a coordinate path.

sample_at_coords(smap, coordinates)

Samples the data in a map at given series of coordinates.


Calculates the solar angular radius as seen by the observer.


CompositeMap(map1 [,map2,..])

A Composite Map class

GenericMap(data, header[, plot_settings])

A Generic spatially-aware 2D data array


MapSequence(*args[, sortby, derotate])

A series of Maps in a single object.

PixelPair(x, y)



A factory for generating coordinate aware 2D images.


CGS unit for magnetic flux

Class Inheritance Diagram#

Inheritance diagram of,,,,

Header helpers#

The header_helper sub-module contains helper functions for generating FITS-WCS headers from Python objects. Module#



Deprecated since version 5.0.

make_fitswcs_header(data, coordinate[, ...])

Function to create a FITS-WCS header from a coordinate object (SkyCoord) that is required to create a GenericMap.

get_observer_meta(observer[, rsun])

Function to get observer meta from coordinate frame.

make_heliographic_header(date, ...[, ...])

Construct a FITS-WCS header for a full-Sun heliographic (Carrington or Stonyhurst) coordinate frame.

Instrument Map Classes#

Defined in are a set of GenericMap subclasses which convert the specific metadata and other differences in each instruments data to the standard GenericMap interface. These ‘sources’ also define things like the colormap and default normalisation for each instrument. These subclasses also provide a method, which describes to the Map factory which data and metadata pairs match its instrument. Package#



Test determining if the given metadata contains Helioviewer Project sourced data.

source_stretch(meta, fits_stretch)

Assign the correct source-dependent image stretching function.


AIAMap(data, header, **kwargs)

AIA Image Map.

CORMap(data, header, **kwargs)

STEREO-SECCHI CORonograph Image Map.

EITMap(data, header, **kwargs)

SOHO EIT Image Map.

EUIMap(data, header, **kwargs)

EUI Image Map

EUVIMap(data, header, **kwargs)


GONGSynopticMap(data, header[, plot_settings])

GONG Synoptic Map.

HIMap(data, header, **kwargs)

STEREO-SECCHI Heliospheric Imager (HI) Map.

HMIMap(data, header, **kwargs)

HMI Image Map.

HMISynopticMap(data, header, **kwargs)

SDO/HMI Synoptic Map.

KCorMap(data, header, **kwargs)

K-Cor Image Map.

LASCOMap(data, header, **kwargs)


MDIMap(data, header, **kwargs)

SOHO MDI Image Map

MDISynopticMap(data, header, **kwargs)

SOHO MDI synoptic magnetogram Map.

RHESSIMap(data, header, **kwargs)

RHESSI Image Map.

SJIMap(data, header[, plot_settings])

A 2D IRIS Slit Jaw Imager Map.

SOTMap(data, header, **kwargs)

Hinode SOT Image Map definition.

SUVIMap(data, header, **kwargs)

SUVI Image Map.

SWAPMap(data, header, **kwargs)

PROBA2 SWAP Image Map.

SXTMap(data, header, **kwargs)

Yohkoh SXT Image Map

TRACEMap(data, header, **kwargs)

TRACE Image Map

WISPRMap(data, header, **kwargs)


XRTMap(data, header, **kwargs)

Hinode XRT map definition.

Class Inheritance Diagram#

Inheritance diagram of,,,,,,,,,,,,,,,,,,,,,

Writing a new Instrument Map Class#

Any subclass of GenericMap which defines a method named is_datasource_for will automatically be registered with the Map factory. The is_datasource_for method describes the form of the data and metadata for which the GenericMap subclass is valid. For example it might check the value of the INSTRUMENT key in the metadata dictionary. This makes it straightforward to define your own GenericMap subclass for a new instrument or a custom data source like simulated data. These classes only have to be imported for this to work, as demonstrated by the following example.

class FutureMap(

    def __init__(self, data, header, **kwargs):

        super(FutureMap, self).__init__(data, header, **kwargs)

        # Any Future Instrument specific keyword manipulation

   # Specify a classmethod that determines if the data-header pair matches
   # the new instrument
   def is_datasource_for(cls, data, header, **kwargs):
        """Determines if header corresponds to an AIA image"""
        return str(header.get('instrume', '')).startswith('FUTURESCOPE')

This class will now be available through the Map factory as long as this class has been defined, i.e. imported into the current session.

If you do not want to create a method named is_datasource_for you can manually register your class and matching method using the following method

import, FutureMap.some_matching_method)