def array2raster(newRasterfn, rasterOrigin, pixelWidth, pixelHeight, crs, array
    ):
    """
    create a raster file from a numpy array
    """
    try:
        import gdal
    except:
        raise ImportError(
            'Failed to import gdal. This is required for in the array2raster function'
            )
    cols = array.shape[1]
    rows = array.shape[0]
    originX = rasterOrigin[0]
    originY = rasterOrigin[1]
    driver = gdal.GetDriverByName('GTiff')
    outRaster = driver.Create(newRasterfn, cols, rows, 1, gdal.GDT_Float32)
    outRaster.SetGeoTransform((originX, pixelWidth, 0, originY, 0, pixelHeight)
        )
    outband = outRaster.GetRasterBand(1)
    outband.WriteArray(array)
    outRaster.SetProjection(crs.ExportToWkt())
    outband.FlushCache()
