Scaling and incrementing non-zero elements of a NumPy matrix
This is a typical use case for numpy.where:

cPrime = np.where(C, C * 30 + 1, C)


This is about twice as fast as (30 * C + 1) * (C != 0) and generalizes more easily to other conditions.