forked from sunpy/sunkit-magex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Custom `sunpy.map.GenericMap` sub-classes for different magnetogram sources. | ||
""" | ||
import sunpy.map | ||
|
||
__all__ = ['ADAPTMap'] | ||
|
||
|
||
class ADAPTMap(sunpy.map.GenericMap): | ||
def __init__(self, data, header, **kwargs): | ||
if 'date-obs' not in header: | ||
header['date-obs'] = header['maptime'] | ||
# Fix CTYPE | ||
if header['ctype1'] == 'Long': | ||
header['ctype1'] = 'CRLN-CAR' | ||
if header['ctype2'] == 'Lat': | ||
header['ctype2'] = 'CRLT-CAR' | ||
|
||
super().__init__(data, header, **kwargs) | ||
|
||
@classmethod | ||
def is_datasource_for(cls, data, header, **kwargs): | ||
"""Determines if header corresponds to an ADAPT map.""" | ||
return header.get('model') == 'ADAPT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import astropy.io | ||
|
||
import sunpy.map | ||
|
||
import sunkit_magex.pfss.map | ||
|
||
|
||
def test_adapt_map(adapt_test_file): | ||
with astropy.io.fits.open(adapt_test_file) as adapt_fits: | ||
for map_slice in adapt_fits[0].data: | ||
m = sunpy.map.Map((map_slice, adapt_fits[0].header)) | ||
assert isinstance(m, sunkit_magex.pfss.map.ADAPTMap) |