def map_vector(x, raster, **kvars):
    """
    Create new GeoRaster, which has its data replaced by x
    Useful to map output of PySal analyses, e.g. spatial autocorrelation values, etc.

    Usage: raster2 = map_vector(x, raster)
    where
        raster: GeoRaster
        x: Numpy array of data with same length as non-missing values in raster,
           i.e., len(x) == np.sum(raster.mask==False)
    """
    y = raster.copy()
    y.raster[y.raster.mask == False] = x
    return y
