Map

sunpy.map.Map = <sunpy.map.map_factory.MapFactory object>

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.

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

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

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

Returns:

Examples

>>> import sunpy.map
>>> from astropy.io import fits
>>> import sunpy.data.sample  
>>> mymap = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)  

The SunPy Map factory accepts a wide variety of inputs for creating maps

  • Preloaded tuples of (data, header) pairs

>>> mymap = sunpy.map.Map((data, header))   

headers are some base of dict or collections.OrderedDict, including sunpy.io.header.FileHeader or sunpy.util.metadata.MetaDict classes.

  • data, header pairs, not in tuples

>>> mymap = sunpy.map.Map(data, header)   
  • data, wcs object, in tuple

>>> from astropy.wcs import WCS
>>> wcs = WCS(sunpy.data.sample.AIA_171_ROLL_IMAGE)  
>>> data = fits.getdata(sunpy.data.sample.AIA_171_ROLL_IMAGE)  
>>> mymap = sunpy.map.Map((data, wcs))  
  • data, wcs object, not in tuple

>>> from astropy.wcs import WCS
>>> wcs = WCS(sunpy.data.sample.AIA_171_ROLL_IMAGE)  
>>> data = fits.getdata(sunpy.data.sample.AIA_171_ROLL_IMAGE)  
>>> mymap = sunpy.map.Map(data, wcs)  
  • File names

>>> mymap = sunpy.map.Map('file1.fits')   
  • All fits files in a directory by giving a directory

>>> mymap = sunpy.map.Map('local_dir/sub_dir')   
>>> import pathlib
>>> mymap = sunpy.map.Map(pathlib.Path('file1.fits'))   
>>> sub_dir = pathlib.Path('local_dir/sub_dir')
>>> mymap = sunpy.map.Map(sub_dir)   
>>> mymap = sunpy.map.Map(sub_dir / 'file3.fits')   
  • Some regex globs

>>> mymap = sunpy.map.Map('eit_*.fits')   
  • URLs

>>> mymap = sunpy.map.Map(url_str)   
  • DatabaseEntry

>>> mymap = sunpy.map.Map(db_result)   
  • Lists of any of the above

>>> mymap = sunpy.map.Map(['file1.fits', 'file2.fits', 'file3.fits', 'directory1/'])  
  • Any mixture of the above not in a list

>>> mymap = sunpy.map.Map(((data, header), data2, header2, 'file1.fits', url_str, 'eit_*.fits'))