In order to regrid an image, you need some target reprojection. The simplest way to acquire such a reprojection is by extracting it from another image, e.g. a FITS image
(I use >>> to indicate the CASA <#>: prompt here because it allows you to copy & paste the code into CASA)
>>> header = imregrid(imagename='file.image', template='get')
This header will be a python dictionary with two keys, csys, which specifies the coordinate system, and shap, which gives the shape.
If you want to write up your own FITS header and you don't have a FITS file with those exact coordinates, you can use the header_to_template convenience tool in casa_tools.
>>> from casa_tools import header_to_template
>>> from astropy.io import fits
>>> fits_header = fits.Header.fromtextfile('my_header.hdr')
>>> header = header_to_template(fits_header)
In order to regrid the file, you then need to pass in the image name and template to imregrid.
>>> imregrid(imagename='file.image',
... template=header,
... output='file_regrid.image')
If your input image's header did not include a 'telescope' keyword, CASA will complain:
2013-12-18 16:46:33 SEVERE imregrid::ImageRegrid::regrid (file /opt/casa/release-4_1_0-release-1/darwin64/include/casacore/images/Images/ImageRegrid.tcc, line 118) Cannot find the observatory name UNKNOWN in the CASA
You can add the keyword to the header yourself:
>>> imhead('file.image',
... mode='put',
... hdkey='telescope',
... hdvalue='Arecibo')
References
- Sebastian Muller's presentation (page 16)
- imregrid docs