()
| 72 | |
| 73 | @pytest.fixture |
| 74 | def nd_interp_coords(): |
| 75 | # interpolation indices for nd interpolation of da from case 3 of get_example_data |
| 76 | |
| 77 | da = get_example_data(case=3) |
| 78 | |
| 79 | coords = {} |
| 80 | # grid -> grid |
| 81 | coords["xdestnp"] = np.linspace(0.1, 1.0, 11) |
| 82 | coords["ydestnp"] = np.linspace(0.0, 0.2, 10) |
| 83 | coords["zdestnp"] = da.z.data |
| 84 | # list of the points defined by the above mesh in C order |
| 85 | mesh_x, mesh_y, mesh_z = np.meshgrid( |
| 86 | coords["xdestnp"], coords["ydestnp"], coords["zdestnp"], indexing="ij" |
| 87 | ) |
| 88 | coords["grid_grid_points"] = np.column_stack( |
| 89 | [mesh_x.ravel(), mesh_y.ravel(), mesh_z.ravel()] |
| 90 | ) |
| 91 | |
| 92 | # grid -> oned |
| 93 | coords["xdest"] = xr.DataArray(np.linspace(0.1, 1.0, 11), dims="y") # type: ignore[assignment] |
| 94 | coords["ydest"] = xr.DataArray(np.linspace(0.0, 0.2, 11), dims="y") # type: ignore[assignment] |
| 95 | coords["zdest"] = da.z |
| 96 | # grid of the points defined by the oned gridded with zdest in C order |
| 97 | coords["grid_oned_points"] = np.array( |
| 98 | [ |
| 99 | (a, b, c) |
| 100 | for (a, b), c in product( |
| 101 | zip(coords["xdest"].data, coords["ydest"].data, strict=False), |
| 102 | coords["zdest"].data, |
| 103 | ) |
| 104 | ] |
| 105 | ) |
| 106 | |
| 107 | return coords |
| 108 | |
| 109 | |
| 110 | def test_keywargs(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…