Crop `.plot()` issues with CHASE Data

Open
#258 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
matplotlib, python

Research direction

Start with the supplied SpectrogramCube.crop and crop.plot reproduction using the linked CHASE FITS file. Compare crop.plot() with crop[71].plot() and inspect the wavelength grid produced for the cropped cube. Done means the cropped cube displays the correct wavelength grid and data across its planes, with regression coverage added if the relevant test location is identified.

Written by the indexing model from the issue text.

Description

Describe the bug

I am using sunraster with CHASE data, and it has worked almost perfectly out of the box, thanks! I have encountered a strange issue whereby .plot() works fine on the spectrogram cube, and on a wavelength plane of the cropped cube (e.g. crop[71].plot()), but crop.plot() has a very strange wavelength grid. The first few planes appear correct (it's hard to be certain), but then the data seems to be wrong.

CHASE data can be acquired from SSDC here but this requires registration and login, so I have also made one file available on my OneDrive here.

To Reproduce
from astropy.io import fits
from astropy.wcs import WCS
import astropy.units as u
import matplotlib.pyplot as plt
from sunraster import SpectrogramCube
import numpy as np
from sunpy.coordinates import frames
from astropy.coordinates import SkyCoord

data = fits.open("RSM20240321T000051_0005_HA.fits")
data[1].header["CTYPE1"] = "HPLT-TAN"
data[1].header["CTYPE2"] = "HPLN-TAN"
data[1].header["CTYPE3"] = "WAVE"
wcs = WCS(data[1].header)

array = data[1].data
cube = SpectrogramCube(array, wcs, unit=u.DN)

pt1 = [SkyCoord(0*u.arcsec, 0*u.arcsec, frame=frames.Helioprojective), None]
pt2 = [SkyCoord(250*u.arcsec, 250*u.arcsec, frame=frames.Helioprojective), None]

crop = cube.crop(pt1, pt2)
Screenshots

Result of crop.plot
image

System Details
sunraster: 0.5.1
==============================
sunpy Installation Information
==============================

General
#######
OS: Ubuntu (22.04, Linux 5.15.146.1-microsoft-standard-WSL2)
Arch: 64bit, (x86_64)
sunpy: 5.1.4
Installation path: /home/cmo/miniconda3/envs/Dask312/lib/python3.12/site-packages/sunpy-5.1.4.dist-info

Required Dependencies
#####################
astropy: 6.1.0
numpy: 1.26.4
packaging: 24.0
parfive: 2.1.0
pyerfa: 2.0.1.4

Optional Dependencies
#####################
asdf: 3.2.0
asdf-astropy: 0.6.1
beautifulsoup4: 4.12.3
cdflib: Missing cdflib!=0.4.0,!=1.0.0,>=0.3.20; extra == "docs" or "tests" or "timeseries"
dask: 2024.5.1
drms: 0.6.4
glymur: Missing glymur!=0.9.5,>=0.9.1; extra == "docs" or "jpeg2000" or "tests"
h5netcdf: 1.3.0
h5py: 3.11.0
lxml: 5.2.2
matplotlib: 3.9.0
mpl-animators: 1.1.1
pandas: 2.2.2
python-dateutil: 2.9.0.post0
reproject: 0.13.1
scikit-image: Missing scikit-image>=0.18.0; extra == "docs" or "image" or "tests"
scipy: 1.13.1
sqlalchemy: Missing sqlalchemy>=1.3.4; extra == "database" or "docs" or "tests"
tqdm: 4.66.4
zeep: 4.2.1
Installation method

pip

Dominant language
Python
Stars
21
Forks
25
Avg merge
15h 30m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/sunraster

All issues in sunpy/sunraster

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.