def test_get_coordinate_at_distance(self): bins = np.arange(10) G = Geostatistic(self.x, lags=bins) with self.assertRaises(ValueError): # missing center lon, lat = G.get_coordinates_at_distance(2.5, dist_threshold=1.) G.set_center_position(5., -20.) lon, lat = G.get_coordinates_at_distance(2.5, dist_threshold=1.)
def test_center_pos(self): bins = np.arange(10) G = Geostatistic(self.x, lags=bins) # forgot to set center with self.assertRaises(ValueError): G._get_center_pos() G.set_center_position(-10., -60.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 0) self.assertEqual(i_lon, 0) G.set_center_position(9., 48.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 54) self.assertEqual(i_lon, 19) G.set_center_position(-10.1, 48.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 54) self.assertEqual(i_lon, 0)
def test_center_pos(self): bins = np.arange(10) G = Geostatistic(self.x, range_bins=bins) # forgot to set center with self.assertRaises(ValueError): G._get_center_pos() G.set_center_position(-10., -60.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 0) self.assertEqual(i_lon, 0) G.set_center_position(9., 48.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 54) self.assertEqual(i_lon, 19) G.set_center_position(-10.1, 48.) i_lat, i_lon = G._get_center_pos() self.assertEqual(i_lat, 54) self.assertEqual(i_lon, 0)
def test_set_center(self): bins = np.arange(10) G = Geostatistic(self.x, lags=bins) G.set_center_position(5., -20.) self.assertEqual(G.lon_center, 5.) self.assertEqual(G.lat_center, -20.)
def test_percentiles(self): bins = np.arange(10) G = Geostatistic(self.x, lags=bins) G.set_center_position(5., -20.) p = [0.05, 0.1, 0.5] G.plot_percentiles(p, ax=None, logy=False, ref_lags=None)
def test_plot(self): bins = np.arange(3) / 6. G = Geostatistic(self.x, lags=bins) G.set_center_position(0., 0.) G.plot_semivariogram()
def test_set_center(self): bins = np.arange(10) G = Geostatistic(self.x, range_bins=bins) G.set_center_position(5., -20.) self.assertEqual(G.lon_center, 5.) self.assertEqual(G.lat_center, -20.)