Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Fix up reprojection example
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jan 24, 2022
1 parent 07b541f commit 7337173
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/plot_coadd.py
Expand Up @@ -24,8 +24,8 @@
###############################################################################
# Download STEREO maps
maps_in_stereo = []
for i in range(10):
d = datetime.now() - timedelta(days=i) - timedelta(days=2)
for i in range(2):
d = datetime.now() - timedelta(days=i) - timedelta(days=1)
smap = stereo_start_of_day_map(d)
# Normalise to AIA
data = (smap.data - 720.0) * 110 / 170
Expand All @@ -36,8 +36,8 @@
###############################################################################
# Download AIA maps
maps_in_aia = []
for i in range(17):
d = datetime.now() - timedelta(days=i) - timedelta(days=2)
for i in range(2):
d = datetime.now() - timedelta(days=i) - timedelta(days=1)
maps_in_aia.append(aia_start_of_day_map(d, 193 * u.Angstrom))

norm = maps_in_aia[0].plot_settings['norm']
Expand Down
9 changes: 9 additions & 0 deletions solarsynoptic/reprojection/reprojection.py
Expand Up @@ -6,6 +6,7 @@
from astropy.coordinates import SkyCoord
from astropy.wcs import WCS
from reproject import reproject_interp
from sunpy.sun import constants
from sunpy import log
from sunpy.map import Map, make_fitswcs_header

Expand Down Expand Up @@ -34,6 +35,14 @@ def reproject_carrington(smap, shape_out, latitude_projection='CAR',
carrington_map : sunpy.map.Genericmap
Reprojected map.
"""
rsun_m = constants.radius.to_value(u.m)
if 'rsun_ref' not in smap.meta:
log.info('Setting rsun_ref in metadata')
smap.meta['rsun_ref'] = rsun_m
elif smap.meta['rsun_ref'] != rsun_m:
log.info('Overwriting rsun_ref with standard photospheric radius')
smap.meta['rsun_ref'] = rsun_m

map_out = None
if cache:
from solarsynoptic.reprojection.database import DATABASE
Expand Down

0 comments on commit 7337173

Please sign in to comment.