Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for use of reference_date property #345

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions aiapy/calibrate/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def fix_observer_location(smap):
z=smap.meta["haez_obs"] * u.m,
representation_type=CartesianRepresentation,
frame=HeliocentricMeanEcliptic,
obstime=smap.date,
obstime=smap.reference_date,
).heliographic_stonyhurst
# Update header
new_meta = copy.deepcopy(smap.meta)
Expand Down Expand Up @@ -123,16 +123,10 @@ def update_pointing(smap, *, pointing_table=None):
# NOTE: For SDO data, T_OBS is preferred to DATE-OBS in the case of the
# MPT, using DATE-OBS from near the slot boundary might result in selecting
# an incorrect MPT record.
# FIXME: Beginning in sunpy v6.0.0, AIA maps use T_OBS as the reference date
# As such, once that is the min version supported, the following lines should
# be adjusted to just use smap.reference_date
t_obs = smap.meta.get("T_OBS")
if t_obs is None:
warnings.warn(
"T_OBS key is missing from metadata. Falling back to Map.date. "
"This may result in selecting in incorrect record from the "
"master pointing table.",
AiapyUserWarning,
stacklevel=3,
)
t_obs = smap.date
t_obs = astropy.time.Time(t_obs)
t_obs_in_interval = np.logical_and(t_obs >= pointing_table["T_START"], t_obs < pointing_table["T_STOP"])
if not t_obs_in_interval.any():
Expand Down
8 changes: 0 additions & 8 deletions aiapy/calibrate/tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ def test_update_pointing_accuracy(aia_171_map, pointing_table, t_delt_factor, ex
assert aia_map_updated.reference_pixel.y == pointing_table[expected_entry]["A_171_Y0"]
nabobalis marked this conversation as resolved.
Show resolved Hide resolved


@pytest.mark.remote_data()
def test_update_pointing_missing_tobs_raises_warning(aia_171_map, pointing_table):
# Tests that a warning is raised if T_OBS is not present.
aia_171_map.meta.pop("T_OBS")
with pytest.warns(AiapyUserWarning, match="T_OBS key is missing from metadata."):
update_pointing(aia_171_map, pointing_table=pointing_table)


@pytest.mark.remote_data()
def test_update_pointing_submap_raises_exception(aia_171_map, pointing_table):
m = aia_171_map.submap(
Expand Down
Loading