Skip to content

Commit

Permalink
Jupyterbook docs fixes 2 (#9)
Browse files Browse the repository at this point in the history
* adapt pyg writing for neural-lam

* fix missing and circular imports

* make regular input grid assumption explicit

* handle missing edge attributes in splitting

* minor fix for neural-lam save

* add missing dep

* tweak cicd
  • Loading branch information
leifdenby authored May 10, 2024
1 parent 614c3d8 commit 21d4162
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy-docs-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
cache: true

- name: Install dependencies
run: pdm install --group docs
run: |
pdm install --prod
pdm install --group docs
# Build the book
- name: Build the book
Expand Down
13 changes: 12 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ visualisation = [
]
docs = [
"jupyter-book>=1.0.0",
"sphinxcontrib-mermaid>=0.9.2",
]

[build-system]
Expand Down
11 changes: 11 additions & 0 deletions src/weather_model_graphs/networkx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ def split_graph_by_edge_attribute(graph, attr):
f"No subgraphs were created. Check the edge attribute '{attr}'."
)

# copy node attributes
for subgraph in subgraphs.values():
for node in subgraph.nodes:
subgraph.nodes[node].update(graph.nodes[node])

# check that at least one subgraph was created
if len(subgraphs) == 0:
raise ValueError(
f"No subgraphs were created. Check the edge attribute '{attr}'."
)

return subgraphs


Expand Down

0 comments on commit 21d4162

Please sign in to comment.