def memory_file(data=None, profile=None):
memfile = MemoryFile()<EOL>profile.update(width=data.shape[-<NUM_LIT:2>], height=data.shape[-<NUM_LIT:1>])<EOL>with memfile.open(**profile) as dataset:<EOL><INDENT>dataset.write(data)<EOL><DEDENT>return memfile<EOL>
Return a rasterio.io.MemoryFile instance from input.

Parameters
----------
data : array
    array to be written
profile : dict
    rasterio profile for MemoryFile