From 0c0eabde8326d11316ad6942cdd72be457c41947 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 6 May 2015 22:53:55 +0200 Subject: [PATCH 1/2] In HEALPIX, some coordinates end up being NaN but we want to avoid Numpy warnings --- reproject/healpix/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reproject/healpix/core.py b/reproject/healpix/core.py index 6f8e76419..0b93ae267 100644 --- a/reproject/healpix/core.py +++ b/reproject/healpix/core.py @@ -76,7 +76,8 @@ def healpix_to_image(healpix_data, coord_system_in, wcs_out, shape_out, # Convert between celestial coordinates coord_system_in = parse_coord_system(coord_system_in) - lon_in, lat_in = convert_world_coordinates(lon_out, lat_out, wcs_out, (coord_system_in, u.deg, u.deg)) + with np.errstate(invalid='ignore'): + lon_in, lat_in = convert_world_coordinates(lon_out, lat_out, wcs_out, (coord_system_in, u.deg, u.deg)) # Convert from lon, lat in degrees to colatitude theta, longitude phi, # in radians @@ -159,7 +160,8 @@ def image_to_healpix(data, wcs_in, coord_system_out, # Convert between celestial coordinates coord_system_out = parse_coord_system(coord_system_out) - lon_in, lat_in = convert_world_coordinates(lon_out, lat_out, (coord_system_out, u.deg, u.deg), wcs_in) + with np.errstate(invalid='ignore'): + lon_in, lat_in = convert_world_coordinates(lon_out, lat_out, (coord_system_out, u.deg, u.deg), wcs_in) # Look up pixels in input system yinds, xinds = wcs_in.wcs_world2pix(lon_in, lat_in, 0) From 2a39d34d8397f60afeaf44a7b5f732dfefca484f Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 6 May 2015 22:57:34 +0200 Subject: [PATCH 2/2] Ignore a warning in the exact mode reprojection --- reproject/spherical_intersect/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reproject/spherical_intersect/core.py b/reproject/spherical_intersect/core.py index c8a0dcaca..1b60cc1a3 100644 --- a/reproject/spherical_intersect/core.py +++ b/reproject/spherical_intersect/core.py @@ -187,7 +187,10 @@ def parallel_impl(nproc): pool.close() pool.join() - return array_new / weights, weights + with np.errstate(invalid='ignore'): + array_new /= weights + + return array_new, weights if _method == "c" and (nproc is None or nproc > 1): try: