Skip to content

Commit 14fbfc6

Browse files
pkhalajwi-spang
andcommitted
Revert changes made in archetype.py
Co-authored-by: Wilma Spångberg <wilma.spangberg@smhi.se> Co-authored-by: Pouria Khalaj <pouria.khalaj@smhi.se>
1 parent 0c99462 commit 14fbfc6

1 file changed

Lines changed: 28 additions & 12 deletions

File tree

src/weather_model_graphs/create/archetype.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
from .base import create_all_graph_components
22

33

4-
def create_keisler_graph(coords, mesh_node_distance=3, **kwargs):
4+
def create_keisler_graph(
5+
coords,
6+
mesh_node_distance=3,
7+
coords_crs=None,
8+
graph_crs=None,
9+
):
510
"""
611
Create a flat LAM graph from Oskarsson et al (2023, https://arxiv.org/abs/2309.17370)
712
This graph setup is inspired by the global graph used by Keisler (2022, https://arxiv.org/abs/2202.07575).
@@ -39,12 +44,15 @@ def create_keisler_graph(coords, mesh_node_distance=3, **kwargs):
3944
m2m_connectivity="flat",
4045
m2m_connectivity_kwargs=dict(mesh_node_distance=mesh_node_distance),
4146
g2m_connectivity="within_radius",
42-
m2g_connectivity="containing_rectangle",
47+
m2g_connectivity="nearest_neighbours",
4348
g2m_connectivity_kwargs=dict(
4449
rel_max_dist=0.51,
4550
),
46-
m2g_connectivity_kwargs=dict(),
47-
**kwargs,
51+
m2g_connectivity_kwargs=dict(
52+
max_num_neighbours=4,
53+
),
54+
coords_crs=coords_crs,
55+
graph_crs=graph_crs,
4856
)
4957

5058

@@ -53,7 +61,8 @@ def create_graphcast_graph(
5361
mesh_node_distance=3,
5462
level_refinement_factor=3,
5563
max_num_levels=None,
56-
**kwargs,
64+
coords_crs=None,
65+
graph_crs=None,
5766
):
5867
"""
5968
Create a multiscale LAM graph from Oskarsson et al (2023, https://arxiv.org/abs/2309.17370)
@@ -100,12 +109,15 @@ def create_graphcast_graph(
100109
max_num_levels=max_num_levels,
101110
),
102111
g2m_connectivity="within_radius",
103-
m2g_connectivity="containing_rectangle",
112+
m2g_connectivity="nearest_neighbours",
104113
g2m_connectivity_kwargs=dict(
105114
rel_max_dist=0.51,
106115
),
107-
m2g_connectivity_kwargs=dict(),
108-
**kwargs,
116+
m2g_connectivity_kwargs=dict(
117+
max_num_neighbours=4,
118+
),
119+
coords_crs=coords_crs,
120+
graph_crs=graph_crs,
109121
)
110122

111123

@@ -114,7 +126,8 @@ def create_oskarsson_hierarchical_graph(
114126
mesh_node_distance=3,
115127
level_refinement_factor=3,
116128
max_num_levels=None,
117-
**kwargs,
129+
coords_crs=None,
130+
graph_crs=None,
118131
):
119132
"""
120133
Create a LAM graph following Oskarsson et al (2023, https://arxiv.org/abs/2309.17370)
@@ -164,10 +177,13 @@ def create_oskarsson_hierarchical_graph(
164177
max_num_levels=max_num_levels,
165178
),
166179
g2m_connectivity="within_radius",
167-
m2g_connectivity="containing_rectangle",
180+
m2g_connectivity="nearest_neighbours",
168181
g2m_connectivity_kwargs=dict(
169182
rel_max_dist=0.51,
170183
),
171-
m2g_connectivity_kwargs=dict(),
172-
**kwargs,
184+
m2g_connectivity_kwargs=dict(
185+
max_num_neighbours=4,
186+
),
187+
coords_crs=coords_crs,
188+
graph_crs=graph_crs,
173189
)

0 commit comments

Comments
 (0)