def resample_from_array(<EOL>in_raster=None,<EOL>in_affine=None,<EOL>out_tile=None,<EOL>in_crs=None,<EOL>resampling="<STR_LIT>",<EOL>nodataval=<NUM_LIT:0><EOL>):
<EOL>if isinstance(in_raster, ma.MaskedArray):<EOL><INDENT>pass<EOL><DEDENT>if isinstance(in_raster, np.ndarray):<EOL><INDENT>in_raster = ma.MaskedArray(in_raster, mask=in_raster == nodataval)<EOL><DEDENT>elif isinstance(in_raster, ReferencedRaster):<EOL><INDENT>in_affine = in_raster.affine<EOL>in_crs = in_raster.crs<EOL>in_raster = in_raster.data<EOL><DEDENT>elif isinstance(in_raster, tuple):<EOL><INDENT>in_raster = ma.MaskedArray(<EOL>data=np.stack(in_raster),<EOL>mask=np.stack([<EOL>band.mask<EOL>if isinstance(band, ma.masked_array)<EOL>else np.where(band == nodataval, True, False)<EOL>for band in in_raster<EOL>]),<EOL>fill_value=nodataval<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % type(in_raster))<EOL><DEDENT>if in_raster.ndim == <NUM_LIT:2>:<EOL><INDENT>in_raster = ma.expand_dims(in_raster, axis=<NUM_LIT:0>)<EOL><DEDENT>elif in_raster.ndim == <NUM_LIT:3>:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if in_raster.fill_value != nodataval:<EOL><INDENT>ma.set_fill_value(in_raster, nodataval)<EOL><DEDENT>out_shape = (in_raster.shape[<NUM_LIT:0>], ) + out_tile.shape<EOL>dst_data = np.empty(out_shape, in_raster.dtype)<EOL>in_raster = ma.masked_array(<EOL>data=in_raster.filled(), mask=in_raster.mask, fill_value=nodataval<EOL>)<EOL>reproject(<EOL>in_raster,<EOL>dst_data,<EOL>src_transform=in_affine,<EOL>src_crs=in_crs if in_crs else out_tile.crs,<EOL>dst_transform=out_tile.affine,<EOL>dst_crs=out_tile.crs,<EOL>resampling=Resampling[resampling]<EOL>)<EOL>return ma.MaskedArray(dst_data, mask=dst_data == nodataval)<EOL>
Extract and resample from array to target tile.

Parameters
----------
in_raster : array
in_affine : ``Affine``
out_tile : ``BufferedTile``
resampling : string
    one of rasterio's resampling methods (default: nearest)
nodataval : integer or float
    raster nodata value (default: 0)

Returns
-------
resampled array : array