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, non_reprojected_dims=None, parallel=False, return_type=None, dask_method=None, zarr_path=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:
The name of a FITS file as a
stror apathlib.PathobjectAn
HDUListobjectAn image HDU object such as a
PrimaryHDU,ImageHDU, orCompImageHDUinstanceA tuple where the first element is a
ndarrayand the second element is either aBaseLowLevelWCS,BaseHighLevelWCS, or aHeaderobjectAn
NDDataobject from which the.dataand.wcsattributes will be used as the input data.The name of a PNG or JPEG file with AVM metadata
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_projection
BaseLowLevelWCSorBaseHighLevelWCSorHeader The output projection, which can be either a
BaseLowLevelWCS,BaseHighLevelWCS, or aHeaderinstance.- shape_outtuple, optional
If
output_projectionis a WCS instance, the shape of the output data should be specified separately.- hdu_inint or str, optional
If
input_datais a FITS file or anHDUListinstance, 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
0indicates 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_footprint
ndarray, 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. Ifblock_sizeis not specified or set toNone, the reprojection will not be carried out in blocks.- non_reprojected_dimstuple, optional
Leading dimensions of the data that should not be reprojected but for which a one-to-one mapping between input and output pixels is assumed. This makes it possible to broadcast a reprojection over these dimensions even when the input and output WCS have the same number of dimensions as the data. The dimensions must be the leading ones, given as a tuple of sequential integers starting from zero (e.g.
(0,)or(0, 1)). This currently requires passing ablock_sizewhose entries along the reprojected dimensions matchshape_out(optionally combined withparallelto compute the blocks concurrently).- 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 byblock_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’, ‘zarr’}, optional
Whether to return numpy or dask arrays, or to write the output to a zarr array on disk. If
'zarr',zarr_pathmust also be given; the output is then computed in blocks (using dask, on the synchronous scheduler whenparallelisFalse),block_sizedefaults to'auto'when not specified, and dask arrays backed by the zarr array are returned.- dask_method{‘memmap’, ‘none’}, optional
- Method to use when input array is a dask array. The methods are:
'memmap': write out the entire input dask array to a temporary memory-mapped array. This requires enough disk space to store the entire input array.'none'(default): use native dask interpolation, which avoids having to write the array to disk.
- zarr_pathstr, optional
Path to use for the output zarr array when
return_type='zarr'. This must be a path that does not already exist.
- Returns: