<commit_before>====
Maps
====

Maps in SunPy are are 2-dimensional data associated with a coordinate system.
In this guide, we will cover some of the basic functionality of maps.
Once you've read through this guide check out
the :doc:`/code_ref/map` for a more thorough look at SunPy maps.
There you can see what instruments are currently supported or you can access the
code reference for each instrument-specific map subclass.

Creating maps
-------------
To make things easy, SunPy can download several example files which are used
throughout the docs. These files have names like
`~sunpy.data.sample.AIA_171_IMAGE` and `~sunpy.data.sample.RHESSI_IMAGE`.
To create the sample `sunpy.map.sources.sdo.AIAMap` type the following into your
interactive Python shell::

    >>> import sunpy
    >>> import sunpy.map
    >>> import sunpy.data.sample
    >>> my_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)

If you have not downloaded the data already you should get an error and some
instruction on how to download the sample data.

The variable my_map is a :ref:`map` object. To create one from a
local FITS file try the following::

    >>> my_map = sunpy.map.Map('/mydirectory/mymap.fits')   # doctest: +SKIP

SunPy should automatically detects the type of file (e.g. FITS), what instrument it is
associated with (e.g. AIA, EIT, LASCO) and will automatically look in the
appropriate places for the FITS keywords it needs to interpret the coordinate
system. If the type of FITS file is not recognized then SunPy will try some
default FITS keywords and return a `~sunpy.map.GenericMap` but results
may vary. SunPy can also create maps from the jpg2000 files from
`helioviewer.org <http://helioviewer.org/>`_.

Creating Custom Maps
--------------------
It is also possible to create maps using custom data (e.g. from a simulation).
To do this you need to provide `~sunpy.map.map_factory.MapFactory` with both the data array as
well as some basic meta information. If no header is given then some default
values as assumed. Here is a simple example::

    >>> import numpy as np
    >>> data = np.arange(0,100).reshape(10,10)
    >>> header = {'cdelt1': 10, 'cdelt2': 10, 'telescope':'sunpy'}
    >>> my_map = sunpy.map.Map(data, header)

The keys in the header follows the `FITS standard <http://fits.gsfc.nasa.gov/fits_dictionary.html>`_.

Inspecting maps
---------------
A map contains a number of data-associated attributes. To get a quick look at
your map simply type::

    >>> my_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
    >>> my_map   # doctest: +NORMALIZE_WHITESPACE
    SunPy AIAMap
    ---------
    Observatory:         SDO
    Instrument:  AIA 3
    Detector:    AIA
    Measurement:         171.0 Angstrom
    Wavelength:  171.0 Angstrom
    Obs Date:    2011-03-19 10:54:00
    dt:          1.999601 s
    Dimension:   [ 1024.  1024.] pix
    scale:               [ 2.4  2.4] arcsec / pix
    <BLANKLINE>
    array([[ 0.3125, -0.0625, -0.125 , ...,  0.625 , -0.625 ,  0.    ],
           [ 1.    ,  0.1875, -0.8125, ...,  0.625 , -0.625 ,  0.    ],
           [-1.1875,  0.375 , -0.5   , ..., -0.125 , -0.625 , -1.1875],
           ...,<commit_msg>Fixing typo<commit_after>====
Maps
====

Maps in SunPy are are 2-dimensional data associated with a coordinate system.
In this guide, we will cover some of the basic functionality of maps.
Once you've read through this guide check out
the :doc:`/code_ref/map` for a more thorough look at SunPy maps.
There you can see what instruments are currently supported or you can access the
code reference for each instrument-specific map subclass.

Creating maps
-------------
To make things easy, SunPy can download several example files which are used
throughout the docs. These files have names like
`~sunpy.data.sample.AIA_171_IMAGE` and `~sunpy.data.sample.RHESSI_IMAGE`.
To create the sample `sunpy.map.sources.sdo.AIAMap` type the following into your
interactive Python shell::

    >>> import sunpy
    >>> import sunpy.map
    >>> import sunpy.data.sample
    >>> my_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)

If you have not downloaded the data already you should get an error and some
instruction on how to download the sample data.

The variable my_map is a :ref:`map` object. To create one from a
local FITS file try the following::

    >>> my_map = sunpy.map.Map('/mydirectory/mymap.fits')   # doctest: +SKIP

SunPy should automatically detects the type of file (e.g. FITS), what instrument it is
associated with (e.g. AIA, EIT, LASCO) and will automatically look in the
appropriate places for the FITS keywords it needs to interpret the coordinate
system. If the type of FITS file is not recognized then SunPy will try some
default FITS keywords and return a `~sunpy.map.GenericMap` but results
may vary. SunPy can also create maps from the jpg2000 files from
`helioviewer.org <http://helioviewer.org/>`_.

Creating Custom Maps
--------------------
It is also possible to create maps using custom data (e.g. from a simulation).
To do this you need to provide `~sunpy.map.map_factory.MapFactory` with both the data array as
well as some basic meta information. If no header is given then some default
values as assumed. Here is a simple example::

    >>> import numpy as np
    >>> data = np.arange(0,100).reshape(10,10)
    >>> header = {'cdelt1': 10, 'cdelt2': 10, 'telescop':'sunpy'}
    >>> my_map = sunpy.map.Map(data, header)

The keys in the header follows the `FITS standard <http://fits.gsfc.nasa.gov/fits_dictionary.html>`_.

Inspecting maps
---------------
A map contains a number of data-associated attributes. To get a quick look at
your map simply type::

    >>> my_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
    >>> my_map   # doctest: +NORMALIZE_WHITESPACE
    SunPy AIAMap
    ---------
    Observatory:         SDO
    Instrument:  AIA 3
    Detector:    AIA
    Measurement:         171.0 Angstrom
    Wavelength:  171.0 Angstrom
    Obs Date:    2011-03-19 10:54:00
    dt:          1.999601 s
    Dimension:   [ 1024.  1024.] pix
    scale:               [ 2.4  2.4] arcsec / pix
    <BLANKLINE>
    array([[ 0.3125, -0.0625, -0.125 , ...,  0.625 , -0.625 ,  0.    ],
           [ 1.    ,  0.1875, -0.8125, ...,  0.625 , -0.625 ,  0.    ],
           [-1.1875,  0.375 , -0.5   , ..., -0.125 , -0.625 , -1.1875],
           ...,
{'fraction_non_alphanumeric': 0.11640711027214094, 'fraction_numerical': 0.04310209218184678, 'mean_word_length': 2.8393719806763285, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5269149', 'n_tokens_mistral': 2190, 'n_tokens_neox': 1971, 'n_words': 777}