Re-projecting from CAR to CEA#

The sunkit_magex.pfss solver takes a cylindrical-equal-area (CEA) projected magnetic field map as input, which is equally spaced in sin(latitude). Some synoptic field maps are equally spaced in latitude, a plate carée (CAR) projection, and need reprojecting.

This example shows how to use the sunkit_magex.pfss.utils.car_to_cea function to reproject a CAR projection to a CEA projection that sunkit_magex.pfss can take as input.

import matplotlib.pyplot as plt

import sunpy.map

from sunkit_magex import pfss

Load a sample ADAPT map, which has a CAR projection.

adapt_map_car = sunpy.map.Map(pfss.sample_data.get_adapt_map(), hdus=0)
Files Downloaded:   0%|          | 0/1 [00:00<?, ?file/s]

sunkit_magex.adapt40311_044012_202010100000_i00005600n1.fts.gz:   0%|          | 0.00/3.11M [00:00<?, ?B/s]

sunkit_magex.adapt40311_044012_202010100000_i00005600n1.fts.gz:   1%|▏         | 40.9k/3.11M [00:00<00:07, 408kB/s]

sunkit_magex.adapt40311_044012_202010100000_i00005600n1.fts.gz:  29%|██▊       | 888k/3.11M [00:00<00:00, 5.14MB/s]

sunkit_magex.adapt40311_044012_202010100000_i00005600n1.fts.gz:  98%|█████████▊| 3.05M/3.11M [00:00<00:00, 11.4MB/s]


Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  2.29file/s]
Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  2.28file/s]
/home/docs/checkouts/readthedocs.org/user_builds/sunkit-magex/conda/latest/lib/python3.12/site-packages/sunpy/map/mapbase.py:249: SunpyUserWarning: This file contains more than 2 dimensions. Data will be truncated to the first two dimensions.
  warn_user("This file contains more than 2 dimensions. "

Re-project into a CEA projection.

adapt_map_cea = pfss.utils.car_to_cea(adapt_map_car)
INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]
/home/docs/checkouts/readthedocs.org/user_builds/sunkit-magex/conda/latest/lib/python3.12/site-packages/sunpy/map/mapbase.py:671: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: dsun_obs,hglt_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crlt_obs,crln_obs,dsun_obs

  obs_coord = self.observer_coordinate

Plot the original map and the reprojected map.

fig = plt.figure(figsize=(12, 6))
ax = fig.add_subplot(1, 2, 1, projection=adapt_map_car)
ax1 = fig.add_subplot(1, 2, 2, projection=adapt_map_cea)

adapt_map_car.plot(axes=ax)
adapt_map_cea.plot(axes=ax1)

fig.tight_layout()

plt.show()
2020-10-10 00:00:00,  2020-10-10 00:00:00

Total running time of the script: (0 minutes 1.261 seconds)

Gallery generated by Sphinx-Gallery