def test_check_data_shape(self): data = NoInitRadarData(big=True) # should pass, i.e. nothing happens migrationlib._check_data_shape(data) # make it fail data.data = np.ones((1, 1)) with self.assertRaises(ValueError): migrationlib._check_data_shape(data)
def test_plot_radargram(self, mock_show): # Only checking that these do not throw errors dat = NoInitRadarData(big=True) fig, ax = plot.plot_radargram(dat) fig, ax = plt.subplots() plot.plot_radargram(dat, fig=fig, ax=ax) plot.plot_radargram(dat, fig=fig) dat.data = dat.data + 1.0j * dat.data plot.plot_radargram(dat, fig=fig, ax=ax) # Varying xdata dat = NoInitRadarData(big=True) plot.plot_radargram(dat, x_range=None, fig=fig, ax=ax) plot.plot_radargram(dat, xdat='dist', fig=fig, ax=ax) with self.assertRaises(ValueError): plot.plot_radargram(dat, xdat='dummy', fig=fig, ax=ax) plot.plot_radargram(dat, y_range=None, fig=fig, ax=ax) plot.plot_radargram(dat, ydat='depth', fig=fig, ax=ax) with self.assertRaises(ValueError): plot.plot_radargram(dat, ydat='dummy', fig=fig, ax=ax) # Cannot do dist if we have no dist dat = NoInitRadarData(big=True) dat.dist = None with self.assertRaises(ValueError): plot.plot_radargram(dat, xdat='dist', fig=fig, ax=ax) # Elevation offsets dat = NoInitRadarData(big=True) with self.assertRaises(ValueError): plot.plot_radargram(dat, ydat='elev', fig=fig, ax=ax) dat.flags.elev = True dat.elev = np.zeros(dat.data.shape[1]) dat.elev[1:] = 1 plot.plot_radargram(dat, ydat='elev', fig=fig, ax=ax)