Closed elehcim closed 5 years ago
I'm working with mock data, and I'm building the cube from the initializer. I found that my cube.meta
dictionary was empty. Filling it with header['BUNIT']
, is a workaround to the problem.
I was puzzled because the header instead is propagated. That's done implicitly in the _new_cube_with
method.
So I'm going to suggest (a PR when I have time) to add the header itself as a source for getting the "BUNIT" card in BaseSpectralCube.__init__
. In fact, the cube tested in test_regrid.py
is read from fits and in that reader there is the line:
if 'BUNIT' in header:
meta['BUNIT'] = header['BUNIT']
The duplication between meta
dict and header is a bit confusing.
Thanks, this looks like a real error and I'll find a fix for it.
The header and meta dict are intentionally distinct, because the header contains both WCS information (which is stored in the cube.wcs
attribute and replaced by that attribute when the header is accessed) and metadata information. If these are getting desynced, we need to fix that.
Same behaviour with spectral smoothing:
I'm using