nd.testing package¶
-
nd.testing.
all_algorithms
(parent=<module 'nd' from '/home/docs/checkouts/readthedocs.org/user_builds/nd/conda/change/lib/python3.7/site-packages/nd/__init__.py'>)[source]¶ Return a list of all algorithms.
-
nd.testing.
assert_equal_data
(ds1, ds2)[source]¶ Assert that the data in two datasets is the same, independent of the order of the dimensions.
-
nd.testing.
assert_equal_dict
(dict1, dict2)[source]¶ Check whether two lists of dictionaries are equal, independent of the order within the list.
- Parameters
dict1 (dict) – Dictioniaries to compare
dict2 (dict) – Dictioniaries to compare
-
nd.testing.
equal_list_of_dicts
(obj1, obj2, exclude=[])[source]¶ Check whether two lists of dictionaries are equal, independent of the order within the list.
- Parameters
obj1 (list of dict) – First object to compare
obj2 (list of dict) – Second object to compare
exclude (list of str, optional) – A list of keys that are to be excluded when deciding whether the lists of dictionaries are equal (default: []).
- Returns
True if the two lists contain the same dictionaries, False otherwise.
- Return type
bool
-
nd.testing.
generate_test_dataarray
(dims={'time': 10, 'x': 20, 'y': 20}, name='variable', mean=0, sigma=1, extent=- 10.0, 50.0, 0.0, 60.0, random_seed=42, crs='epsg:4326')[source]¶
-
nd.testing.
generate_test_dataset
(dims={'time': 10, 'x': 20, 'y': 20}, var=['C11', 'C12__im', 'C12__re', 'C22'], mean=0, sigma=1, extent=- 10.0, 50.0, 0.0, 60.0, random_seed=42, crs='epsg:4326')[source]¶
-
nd.testing.
generate_test_geodataframe
(n_polygon=20, extent=- 10.0, 50.0, 0.0, 60.0, radius=1, crs='epsg:4326', random_seed=None, overlap=False)[source]¶
-
nd.testing.
generate_test_polygons
(n_polygon=20, extent=- 10.0, 50.0, 0.0, 60.0, radius=1, crs='epsg:4326', random_seed=None, overlap=False)[source]¶
-
nd.testing.
random_polygon
(x, y, n_vertices, radius=1, irregularity=0.2, sigma=0.3)[source]¶ Generate a random polygon around given center. Inspired by https://stackoverflow.com/a/25276331/6156397
- Parameters
x (float) – Coordinates of polygon center
y (float) – Coordinates of polygon center
n_vertices (int) – Number of polygon vertices
radius (float, optional) – Average radius of polygon (default: 1)
irregularity (float, optional) – Irregularity of spacing between the vertices (0..1) (default: 0.2)
sigma (float, optional) – Standard deviation of radius, as fraction of radius (0..1) (default: 0.3)