reproject_interp

reproject.reproject_interp(input_data, output_projection, shape_out=None, hdu_in=0, order='bilinear', roundtrip_coords=True, output_array=None, output_footprint=None, return_footprint=True, block_size=None, parallel=False, return_type=None)[source]

Reproject data to a new projection using interpolation (this is typically the fastest way to reproject an image).

Parameters:
input_dataobject

The input data to reproject. This can be:

If the data array contains more dimensions than are described by the input header or WCS, the extra dimensions (assumed to be the first dimensions) are taken to represent multiple images with the same coordinate information. The coordinate transformation will be computed once and then each image will be reprojected, offering a speedup over reprojecting each image individually.

output_projectionBaseLowLevelWCS or BaseHighLevelWCS or Header

The output projection, which can be either a BaseLowLevelWCS, BaseHighLevelWCS, or a Header instance.

shape_outtuple, optional

If output_projection is a WCS instance, the shape of the output data should be specified separately.

hdu_inint or str, optional

If input_data is a FITS file or an HDUList instance, specifies the HDU to use.

orderint or str, optional

The order of the interpolation. This can be any of the following strings:

  • ‘nearest-neighbor’

  • ‘bilinear’

  • ‘biquadratic’

  • ‘bicubic’

or an integer. A value of 0 indicates nearest neighbor interpolation.

roundtrip_coordsbool

Whether to verify that coordinate transformations are defined in both directions.

output_arrayNone or ndarray

An array in which to store the reprojected data. This can be any numpy array including a memory map, which may be helpful when dealing with extremely large files.

output_footprintndarray, optional

An array in which to store the footprint of reprojected data. This can be any numpy array including a memory map, which may be helpful when dealing with extremely large files.

return_footprintbool

Whether to return the footprint in addition to the output array.

block_sizetuple or ‘auto’, optional

The size of blocks in terms of output array pixels that each block will handle reprojecting. Extending out from (0,0) coords positively, block sizes are clamped to output space edges when a block would extend past edge. Specifying 'auto' means that reprojection will be done in blocks with the block size automatically determined. If block_size is not specified or set to None, the reprojection will not be carried out in blocks.

parallelbool or int or str, optional

If True, the reprojection is carried out in parallel, and if a positive integer, this specifies the number of threads to use. The reprojection will be parallelized over output array blocks specified by block_size (if the block size is not set, it will be determined automatically). To use the currently active dask scheduler (e.g. dask.distributed), set this to 'current-scheduler'.

return_type{‘numpy’, ‘dask’}, optional

Whether to return numpy or dask arrays - defaults to ‘numpy’.

Returns:
array_newndarray

The reprojected array.

footprintndarray

Footprint of the input array in the output array. Values of 0 indicate no coverage or valid values in the input image, while values of 1 indicate valid values.