Skip to content

Print warning if no wcs is provided in write_map #274

@zonca

Description

@zonca

write_map attaches a default WCS if the input map has no WCS, it might be useful to add a warning (or even an error) if this happens. This can be a source of bugs if a user is not careful (e.g. galsci/pysm#192) @msyriac

Minimal example below:

import pixell.enmap
import numpy as np

shape, wcs = pixell.enmap.fullsky_geometry(
    np.radians(5),
    dims=(3,),
    variant="fejer1",
)

m = pixell.enmap.zeros(shape, wcs)
pixell.enmap.write_map("map_with_wcs.fits", m)
pixell.enmap.write_map("map_no_wcs.fits", np.array(m))

print(pixell.enmap.read_map("map_with_wcs.fits").wcs)
car:{cdelt:[-5,5],crval:[2.5,0],crpix:[36.50,18.50]}

print(pixell.enmap.read_map("map_no_wcs.fits").wcs)
:{cdelt:[1,1],crval:[0,0],crpix:[0.00,0.00]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions