aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/healpix2hpx9
-rwxr-xr-xbin/hpx2healpix10
-rwxr-xr-xbin/zea2healpix10
3 files changed, 24 insertions, 5 deletions
diff --git a/bin/healpix2hpx b/bin/healpix2hpx
index 2a0e6a4..6f30795 100755
--- a/bin/healpix2hpx
+++ b/bin/healpix2hpx
@@ -62,11 +62,18 @@ def main():
'See also {0}'.format(fg21sim.__url__)
]
+ if os.path.exists(args.outfile):
+ if args.clobber:
+ logger.warning("Remove existing output file: %s" % args.outfile)
+ os.remove(args.outfile)
+ else:
+ raise OSError("Output file already exists: %s" % args.outfile)
+
hpx_data, hpx_header = healpix2hpx(args.infile,
append_history=history,
append_comment=comments)
hdu = fits.PrimaryHDU(data=hpx_data, header=hpx_header)
- hdu.writeto(args.outfile, clobber=args.clobber, checksum=True)
+ hdu.writeto(args.outfile, checksum=True)
logger.info("HPX FITS images write to: %s" % args.outfile)
diff --git a/bin/hpx2healpix b/bin/hpx2healpix
index ca485ac..bbc3e0d 100755
--- a/bin/hpx2healpix
+++ b/bin/hpx2healpix
@@ -60,11 +60,17 @@ def main():
'See also {0}'.format(fg21sim.__url__)
]
+ if os.path.exists(args.outfile):
+ if args.clobber:
+ logger.warning("Remove existing output file: %s" % args.outfile)
+ os.remove(args.outfile)
+ else:
+ raise OSError("Output file already exists: %s" % args.outfile)
+
hp_data, hp_header = hpx2healpix(args.infile,
append_history=history,
append_comment=comments)
- write_fits_healpix(args.outfile, hpmap=hp_data, header=hp_header,
- clobber=args.clobber)
+ write_fits_healpix(args.outfile, hpmap=hp_data, header=hp_header)
logger.info("HEALPix data write to FITS file: %s" % args.outfile)
diff --git a/bin/zea2healpix b/bin/zea2healpix
index 33cb694..334bf6d 100755
--- a/bin/zea2healpix
+++ b/bin/zea2healpix
@@ -76,14 +76,20 @@ def main():
'See also {0}'.format(fg21sim.__url__)
]
+ if os.path.exists(args.outfile):
+ if args.clobber:
+ logger.warning("Remove existing output file: %s" % args.outfile)
+ os.remove(args.outfile)
+ else:
+ raise OSError("Output file already exists: %s" % args.outfile)
+
hp_data, hp_header, __ = zea2healpix(args.infile1, args.infile2,
nside=args.nside,
order=args.interp_order,
inpaint=args.inpaint,
append_history=history,
append_comment=comments)
- write_fits_healpix(args.outfile, hpmap=hp_data, header=hp_header,
- clobber=args.clobber)
+ write_fits_healpix(args.outfile, hpmap=hp_data, header=hp_header)
logger.info("HEALPix data write to FITS file: %s" % args.outfile)