Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Contributing to Neural-LAM

Thank you for your interest in contributing to Neural-LAM! 🎉

We welcome contributions of all kinds, including bug fixes, documentation improvements, and new features.

---

## 🛠️ Getting Started

### 1. Fork the repository
Click the "Fork" button on the top right of the repository page.

### 2. Clone your fork
```bash
git clone https://github.com/YOUR_USERNAME/neural-lam.git
cd neural-lam
3. Create a new branch
git checkout -b your-branch-name
⚙️ Setup the development environment

We recommend installing in editable mode with development dependencies:

pip install --group dev -e .

Or using uv:

uv pip install --group dev -e .
✅ Before making a PR

Run pre-commit checks:

pre-commit run --all-files

Make sure:

Code is formatted correctly

No linting errors

Tests pass

🚀 Making a Pull Request

Commit your changes:

git add .
git commit -m "Your message"

Push your branch:

git push origin your-branch-name

Open a Pull Request on GitHub

💡 Guidelines

Keep PRs small and focused

Write clear commit messages

Link related issues (e.g., Fixes #123)

Be respectful and collaborative

🙌 Need Help?

Feel free to open an issue or ask questions in the Slack channel.

Happy coding! 🚀


---

## 💾 Step 3: Commit

```bash
git add CONTRIBUTING.md
git commit -m "Add CONTRIBUTING.md for new contributors (Fixes #406)"
git push
🚀 Step 4: Create PR
Title:
Add CONTRIBUTING.md to guide new contributors
Description:
Fixes #406

Added a CONTRIBUTING.md file to guide new contributors on how to set up the project, run checks, and submit pull requests.

This improves onboarding and developer experience.
🔥 After this PR

You will have:

✅ Docs fix (#465)

✅ Docs fix (#464)

✅ New file contribution (#406)

👉 This is VERY strong for GSoC

🚀 Next level (after this)

Then we move to:

small bug fix OR

type hints PR

Say:
👉 “done #406”
or
👉 “error while pushing”

I’ll help instantly 👍
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ python -m neural_lam.datastore.npyfilesmeps.compute_standardization_stats <path-

### Graph creation

Run `python -m neural_lam.create_mesh` with suitable options to generate the graph you want to use (see `python neural_lam.create_mesh --help` for a list of options).
Run `python -m neural_lam.create_graph` with suitable options to generate the graph you want to use (see `python neural_lam.create_graph --help` for a list of options).
The graphs used for the different models in the [paper](#graph-based-neural-weather-prediction-for-limited-area-modeling) can be created as:

* **GC-LAM**: `python -m neural_lam.create_graph --config_path <neural-lam-config-path> --name multiscale`
Expand Down Expand Up @@ -530,13 +530,13 @@ The structure is shown with examples below:
```
graphs
├── graph1 - Directory with a graph definition
│ ├── m2m_edge_index.pt - Edges in mesh graph (neural_lam.create_mesh)
│ ├── g2m_edge_index.pt - Edges from grid to mesh (neural_lam.create_mesh)
│ ├── m2g_edge_index.pt - Edges from mesh to grid (neural_lam.create_mesh)
│ ├── m2m_features.pt - Static features of mesh edges (neural_lam.create_mesh)
│ ├── g2m_features.pt - Static features of grid to mesh edges (neural_lam.create_mesh)
│ ├── m2g_features.pt - Static features of mesh to grid edges (neural_lam.create_mesh)
│ └── mesh_features.pt - Static features of mesh nodes (neural_lam.create_mesh)
│ ├── m2m_edge_index.pt - Edges in mesh graph (neural_lam.create_graph)
│ ├── g2m_edge_index.pt - Edges from grid to mesh (neural_lam.create_graph)
│ ├── m2g_edge_index.pt - Edges from mesh to grid (neural_lam.create_graph)
│ ├── m2m_features.pt - Static features of mesh edges (neural_lam.create_graph)
│ ├── g2m_features.pt - Static features of grid to mesh edges (neural_lam.create_graph)
│ ├── m2g_features.pt - Static features of mesh to grid edges (neural_lam.create_graph)
│ └── mesh_features.pt - Static features of mesh nodes (neural_lam.create_graph)
├── graph2
├── ...
└── graphN
Expand All @@ -546,9 +546,9 @@ graphs
To keep track of levels in the mesh graph, a list format is used for the files with mesh graph information.
In particular, the files
```
│ ├── m2m_edge_index.pt - Edges in mesh graph (neural_lam.create_mesh)
│ ├── m2m_features.pt - Static features of mesh edges (neural_lam.create_mesh)
│ ├── mesh_features.pt - Static features of mesh nodes (neural_lam.create_mesh)
│ ├── m2m_edge_index.pt - Edges in mesh graph (neural_lam.create_graph)
│ ├── m2m_features.pt - Static features of mesh edges (neural_lam.create_graph)
│ ├── mesh_features.pt - Static features of mesh nodes (neural_lam.create_graph)
```
all contain lists of length `L`, for a hierarchical mesh graph with `L` layers.
For non-hierarchical graphs `L == 1` and these are all just singly-entry lists.
Expand All @@ -559,10 +559,10 @@ In addition, hierarchical mesh graphs (`L > 1`) feature a few additional files w
```
├── graph1
│ ├── ...
│ ├── mesh_down_edge_index.pt - Downward edges in mesh graph (neural_lam.create_mesh)
│ ├── mesh_up_edge_index.pt - Upward edges in mesh graph (neural_lam.create_mesh)
│ ├── mesh_down_features.pt - Static features of downward mesh edges (neural_lam.create_mesh)
│ ├── mesh_up_features.pt - Static features of upward mesh edges (neural_lam.create_mesh)
│ ├── mesh_down_edge_index.pt - Downward edges in mesh graph (neural_lam.create_graph)
│ ├── mesh_up_edge_index.pt - Upward edges in mesh graph (neural_lam.create_graph)
│ ├── mesh_down_features.pt - Static features of downward mesh edges (neural_lam.create_graph)
│ ├── mesh_up_features.pt - Static features of upward mesh edges (neural_lam.create_graph)
│ ├── ...
```
These files have the same list format as the ones above, but each list has length `L-1` (as these edges describe connections between levels).
Expand Down
11 changes: 8 additions & 3 deletions neural_lam/custom_loggers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Standard library
import sys
from typing import Any, List, Optional

# Third-party
import mlflow
Expand All @@ -15,7 +16,9 @@ class CustomMLFlowLogger(pl.loggers.MLFlowLogger):
of version `2.0.3` at least.
"""

def __init__(self, experiment_name, tracking_uri, run_name):
def __init__(
self, experiment_name: str, tracking_uri: str, run_name: str
) -> None:
super().__init__(
experiment_name=experiment_name, tracking_uri=tracking_uri
)
Expand All @@ -25,7 +28,7 @@ def __init__(self, experiment_name, tracking_uri, run_name):
mlflow.log_param("run_id", self.run_id)

@property
def save_dir(self):
def save_dir(self) -> str:
"""
Returns the directory where the MLFlow artifacts are saved.
Used to define the path to save output when using the logger.
Expand All @@ -37,7 +40,9 @@ def save_dir(self):
"""
return "mlruns"

def log_image(self, key, images, step=None):
def log_image(
self, key: str, images: List[Any], step: Optional[int] = None
) -> None:
"""
Log a matplotlib figure as an image to MLFlow

Expand Down