deltametrics.mobility.channel_presence¶
- deltametrics.mobility.channel_presence(chmap)¶
Calculate the normalized channel presence at each pixel location.
Measure the normalized fraction of time a given pixel is channelized, based on method in Liang et al 2016 [1]. This requires providing a 3-D input channel map (t-x-y).
- Parameters:
chmap (ndarray) – A t-x-y shaped array with binary channel maps
- Returns:
channel_presence – A x-y shaped array with the normalized channel presence values.
- Return type:
ndarray
Examples
>>> golfcube = dm.sample_data.golf() >>> (x, y) = np.shape(golfcube['eta'][-1, ...]) >>> # calculate channel masks/presence over final 5 timesteps >>> chmap = np.zeros((5, x, y)) # initialize channel map >>> for i in np.arange(-5, 0): ... chmap[i, ...] = dm.mask.ChannelMask( ... golfcube['eta'][i, ...], golfcube['velocity'][i, ...], ... elevation_threshold=0, flow_threshold=0).mask >>> >>> fig, ax = plt.subplots(1, 2) >>> golfcube.quick_show('eta', ax=ax[0]) # final delta >>> p = ax[1].imshow(dm.mobility.channel_presence(chmap), cmap='Blues') >>> dm.plot.append_colorbar(p, ax[1], label='Channelized Time') >>> plt.show()