diff --git a/pyproject.toml b/pyproject.toml index c443951d3..509aca3d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ test = [ ] testall = [ "shapely>=2.0.2", # 2.0.2 fixed a bug that causes changes in test results - "sunpy[map]>=2.1", + "sunpy[map]>=6.0.1", "asdf", "gwcs", "pyvo", @@ -92,6 +92,9 @@ filterwarnings = [ "ignore:'xdrlib' is deprecated and slated for removal in Python 3.13", # This is a pyvo issue with Python 3.11 "ignore:'cgi' is deprecated and slated for removal in Python 3.13", + # Issue with zarr and dask mismatch + "ignore:ignoring keyword argument 'read_only'" + ] [tool.coverage.run] diff --git a/reproject/adaptive/tests/reference/test_reproject_adaptive_roundtrip.fits b/reproject/adaptive/tests/reference/test_reproject_adaptive_roundtrip.fits index 0f08aaecf..4a3d3f221 100644 Binary files a/reproject/adaptive/tests/reference/test_reproject_adaptive_roundtrip.fits and b/reproject/adaptive/tests/reference/test_reproject_adaptive_roundtrip.fits differ diff --git a/reproject/adaptive/tests/reference/test_reproject_adaptive_uncentered_jacobian.fits b/reproject/adaptive/tests/reference/test_reproject_adaptive_uncentered_jacobian.fits index 3394b8481..342d0f804 100644 Binary files a/reproject/adaptive/tests/reference/test_reproject_adaptive_uncentered_jacobian.fits and b/reproject/adaptive/tests/reference/test_reproject_adaptive_uncentered_jacobian.fits differ diff --git a/reproject/adaptive/tests/test_core.py b/reproject/adaptive/tests/test_core.py index e11cd0e9b..71903b4aa 100644 --- a/reproject/adaptive/tests/test_core.py +++ b/reproject/adaptive/tests/test_core.py @@ -15,8 +15,6 @@ from ...tests.helpers import array_footprint_to_hdulist from ..high_level import reproject_adaptive -DATA = os.path.join(os.path.dirname(__file__), "..", "..", "tests", "data") - def as_high_level_wcs(wcs): return HighLevelWCSWrapper(SlicedLowLevelWCS(wcs, Ellipsis)) @@ -763,50 +761,14 @@ def test_invald_bad_value_mode(): ) -def prepare_test_data(file_format): - pytest.importorskip("sunpy", minversion="2.1.0") - from sunpy.coordinates.ephemeris import get_body_heliographic_stonyhurst - from sunpy.map import Map - - if file_format == "fits": - map_aia = Map(os.path.join(DATA, "aia_171_level1.fits")) - data = map_aia.data - wcs = map_aia.wcs - date = map_aia.date - target_wcs = wcs.deepcopy() - elif file_format == "asdf": - pytest.importorskip("astropy", minversion="4.0") - pytest.importorskip("gwcs", minversion="0.12") - asdf = pytest.importorskip("asdf") - aia = asdf.open(os.path.join(DATA, "aia_171_level1.asdf")) - data = aia["data"][...] - wcs = aia["wcs"] - date = wcs.output_frame.reference_frame.obstime - target_wcs = Map(os.path.join(DATA, "aia_171_level1.fits")).wcs.deepcopy() - else: - raise ValueError("file_format should be fits or asdf") - - # Reproject to an observer on Venus - - target_wcs.wcs.cdelt = ([24, 24] * u.arcsec).to(u.deg) - target_wcs.wcs.crpix = [64, 64] - venus = get_body_heliographic_stonyhurst("venus", date) - target_wcs.wcs.aux.hgln_obs = venus.lon.to_value(u.deg) - target_wcs.wcs.aux.hglt_obs = venus.lat.to_value(u.deg) - target_wcs.wcs.aux.dsun_obs = venus.radius.to_value(u.m) - - return data, wcs, target_wcs - - @pytest.mark.filterwarnings("ignore::FutureWarning") @pytest.mark.array_compare(single_reference=True) -@pytest.mark.parametrize("file_format", ["fits", "asdf"]) -def test_reproject_adaptive_roundtrip(file_format): +def test_reproject_adaptive_roundtrip(aia_test_data): # Test the reprojection with solar data, which ensures that the masking of # pixels based on round-tripping works correctly. Using asdf is not just # about testing a different format but making sure that GWCS works. - data, wcs, target_wcs = prepare_test_data(file_format) + data, wcs, target_wcs = aia_test_data output, footprint = reproject_adaptive( (data, wcs), target_wcs, (128, 128), center_jacobian=True, kernel="hann" @@ -826,14 +788,14 @@ def test_reproject_adaptive_roundtrip(file_format): @pytest.mark.filterwarnings("ignore::FutureWarning") -@pytest.mark.array_compare() -def test_reproject_adaptive_uncentered_jacobian(): +@pytest.mark.array_compare(single_reference=True) +def test_reproject_adaptive_uncentered_jacobian(aia_test_data): # Explicitly test the uncentered-Jacobian path for a non-affine transform. # For this case, output pixels change by 6% at most, and usually much less. # (Though more nan pixels are present, as the uncentered calculation draws # in values from a bit further away.) - data, wcs, target_wcs = prepare_test_data("fits") + data, wcs, target_wcs = aia_test_data output, footprint = reproject_adaptive( (data, wcs), target_wcs, (128, 128), center_jacobian=False, kernel="hann" diff --git a/reproject/conftest.py b/reproject/conftest.py index ff60d6f47..d8e7ecf2b 100644 --- a/reproject/conftest.py +++ b/reproject/conftest.py @@ -8,6 +8,7 @@ import dask.array as da import numpy as np import pytest +from astropy import units as u from astropy.io import fits from astropy.nddata import NDData from astropy.wcs import WCS @@ -219,3 +220,44 @@ def valid_celestial_output_projections(request, simple_celestial_wcs): output_value = wcs return wcs, shape, output_value, kwargs + + +DATA = os.path.join(os.path.dirname(__file__), "tests", "data") + + +@pytest.fixture(params=["fits", "asdf"]) +def aia_test_data(request): + + pytest.importorskip("sunpy", minversion="6.0.1") + + from sunpy.coordinates.ephemeris import get_body_heliographic_stonyhurst + from sunpy.map import Map + + if request.param == "fits": + map_aia = Map(os.path.join(DATA, "aia_171_level1.fits")) + data = map_aia.data + wcs = map_aia.wcs + date = map_aia.reference_date + target_wcs = wcs.deepcopy() + elif request.param == "asdf": + pytest.importorskip("astropy", minversion="4.0") + pytest.importorskip("gwcs", minversion="0.12") + asdf = pytest.importorskip("asdf") + aia = asdf.open(os.path.join(DATA, "aia_171_level1.asdf")) + data = aia["data"][...] + wcs = aia["wcs"] + date = wcs.output_frame.reference_frame.obstime + target_wcs = Map(os.path.join(DATA, "aia_171_level1.fits")).wcs.deepcopy() + else: + raise ValueError("file_format should be fits or asdf") + + # Reproject to an observer on Venus + + target_wcs.wcs.cdelt = ([24, 24] * u.arcsec).to(u.deg) + target_wcs.wcs.crpix = [64, 64] + venus = get_body_heliographic_stonyhurst("venus", date) + target_wcs.wcs.aux.hgln_obs = venus.lon.to_value(u.deg) + target_wcs.wcs.aux.hglt_obs = venus.lat.to_value(u.deg) + target_wcs.wcs.aux.dsun_obs = venus.radius.to_value(u.m) + + return data, wcs, target_wcs diff --git a/reproject/interpolation/tests/reference/test_reproject_celestial_2d_gal2equ.fits b/reproject/interpolation/tests/reference/test_reproject_celestial_2d_gal2equ.fits index f7be16dbe..5c1b769ea 100644 Binary files a/reproject/interpolation/tests/reference/test_reproject_celestial_2d_gal2equ.fits and b/reproject/interpolation/tests/reference/test_reproject_celestial_2d_gal2equ.fits differ diff --git a/reproject/interpolation/tests/reference/test_reproject_celestial_3d_equ2gal.fits b/reproject/interpolation/tests/reference/test_reproject_celestial_3d_equ2gal.fits index 50f6c8e13..0b502244b 100644 Binary files a/reproject/interpolation/tests/reference/test_reproject_celestial_3d_equ2gal.fits and b/reproject/interpolation/tests/reference/test_reproject_celestial_3d_equ2gal.fits differ diff --git a/reproject/interpolation/tests/reference/test_reproject_roundtrip.fits b/reproject/interpolation/tests/reference/test_reproject_roundtrip.fits index c58639501..9b95cd397 100644 Binary files a/reproject/interpolation/tests/reference/test_reproject_roundtrip.fits and b/reproject/interpolation/tests/reference/test_reproject_roundtrip.fits differ diff --git a/reproject/interpolation/tests/reference/test_small_cutout.fits b/reproject/interpolation/tests/reference/test_small_cutout.fits index 10947a27d..81e2a033c 100644 Binary files a/reproject/interpolation/tests/reference/test_small_cutout.fits and b/reproject/interpolation/tests/reference/test_small_cutout.fits differ diff --git a/reproject/interpolation/tests/test_core.py b/reproject/interpolation/tests/test_core.py index 4df8a3920..1a2d1f208 100644 --- a/reproject/interpolation/tests/test_core.py +++ b/reproject/interpolation/tests/test_core.py @@ -521,47 +521,15 @@ def test_reproject_with_output_array(roundtrip_coords): @pytest.mark.array_compare(single_reference=True) -@pytest.mark.parametrize("file_format", ["fits", "asdf"]) @pytest.mark.remote_data -def test_reproject_roundtrip(file_format): +def test_reproject_roundtrip(aia_test_data): # Test the reprojection with solar data, which ensures that the masking of # pixels based on round-tripping works correctly. Using asdf is not just # about testing a different format but making sure that GWCS works. - # The observer handling changed in 2.1. - pytest.importorskip("sunpy", minversion="2.1.0") - from sunpy.coordinates.ephemeris import get_body_heliographic_stonyhurst - from sunpy.map import Map - - if file_format == "fits": - map_aia = Map(get_pkg_data_filename("data/aia_171_level1.fits", package="reproject.tests")) - data = map_aia.data - wcs = map_aia.wcs - date = map_aia.date - target_wcs = wcs.deepcopy() - elif file_format == "asdf": - pytest.importorskip("astropy", minversion="4.0") - pytest.importorskip("gwcs", minversion="0.12") - asdf = pytest.importorskip("asdf") - aia = asdf.open( - get_pkg_data_filename("data/aia_171_level1.asdf", package="reproject.tests") - ) - data = aia["data"][...] - wcs = aia["wcs"] - date = wcs.output_frame.reference_frame.obstime - target_wcs = Map( - get_pkg_data_filename("data/aia_171_level1.fits", package="reproject.tests") - ).wcs.deepcopy() - else: - raise ValueError("file_format should be fits or asdf") + pytest.importorskip("sunpy", minversion="6.0.1") - # Reproject to an observer on Venus - target_wcs.wcs.cdelt = ([24, 24] * u.arcsec).to(u.deg) - target_wcs.wcs.crpix = [64, 64] - venus = get_body_heliographic_stonyhurst("venus", date) - target_wcs.wcs.aux.hgln_obs = venus.lon.to_value(u.deg) - target_wcs.wcs.aux.hglt_obs = venus.lat.to_value(u.deg) - target_wcs.wcs.aux.dsun_obs = venus.radius.to_value(u.m) + data, wcs, target_wcs = aia_test_data output, footprint = reproject_interp((data, wcs), target_wcs, (128, 128)) @@ -578,31 +546,20 @@ def test_reproject_roundtrip(file_format): return array_footprint_to_hdulist(output, footprint, header_out) -def test_reproject_roundtrip_kwarg(): +def test_reproject_roundtrip_kwarg(aia_test_data): # Make sure that the roundtrip_coords keyword argument has an effect. This # is a regression test for a bug that caused the keyword argument to be # ignored when in parallel/blocked mode. - pytest.importorskip("sunpy", minversion="2.1.0") - from sunpy.coordinates.ephemeris import get_body_heliographic_stonyhurst - from sunpy.map import Map + pytest.importorskip("sunpy", minversion="6.0.1") - map_aia = Map(get_pkg_data_filename("data/aia_171_level1.fits", package="reproject.tests")) - - # Reproject to an observer on Venus - target_wcs = map_aia.wcs.deepcopy() - target_wcs.wcs.cdelt = ([24, 24] * u.arcsec).to(u.deg) - target_wcs.wcs.crpix = [64, 64] - venus = get_body_heliographic_stonyhurst("venus", map_aia.date) - target_wcs.wcs.aux.hgln_obs = venus.lon.to_value(u.deg) - target_wcs.wcs.aux.hglt_obs = venus.lat.to_value(u.deg) - target_wcs.wcs.aux.dsun_obs = venus.radius.to_value(u.m) + data, wcs, target_wcs = aia_test_data output_roundtrip_1 = reproject_interp( - map_aia, target_wcs, shape_out=(128, 128), return_footprint=False, roundtrip_coords=True + (data, wcs), target_wcs, shape_out=(128, 128), return_footprint=False, roundtrip_coords=True ) output_roundtrip_2 = reproject_interp( - map_aia, + (data, wcs), target_wcs, shape_out=(128, 128), return_footprint=False, @@ -613,10 +570,14 @@ def test_reproject_roundtrip_kwarg(): assert_allclose(output_roundtrip_1, output_roundtrip_2) output_noroundtrip_1 = reproject_interp( - map_aia, target_wcs, shape_out=(128, 128), return_footprint=False, roundtrip_coords=False + (data, wcs), + target_wcs, + shape_out=(128, 128), + return_footprint=False, + roundtrip_coords=False, ) output_noroundtrip_2 = reproject_interp( - map_aia, + (data, wcs), target_wcs, shape_out=(128, 128), return_footprint=False, diff --git a/reproject/mosaicking/tests/reference/test_coadd_solar_map.fits b/reproject/mosaicking/tests/reference/test_coadd_solar_map.fits index 70fb6612f..0bd4c27e1 100644 Binary files a/reproject/mosaicking/tests/reference/test_coadd_solar_map.fits and b/reproject/mosaicking/tests/reference/test_coadd_solar_map.fits differ diff --git a/reproject/mosaicking/tests/test_coadd.py b/reproject/mosaicking/tests/test_coadd.py index 7aefa11fb..6641ea481 100644 --- a/reproject/mosaicking/tests/test_coadd.py +++ b/reproject/mosaicking/tests/test_coadd.py @@ -371,9 +371,7 @@ def test_coadd_solar_map(): # and combine them into a single one. This uses weight maps that are not # uniform and also include NaN values. - # The reference image was generated for sunpy 6.0.0 - it will not work - # for previous versions. - pytest.importorskip("sunpy", minversion="6.0.0") + pytest.importorskip("sunpy", minversion="6.0.1") from sunpy.map import Map, all_coordinates_from_map # Load in three images from different viewpoints around the Sun diff --git a/reproject/mosaicking/tests/test_wcs_helpers.py b/reproject/mosaicking/tests/test_wcs_helpers.py index 96d621a75..f82439132 100644 --- a/reproject/mosaicking/tests/test_wcs_helpers.py +++ b/reproject/mosaicking/tests/test_wcs_helpers.py @@ -320,7 +320,7 @@ def test_solar_wcs(): # Regression test for issues that occurred when trying to find # the optimal WCS for a set of solar WCSes - pytest.importorskip("sunpy", minversion="2.1.0") + pytest.importorskip("sunpy", minversion="6.0.1") # Make sure the WCS <-> frame functions are registered diff --git a/reproject/tests/data/aia_171_level1.asdf b/reproject/tests/data/aia_171_level1.asdf index 957d76ce3..001010942 100644 --- a/reproject/tests/data/aia_171_level1.asdf +++ b/reproject/tests/data/aia_171_level1.asdf @@ -12,6 +12,11 @@ history: extension_uri: asdf://asdf-format.org/core/extensions/core-1.5.0 manifest_software: !core/software-1.0.0 {name: asdf_standard, version: 1.1.1} software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} + - !core/extension_metadata-1.0.0 + extension_class: asdf.extension._manifest.ManifestExtension + extension_uri: asdf://asdf-format.org/astronomy/gwcs/extensions/gwcs-1.2.0 + manifest_software: !core/software-1.0.0 {name: asdf_wcs_schemas, version: 0.4.0} + software: !core/software-1.0.0 {name: gwcs, version: 0.21.0} - !core/extension_metadata-1.0.0 extension_class: asdf.extension._manifest.ManifestExtension extension_uri: asdf://asdf-format.org/transform/extensions/transform-1.5.0 @@ -23,13 +28,8 @@ history: software: !core/software-1.0.0 {name: asdf-astropy, version: 0.6.1} - !core/extension_metadata-1.0.0 extension_class: asdf.extension._manifest.ManifestExtension - extension_uri: asdf://asdf-format.org/astronomy/gwcs/extensions/gwcs-1.2.0 - manifest_software: !core/software-1.0.0 {name: asdf_wcs_schemas, version: 0.4.0} - software: !core/software-1.0.0 {name: gwcs, version: 0.21.0} - - !core/extension_metadata-1.0.0 - extension_class: asdf.extension._manifest.ManifestExtension - extension_uri: asdf://sunpy.org/extensions/sunpy-1.1.0 - software: !core/software-1.0.0 {name: sunpy, version: 5.1.5} + extension_uri: asdf://sunpy.org/extensions/sunpy-1.1.1 + software: !core/software-1.0.0 {name: sunpy, version: 6.0.2} - !core/extension_metadata-1.0.0 extension_class: asdf.extension._manifest.ManifestExtension extension_uri: asdf://asdf-format.org/astronomy/coordinates/extensions/coordinates-1.1.0 @@ -332,21 +332,21 @@ wcs: ! data: ! components: distance: !unit/quantity-1.1.0 {datatype: float64, unit: !unit/unit-1.0.0 m, - value: 147724815127.9968} + value: 147724815127.99683} lat: ! {datatype: float64, - unit: !unit/unit-1.0.0 deg, value: -6.821923074710445} + unit: !unit/unit-1.0.0 deg, value: -6.821923074710443} lon: ! datatype: float64 unit: !unit/unit-1.0.0 deg - value: 359.98690027534224 + value: 359.9868885126059 wrap_angle: ! { datatype: float64, unit: !unit/unit-1.0.0 deg, value: 360.0} type: SphericalRepresentation frame_attributes: - obstime: !time/time-1.1.0 2011-02-15T00:00:00.340 + obstime: !time/time-1.1.0 2011-02-15T00:00:01.340 rsun: !unit/quantity-1.1.0 {datatype: float64, unit: !unit/unit-1.0.0 km, value: 696000.0} - obstime: !time/time-1.1.0 2011-02-15T00:00:00.340 + obstime: !time/time-1.1.0 2011-02-15T00:00:01.340 rsun: !unit/quantity-1.1.0 {datatype: float64, unit: !unit/unit-1.0.0 km, value: 696000.0} unit: [!unit/unit-1.0.0 arcsec, !unit/unit-1.0.0 arcsec] diff --git a/reproject/tests/test_high_level.py b/reproject/tests/test_high_level.py index 90d23ae51..6bdb2cec8 100644 --- a/reproject/tests/test_high_level.py +++ b/reproject/tests/test_high_level.py @@ -279,7 +279,7 @@ def test_dask_schedulers(reproject_function, scheduler, wcs_type): wcs_out = WCS(hdu_out.header) shape_out = hdu_out.data.shape elif wcs_type == "gwcs": - pytest.importorskip("sunpy", minversion="2.1.0") + pytest.importorskip("sunpy", minversion="6.0.1") asdf = pytest.importorskip("asdf") if reproject_function == reproject_exact: pytest.skip()