From 89165bbd9afa22dbabc6abb856ec16869eac8b19 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 31 Oct 2018 21:34:48 +0800 Subject: bin/get-healpix-patch: Get HEALPix ordering for reprojection --- bin/get-healpix-patch | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch index f985d44..e228962 100755 --- a/bin/get-healpix-patch +++ b/bin/get-healpix-patch @@ -87,16 +87,23 @@ def main(): logger.info("Read HEALPix map from file: %s" % args.infile) hpdata, hpheader = read_fits_healpix(args.infile) nside = hpheader["NSIDE"] - logger.info("Reprojecting HEALPix map to sky patch ...") + try: + ordering = hpheader["ORDERING"] + except KeyError: + logger.warning("No 'ORDERING' keyword for file: %s" % args.infile) + logger.warning("Assume the 'NESTED' ordering") + ordering = "NESTED" + nested = ordering.upper() == "NESTED" try: coordsys = hpheader["COORDSYS"] except KeyError: logger.warning("No 'COORDSYS' keyword for file: %s" % args.infile) logger.warning("Assume to use the 'Galactic' coordinate") coordsys = "Galactic" + logger.info("Reprojecting HEALPix map to sky patch ...") image, __ = reproject_from_healpix(input_data=(hpdata, coordsys), output_projection=sky.wcs, - shape_out=size) + shape_out=size, nested=nested) if args.smooth: logger.info("Smoothing the sky patch with a Gaussian filter ...") -- cgit v1.2.2