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

Add examples on how to create non-equal spaced WCS #688

Open
hayesla opened this issue Apr 24, 2024 · 1 comment
Open

Add examples on how to create non-equal spaced WCS #688

hayesla opened this issue Apr 24, 2024 · 1 comment

Comments

@hayesla
Copy link
Member

hayesla commented Apr 24, 2024

Describe the feature

Its hard to construct a WCS that's not FITS-WCS, say with non-equally spaced values etc

Proposed solution

We should new examples of how to do this, and a helper functions for doing this

@hayesla
Copy link
Member Author

hayesla commented Apr 24, 2024

from the discussion at coordination meeting from @Cadair

from sunpy.net import Fido, attrs as a
import sunpy.map
from ndcube.wcs.wrappers import CompoundLowLevelWCS
from ndcube import NDCube
from ndcube.extra_coords import QuantityTableCoordinate
import astropy.units as u
import matplotlib.pyplot as plt

aia_files = Fido.fetch(Fido.search(a.Time("2023/01/01", "2023/01/01 00:00:11"), a.Instrument.aia))
maps = sunpy.map.Map(aia_files, sequence=True)
# Sort the map sequence in place
maps.maps = list(sorted(maps.maps, key=lambda m: m.wavelength))
waves = u.Quantity([m.wavelength for m in maps])
wave_wcs = QuantityTableCoordinate(waves, physical_types="em.wl", names="wavelength").wcs
cube_wcs = CompoundLowLevelWCS(wave_wcs, maps[0].wcs)
mycube = NDCube(maps.as_array(), wcs=cube_wcs)
mycube.plot(plot_axes=['y', 'x', None])
plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant