Closed xzackli closed 2 years ago
ok, I think I've figured out what is going on. When the image is loaded from disk, sub
is called to trim the wcs to leave only the first two axes. I did it in a sloppy way by simply changing the naxis
field. This works for all 1D fields such as crval
, cdelt
, etc., but it doesn't change naxis
and the linear transformation matrix stored in the linprm
struct in wcs.lin
. For example, after the map has been read from disk (m2
), wcs.naxis=2
but wcs.lin.naxis=3
. This mismatch causes memory overflow when one tries to make a copy of it, resulting in the above error.
I fixed it in #47 by rewriting sub
using wcslib
.
I think the
sub
function is affecting some memory references in the C struct, and does bad things to the WCSTransform.This manifests in a strange way: the
copy
method is broken on such WCS.Here's the MWE @guanyilun
This is related to https://github.com/JuliaAstro/WCS.jl/issues/43