(variant, unit, error, dtype)
| 826 | ), |
| 827 | ) |
| 828 | def test_combine_nested(variant, unit, error, dtype): |
| 829 | original_unit = unit_registry.m |
| 830 | |
| 831 | variants = { |
| 832 | "data": ((original_unit, unit), (1, 1), (1, 1)), |
| 833 | "dims": ((1, 1), (original_unit, unit), (1, 1)), |
| 834 | "coords": ((1, 1), (1, 1), (original_unit, unit)), |
| 835 | } |
| 836 | ( |
| 837 | (data_unit1, data_unit2), |
| 838 | (dim_unit1, dim_unit2), |
| 839 | (coord_unit1, coord_unit2), |
| 840 | ) = variants[variant] |
| 841 | |
| 842 | array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1 |
| 843 | array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1 |
| 844 | |
| 845 | x = np.arange(1, 4) * 10 * dim_unit1 |
| 846 | y = np.arange(2) * dim_unit1 |
| 847 | z = np.arange(3) * coord_unit1 |
| 848 | |
| 849 | ds1 = xr.Dataset( |
| 850 | data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)}, |
| 851 | coords={"x": x, "y": y, "z": ("x", z)}, |
| 852 | ) |
| 853 | ds2 = xr.Dataset( |
| 854 | data_vars={ |
| 855 | "a": (("y", "x"), np.ones_like(array1) * data_unit2), |
| 856 | "b": (("y", "x"), np.ones_like(array2) * data_unit2), |
| 857 | }, |
| 858 | coords={ |
| 859 | "x": np.arange(3) * dim_unit2, |
| 860 | "y": np.arange(2, 4) * dim_unit2, |
| 861 | "z": ("x", np.arange(-3, 0) * coord_unit2), |
| 862 | }, |
| 863 | ) |
| 864 | ds3 = xr.Dataset( |
| 865 | data_vars={ |
| 866 | "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2), |
| 867 | "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2), |
| 868 | }, |
| 869 | coords={ |
| 870 | "x": np.arange(3, 6) * dim_unit2, |
| 871 | "y": np.arange(4, 6) * dim_unit2, |
| 872 | "z": ("x", np.arange(3, 6) * coord_unit2), |
| 873 | }, |
| 874 | ) |
| 875 | ds4 = xr.Dataset( |
| 876 | data_vars={ |
| 877 | "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2), |
| 878 | "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2), |
| 879 | }, |
| 880 | coords={ |
| 881 | "x": np.arange(6, 9) * dim_unit2, |
| 882 | "y": np.arange(6, 8) * dim_unit2, |
| 883 | "z": ("x", np.arange(6, 9) * coord_unit2), |
| 884 | }, |
| 885 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…