(
num_datasets: int = 2, seed: int | None = None, include_day: bool = True
)
| 43 | |
| 44 | # helper method to create multiple tests datasets to concat |
| 45 | def create_concat_datasets( |
| 46 | num_datasets: int = 2, seed: int | None = None, include_day: bool = True |
| 47 | ) -> list[Dataset]: |
| 48 | rng = np.random.default_rng(seed) |
| 49 | lat = rng.standard_normal(size=(1, 4)) |
| 50 | lon = rng.standard_normal(size=(1, 4)) |
| 51 | result = [] |
| 52 | variables = ["temperature", "pressure", "humidity", "precipitation", "cloud_cover"] |
| 53 | for i in range(num_datasets): |
| 54 | if include_day: |
| 55 | data_tuple = ( |
| 56 | ["x", "y", "day"], |
| 57 | rng.standard_normal(size=(1, 4, 2)), |
| 58 | ) |
| 59 | data_vars = dict.fromkeys(variables, data_tuple) |
| 60 | result.append( |
| 61 | Dataset( |
| 62 | data_vars=data_vars, |
| 63 | coords={ |
| 64 | "lat": (["x", "y"], lat), |
| 65 | "lon": (["x", "y"], lon), |
| 66 | "day": ["day" + str(i * 2 + 1), "day" + str(i * 2 + 2)], |
| 67 | }, |
| 68 | ) |
| 69 | ) |
| 70 | else: |
| 71 | data_tuple = ( |
| 72 | ["x", "y"], |
| 73 | rng.standard_normal(size=(1, 4)), |
| 74 | ) |
| 75 | data_vars = dict.fromkeys(variables, data_tuple) |
| 76 | result.append( |
| 77 | Dataset( |
| 78 | data_vars=data_vars, |
| 79 | coords={"lat": (["x", "y"], lat), "lon": (["x", "y"], lon)}, |
| 80 | ) |
| 81 | ) |
| 82 | |
| 83 | return result |
| 84 | |
| 85 | |
| 86 | # helper method to create multiple tests datasets to concat with specific types |
no test coverage detected
searching dependent graphs…