Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First version of documentation #18

Merged
merged 75 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
38f8d15
feat: Initial implementation of global graphs
theissenhelen Jun 24, 2024
9dc2cec
add dependencies
theissenhelen Jun 25, 2024
f1fe18f
add cli command
JPXKQX Jun 25, 2024
b8b558d
Ignore .pt files
JPXKQX Jun 25, 2024
7f6f4bd
run pre-commit
JPXKQX Jun 25, 2024
d5f67fd
docstring + log erros
JPXKQX Jun 26, 2024
b12272d
initial tests
JPXKQX Jun 26, 2024
cce5ea6
feat: initial version of AttributeBuilder
theissenhelen Jun 26, 2024
9ba0391
refactor: separate into node edge attribute builders
theissenhelen Jun 26, 2024
9a47184
feat: edge_length moved to edges/attributes.py
JPXKQX Jun 27, 2024
384adc7
remove __init__
JPXKQX Jun 27, 2024
0bc176c
feat: test edge builders
JPXKQX Jun 27, 2024
d16934b
add blank lines
JPXKQX Jun 27, 2024
0f82ea7
dep: hydra-core
JPXKQX Jun 27, 2024
a9c5ada
bugfix (encoder edge lengths) + refector
JPXKQX Jun 27, 2024
66ef5dc
deps: == to >=
JPXKQX Jun 27, 2024
0d31c56
docs: first documentation WIP
JPXKQX Jun 27, 2024
42e1ad4
update docs
JPXKQX Jul 2, 2024
3609681
Global Encoder-Processor-Decoder graph (#9)
JPXKQX Jul 5, 2024
63c090b
add cli command
JPXKQX Jun 25, 2024
d02be30
run pre-commit
JPXKQX Jun 25, 2024
aa59627
feat: initial version of AttributeBuilder
theissenhelen Jun 26, 2024
428d799
refactor: separate into node edge attribute builders
theissenhelen Jun 26, 2024
c54e491
feat: edge_length moved to edges/attributes.py
JPXKQX Jun 27, 2024
221dc30
remove __init__
JPXKQX Jun 27, 2024
541a6b2
docs: first documentation WIP
JPXKQX Jun 27, 2024
7c4f706
update docs
JPXKQX Jul 2, 2024
12e5950
Merge branch 'develop' into feature/docs
JPXKQX Jul 5, 2024
0f7fce5
Merge branch 'develop' of github.com:ecmwf/anemoi-graphs into feature…
JPXKQX Jul 8, 2024
9836945
udpate documentation
JPXKQX Jul 8, 2024
bcf0f5a
Merge branch 'develop' into feature/docs
theissenhelen Jul 9, 2024
ba69531
refactor: precommit
theissenhelen Jul 9, 2024
5865b35
Merge pull request #14 from ecmwf/hotfix/config_node_name
JPXKQX Jul 9, 2024
bd6b612
Merge remote-tracking branch 'origin/develop' into feature/docs
JPXKQX Jul 9, 2024
be3012c
update docs for global use case (only
JPXKQX Jul 9, 2024
a3872fd
docstrings
JPXKQX Jul 10, 2024
ffdf62a
remove math equations
JPXKQX Jul 10, 2024
09d3290
remove deprecated files
JPXKQX Jul 10, 2024
2e45397
review typos
JPXKQX Jul 10, 2024
983ff0f
fix: typos
JPXKQX Jul 11, 2024
db81caf
data structure section
JPXKQX Jul 11, 2024
c5eaa41
update: docstring
JPXKQX Jul 24, 2024
3f83f90
Merge branch 'develop' into feature/docs
JesperDramsch Jul 31, 2024
cdf5db5
Merge branch 'develop' into feature/docs
JesperDramsch Jul 31, 2024
5b378d2
Merge branch 'develop' into feature/docs
JPXKQX Aug 6, 2024
f533392
Update CHANGELOG.md
JPXKQX Aug 6, 2024
3736756
fix: cli/inspect
JPXKQX Aug 6, 2024
3cf342f
Merge branch 'develop' into feature/docs
JPXKQX Aug 20, 2024
9bcdce6
fix: rename to anemoi.graphs
JPXKQX Aug 20, 2024
3ae861a
fix: rename to anemoi.graphs
JPXKQX Aug 20, 2024
6b37987
docs: docstring for MultiScaleEdges
JPXKQX Aug 20, 2024
e53588b
docs: explain output object
JPXKQX Aug 20, 2024
9cea800
docs: homegenize modules section
JPXKQX Aug 20, 2024
903aebe
docs: fix table
JPXKQX Aug 20, 2024
2888205
docs: refactor modules into a section
JPXKQX Aug 20, 2024
2ab138f
docs: fix layout
JPXKQX Aug 20, 2024
f826e95
docs: bring contributing guidelines from anemoi-training
JPXKQX Aug 20, 2024
ba0fc13
docs: add references to cli pages
JPXKQX Aug 20, 2024
5354407
docs: add anemoi-graphs describe CLI
JPXKQX Aug 20, 2024
bf38fe3
docs: expand docstring
JPXKQX Aug 20, 2024
d68bbf1
docs: include creator and inspector to modules
JPXKQX Aug 21, 2024
a7fa3e9
Merge branch 'develop' into feature/docs
JPXKQX Aug 22, 2024
1091ec5
docs: update
JPXKQX Aug 22, 2024
a2d2423
docs: update modules/graph_inspector
JPXKQX Aug 23, 2024
b26c7fc
docs: fix
JPXKQX Aug 23, 2024
a582416
fix: typo
JPXKQX Sep 2, 2024
ef5b2ce
fix: typo
JPXKQX Sep 2, 2024
90e0c5c
fix: typo
JPXKQX Sep 2, 2024
ac0957a
Update docs/graphs/node_coordinates/hex_refined_icosahedron.rst
JPXKQX Sep 2, 2024
bc41956
fix: typo
JPXKQX Sep 2, 2024
f0b50bc
docs: add note of refinement equivalences
JPXKQX Sep 2, 2024
89703e8
docs: remove deprecated statement
JPXKQX Sep 2, 2024
878b6d8
fix: typo
JPXKQX Sep 2, 2024
905df71
Merge branch 'feature/docs' of github.com:ecmwf/anemoi-graphs into fe…
JPXKQX Sep 2, 2024
0933c7a
Merge branch 'develop' into feature/docs
JPXKQX Sep 2, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Keep it human-readable, your future self will thank you!
- added downstream-ci pipeline and cd-pypi reusable workflow
- Changelog release updater

- Create package documentation.

### Changed
- fix: added support for Python3.9.
- fix: bug in graph cleaning method
Expand Down
Binary file added docs/_static/cutoff.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions docs/_static/hetero_data_graph.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
HeteroData(
data={
x=[40320, 2], # coordinates in radians (lat in [-pi/2, pi/2], lon in [0, 2pi])
node_type='ZarrDatasetNodes',
area_weight=[40320, 1],
},
hidden={
x=[10242, 2], # coordinates in radians (lat in [-pi/2, pi/2], lon in [0, 2pi])
node_type='TriNodes',
area_weight=[10242, 1],
},
(data, to, hidden)={
edge_index=[2, 62980],
edge_type='CutOffEdges',
edge_length=[62980, 1],
edge_dirs=[62980, 2],
},
(hidden, to, hidden)={
edge_index=[2, 81900],
edge_type='MultiScaleEdges',
edge_length=[81900, 1],
edge_dirs=[81900, 2],
},
(hidden, to, data)={
edge_index=[2, 120960],
edge_type='KNNEdges',
edge_length=[120960, 1],
edge_dirs=[120960, 2],
}
)
15 changes: 15 additions & 0 deletions docs/cli/create.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _cli-create:

======
create
======

Use this command to create a graph from a recipe file.

The syntax of the recipe file is described in :doc:`building graphs <../graphs/introduction>`.

.. argparse::
:module: anemoi.graphs.__main__
:func: create_parser
:prog: anemoi-graphs
:path: create
15 changes: 15 additions & 0 deletions docs/cli/describe.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _cli-describe:

========
describe
========

Use this command to describe a graph stored in your filesystem. It will print graph information to the console.

The syntax of the recipe file is described in :doc:`building graphs <../graphs/introduction>`.

.. argparse::
:module: anemoi.graphs.__main__
:func: create_parser
:prog: anemoi-graphs
:path: describe
15 changes: 15 additions & 0 deletions docs/cli/inspect.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _cli-inspect:

========
inspect
========

Use this command to inspect a graph stored in your filesystem.

The syntax of the recipe file is described in :doc:`building graphs <../graphs/introduction>`.

.. argparse::
:module: anemoi.graphs.__main__
:func: create_parser
:prog: anemoi-graphs
:path: inspect
29 changes: 29 additions & 0 deletions docs/cli/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. _cli-introduction:

=============
Introduction
=============

When you install the `anemoi-graphs` package, this will also install command line tool
called ``anemoi-graphs`` which can be used to design and inspect weather graphs.

The tool can provide help with the ``--help`` options:

.. code-block:: bash

% anemoi-graphs --help

The commands are:

.. toctree::
:maxdepth: 1

create
describe
inspect

.. argparse::
:module: anemoi.graphs.__main__
:func: create_parser
:prog: anemoi-graphs
:nosubcommands:
81 changes: 81 additions & 0 deletions docs/dev/code_structure.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.. _dev-code_structure:

################
Code Structure
################

Understanding and maintaining the code structure is crucial for
sustainable development of Anemoi Graphs. This guide outlines best
practices for contributing to the codebase.

******************************
Subclassing for New Features
******************************

When creating a new feature, the recommended practice is to subclass
existing base classes rather than modifying them directly. This approach
preserves functionality for other users while allowing for
customization.

Example:
========

In `anemoi/graphs/nodes/builder.py`, the `BaseNodeBuilder` class serves
as a foundation to define new sets of nodes. New node builders should
subclass this base class.

*******************
File Organization
*******************

When developing multiple new functions for a feature:

#. Create a new file in the folder (e.g.,
`edges/builder/<new_edge_builder>.py`) to avoid confusion with base
functions.

#. Group related functionality together for better organization and
maintainability.

********************************
Version Control Best Practices
********************************

#. Always use pre-commit hooks to ensure code quality and consistency.
#. Never commit directly to the `develop` branch.
#. Create a new branch for your feature or bug fix, e.g.,
`feature/<feature_name>` or `bugfix/<bug_name>`.
#. Submit a Pull Request from your branch to `develop` for peer review
and testing.

******************************
Code Style and Documentation
******************************

#. Follow PEP 8 guidelines for Python code style, the pre-commit hooks
will help enforce this.
#. Write clear, concise docstrings for all classes and functions using
the Numpy style.
#. Use type hints to improve code readability and catch potential
errors.
#. Add inline comments for complex logic or algorithms.

*********
Testing
*********

#. Write unit tests for new features using pytest.
#. Ensure all existing tests pass before submitting a Pull Request.
#. Aim for high test coverage, especially for critical functionality.

****************************
Performance Considerations
****************************

#. Profile your code to identify performance bottlenecks.
#. Optimize critical paths and frequently called functions.
#. Consider using vectorized operations when working with large
datasets.

By following these guidelines, you'll contribute to a maintainable and
robust codebase for Anemoi Graphs.
151 changes: 151 additions & 0 deletions docs/dev/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.. _dev-contributing:

##############
Contributing
##############

Thank you for your interest in contributing to Anemoi Graphs! This guide
will help you get started with the development process.

****************************************
Setting Up the Development Environment
****************************************

#. Clone the repository:

.. code:: bash

git clone https://github.com/ecmwf/anemoi-graphs/
cd anemoi-graphs

#. Install dependencies:

.. code:: bash

# For all dependencies
pip install -e .

# For development dependencies
pip install -e '.[dev]'

#. (macOS only) Install pandoc for documentation building:

.. code:: bash

brew install pandoc

******************
Pre-Commit Hooks
******************

We use pre-commit hooks to ensure code quality and consistency. To set
them up:

#. Install pre-commit hooks:

.. code:: bash

pre-commit install

#. Run hooks on all files to verify installation:

.. code:: bash

pre-commit run --all-files

*******************
Commit Guidelines
*******************

Ideally, open an issue for the feature or bug fix you're working on
before starting development, to discuss the approach with maintainers.

When committing code changes:

#. Make small, focused commits with clear and concise messages.

#. Follow the `Conventional Commits guidelines
<https://www.conventionalcommits.org/>`_, e.g., "feat:", "fix:",
"docs:", etc.

#. Use present tense and imperative mood in commit messages (e.g., "Add
feature" not "Added feature").

#. Reference relevant issue numbers in commit messages when applicable.

#. Update the ``CHANGELOG.md`` file with a human-friendly summary of
your changes.

**********************
Pull Request Process
**********************

#. Create a new branch for your feature or bug fix.
#. Make your changes and commit them using the guidelines above.
#. Push your branch to your fork on GitHub.
#. Open a Pull Request against the `develop` branch of the main
repository.
#. Ensure all tests pass and the code adheres to the project's style
guidelines.
#. Request a review from maintainers or other contributors.

***************
Running Tests
***************

We use pytest for our test suite. To run tests:

.. code:: bash

# Run all tests
pytest

# Run tests in a specific file
pytest tests/test_<file>.py

Note: Some tests, like `test_gnn.py`, may run slower on CPU and are
better suited for GPU execution.

************************
Building Documentation
************************

You can build the documentation locally to preview changes before
submitting a Pull Request. We use Sphinx for documentation.

You can install the dependencies for building the documentation with:

.. code:: bash

pip install '.[docs]'

To build the documentation locally:

.. code:: bash

cd docs
make html

The generated documentation will be in `docs/_build/html/index.html`.

*********************
Code Review Process
*********************

#. All code changes must be reviewed before merging.
#. Address any feedback or comments from reviewers promptly.
#. Once approved, a maintainer will merge your Pull Request.

******************
Reporting Issues
******************

If you encounter a bug or have a feature request:

#. Check the existing issues to avoid duplicates.
#. If it's a new issue, create a detailed bug report or feature request.
#. Use clear, descriptive titles and provide as much relevant
information as possible.

Thank you for contributing to Anemoi Graphs! Your efforts help improve
the project for everyone.
Loading
Loading